i try use script vending control by emistry
//===== eAthena Script =====================================
//= Vendor Control
//===== By: ================================================
//= Original by Emistry
//= Rewrite by AnnieRuru
//===== Current Version: ===================================
//= 1.0
//===== Compatible With: ===================================
//= Hercules 2014-02-18
//===== Description: =======================================
//= Vendors only vend on certain coordinate, looks tidy
//===== Topic ==============================================
//= http://hercules.ws/board/topic/4509-
//===== Additional Comments: ===============================
//= Emistry would love his script rewritten by his master ?
//==========================================================
vend_zone,100,103,4 script Vending Helper 4_GEFFEN_13,{
mes "["+ strnpcinfo(1) +"]";
if ( !getskilllv( "MC_VENDING" ) ) {
mes "You dont have ^0055FFVending Skill^000000.";
close;
}
mes "Select a slot and start vending.";
while ( true ) {
.@menu$ = .@currentpage ? "Previous Page:" : ":";
.@pageindex = .@currentpage * .slotperpage;
for ( .@i = 0; .@i < .slotperpage && .@pageindex + .@i < .count; .@i++ ) {
if ( !getmapxy( .@map$, .@x, .@y, 1, "#vend_slot"+( .@pageindex + .@i ) ) && getareausers( .map$, .@x, .@y, .@x, .@y ) )
.@menu$ = .@menu$ +"Slot No."+( .@pageindex + .@i +1 )+" - ^FF0000[UnAvailable]^000000:";
else {
.@menu$ = .@menu$ +"Slot No."+( .@pageindex + .@i +1 )+" - ^00CC00[Available]^000000:";
.@available++;
}
}
if ( .@currentpage != .maxpage )
.@menu$ = .@menu$ + "Next Page";
.@pick = select( .@menu$ ) -1;
if ( !.@pick )
.@currentpage--;
else if ( .@pick == .slotperpage +1 )
.@currentpage++;
else
break;
}
.@s = .@currentpage * .slotperpage + .@pick -1 ;
if ( !getmapxy( .@map$, .@x, .@y, 1, "#vend_slot"+ .@s ) && getareausers( .map$, .@x, .@y, .@x, .@y ) ) {
mes " ";
mes "This slot is ^FF0000[UnAvailable]^000000.";
close;
}
warp .@map$, .@x, .@y;
hideonnpc "#vend_slot"+ .@s;
donpcevent "#vend_slot"+ .@s +"::OnCheckAvailable";
end;
OnInit:
// ======================= Configuration HERE =============================
.map$ = "vend_zone"; // map
setarray .@x, 56,59,62,65,68,71,74,77,80,83,86,89,92,95,104,107,110,113,116,119,122,125,128,131,134,137,140,143; // x coordinates
setarray .@y, 140,145,113,0; // y coordinates
.slotperpage = 20; // display how many slots per page (prevent making the menu too long)
// too many people said this script causes vendor cannot vend at all on the map, ( coordinates has set too near )
// because there is a setting in 'conf\battle\player.conf' to disallow player to vend too near other npcs
setbattleflag "min_npc_vendchat_distance", 0; // comment this line to make the default value back to 3
freeloop 1;
setcell .map$, 0,0, 500,500, cell_novending, 1;
.@x_size = getarraysize( .@x );
.@y_size = getarraysize( .@y );
.@i = 0;
while ( .@i < .@y_size ) {
.@j = 0;
while ( .@j < .@x_size ) {
if ( checkcell( .map$, .@x[.@j], .@y[.@i], cell_chkpass ) ) {
movenpc "#vend_slot"+ .count, .@x[.@j], .@y[.@i];
setcell .map$, .@x[.@j], .@y[.@i], .@x[.@j], .@y[.@i], cell_novending, 0;
if ( getareausers( .map$, .@x[.@j], .@y[.@i], .@x[.@j], .@y[.@i] ) ) {
hideonnpc "#vend_slot"+ .count;
donpcevent "#vend_slot"+ .count +"::OnCheckAvailable";
}
.count++;
}
.@j++;
}
.@i++;
}
.maxpage = .count / .slotperpage + ( .count % .slotperpage > 0 ) -1;
end;
}
- script vend_slot -1,{
mes "[Vending Slot]";
getmapxy .@map$, .@x, .@y, 1;
if ( !getskilllv( "MC_VENDING" ) ) {
mes "You dont have ^0055FFVending Skill^000000.";
close;
}
else if ( getareausers( .@map$, .@x, .@y, .@x, .@y ) ) {
mes "Someone already using this slot";
close;
}
mes "Spot : ^777777Available^000000";
mes "^0055FF[ Vending Area Rules ]^000000";
mes "^FF0000 ~ Use proper Shop Name.^000000";
mes "^777777Player who failed to follow these rules will be punished.^000000";
unitwalk getcharid(3), .@x, .@y;
hideonnpc strnpcinfo(0);
donpcevent strnpcinfo(0)+"::OnCheckAvailable";
close;
OnCheckAvailable:
sleep 10000;
getmapxy .@map$, .@x, .@y, 1;
while ( getareausers( .@map$, .@x, .@y, .@x, .@y ) ) sleep 10000;
hideoffnpc strnpcinfo(0);
end;
}
// Add more if needed.
vend_zone,0,0,4 duplicate(vend_slot) #vend_slot0 4_BULLETIN_BOARD2
it's possible to setting locate without using array just use spesific X and Y?
//===== eAthena Script =====================================
//= Vendor Control
//===== By: ================================================
//= Original by Emistry
//= Rewrite by AnnieRuru
//===== Current Version: ===================================
//= 1.0
//===== Compatible With: ===================================
//= Hercules 2014-02-18
//===== Description: =======================================
//= Vendors only vend on certain coordinate, looks tidy
//===== Topic ==============================================
//= http://hercules.ws/board/topic/4509-
//===== Additional Comments: ===============================
//= Emistry would love his script rewritten by his master ?
//==========================================================
vend_zone,100,103,4 script Vending Helper 4_GEFFEN_13,{
mes "["+ strnpcinfo(1) +"]";
if ( !getskilllv( "MC_VENDING" ) ) {
mes "You dont have ^0055FFVending Skill^000000.";
close;
}
mes "Select a slot and start vending.";
while ( true ) {
.@menu$ = .@currentpage ? "Previous Page:" : ":";
.@pageindex = .@currentpage * .slotperpage;
for ( .@i = 0; .@i < .slotperpage && .@pageindex + .@i < .count; .@i++ ) {
if ( !getmapxy( .@map$, .@x, .@y, 1, "#vend_slot"+( .@pageindex + .@i ) ) && getareausers( .map$, .@x, .@y, .@x, .@y ) )
.@menu$ = .@menu$ +"Slot No."+( .@pageindex + .@i +1 )+" - ^FF0000[UnAvailable]^000000:";
else {
.@menu$ = .@menu$ +"Slot No."+( .@pageindex + .@i +1 )+" - ^00CC00[Available]^000000:";
.@available++;
}
}
if ( .@currentpage != .maxpage )
.@menu$ = .@menu$ + "Next Page";
.@pick = select( .@menu$ ) -1;
if ( !.@pick )
.@currentpage--;
else if ( .@pick == .slotperpage +1 )
.@currentpage++;
else
break;
}
.@s = .@currentpage * .slotperpage + .@pick -1 ;
if ( !getmapxy( .@map$, .@x, .@y, 1, "#vend_slot"+ .@s ) && getareausers( .map$, .@x, .@y, .@x, .@y ) ) {
mes " ";
mes "This slot is ^FF0000[UnAvailable]^000000.";
close;
}
warp .@map$, .@x, .@y;
hideonnpc "#vend_slot"+ .@s;
donpcevent "#vend_slot"+ .@s +"::OnCheckAvailable";
end;
OnInit:
// ======================= Configuration HERE =============================
.map$ = "vend_zone"; // map
setarray .@x, 56,59,62,65,68,71,74,77,80,83,86,89,92,95,104,107,110,113,116,119,122,125,128,131,134,137,140,143; // x coordinates
setarray .@y, 140,145,113,0; // y coordinates
.slotperpage = 20; // display how many slots per page (prevent making the menu too long)
// too many people said this script causes vendor cannot vend at all on the map, ( coordinates has set too near )
// because there is a setting in 'conf\battle\player.conf' to disallow player to vend too near other npcs
setbattleflag "min_npc_vendchat_distance", 0; // comment this line to make the default value back to 3
freeloop 1;
setcell .map$, 0,0, 500,500, cell_novending, 1;
.@x_size = getarraysize( .@x );
.@y_size = getarraysize( .@y );
.@i = 0;
while ( .@i < .@y_size ) {
.@j = 0;
while ( .@j < .@x_size ) {
if ( checkcell( .map$, .@x[.@j], .@y[.@i], cell_chkpass ) ) {
movenpc "#vend_slot"+ .count, .@x[.@j], .@y[.@i];
setcell .map$, .@x[.@j], .@y[.@i], .@x[.@j], .@y[.@i], cell_novending, 0;
if ( getareausers( .map$, .@x[.@j], .@y[.@i], .@x[.@j], .@y[.@i] ) ) {
hideonnpc "#vend_slot"+ .count;
donpcevent "#vend_slot"+ .count +"::OnCheckAvailable";
}
.count++;
}
.@j++;
}
.@i++;
}
.maxpage = .count / .slotperpage + ( .count % .slotperpage > 0 ) -1;
end;
}
- script vend_slot -1,{
mes "[Vending Slot]";
getmapxy .@map$, .@x, .@y, 1;
if ( !getskilllv( "MC_VENDING" ) ) {
mes "You dont have ^0055FFVending Skill^000000.";
close;
}
else if ( getareausers( .@map$, .@x, .@y, .@x, .@y ) ) {
mes "Someone already using this slot";
close;
}
mes "Spot : ^777777Available^000000";
mes "^0055FF[ Vending Area Rules ]^000000";
mes "^FF0000 ~ Use proper Shop Name.^000000";
mes "^777777Player who failed to follow these rules will be punished.^000000";
unitwalk getcharid(3), .@x, .@y;
hideonnpc strnpcinfo(0);
donpcevent strnpcinfo(0)+"::OnCheckAvailable";
close;
OnCheckAvailable:
sleep 10000;
getmapxy .@map$, .@x, .@y, 1;
while ( getareausers( .@map$, .@x, .@y, .@x, .@y ) ) sleep 10000;
hideoffnpc strnpcinfo(0);
end;
}
// Add more if needed.
vend_zone,0,0,4 duplicate(vend_slot) #vend_slot0 4_BULLETIN_BOARD2
it's possible to setting locate without using array just use spesific X and Y?