hello
i use this script from emistry
// usage :
// [npc:Sample]map#512#10
// [npc:Sample]all#512#123
- script Sample -1,{
OnWhisperGlobal:
if( getgmlevel() >= 99 ){
// check map
if( @whispervar0$ == "all" ) set .@type$,"";
else if( @whispervar0$ == "map" ) set .@type$,strcharinfo(3);
else {
dispbottom "Error, pick 'map' or 'all' ";
end;
}
// check item
set .@itemid,atoi( @whispervar1$ );
set .@amount,atoi( @whispervar2$ );
if( getitemname( .@itemid ) == "null" || .@amount < 1 ){
dispbottom "Enter valid item id and amount.";
}
set .@self_id,getcharid(3);
query_sql( "SELECT COUNT(`account_id`) FROM `char` WHERE `online` = 1 ", .@total );
while( .@count < .@total ){
query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY `account_id` LIMIT 128 OFFSET "+.@offset, .@aid,.@name$ );
set .@i,0;
set .@size,getarraysize( .@aid );
while( .@i < .@size ){
if( .@aid[.@i] != .@self_id ){
if( .@type$ != "" ){
getmapxy( .@map$,.@x,.@y,0,.@name$[.@i] );
if( .@map$ == .@type$ ){
getitem .@itemid,.@amount,.@aid[.@i];
set .@gave,.@gave + 1;
}
}else{
getitem .@itemid,.@amount,.@aid[.@i];
set .@gave,.@gave + 1;
}
}
set .@count,.@count + 1;
set .@i,.@i + 1;
}
set .@offset,.@offset + .@size;
deletearray .@aid,.@size;
deletearray .@name$,.@size;
}
dispbottom "Gave "+.@amount+" x "+getitemname( .@itemid )+" to "+.@gave+" Player(s).";
}
end;
}
and i have a problem, i usually use this when players are between 100-300 online, but when players get higher than 500 this script give rewards to players and players won't get anything, or when i reward players fore example white potions and blue potions, players will get only white potions or only blue.
so thats my problem, any help ?