erick26 Posted April 10, 2021 Share Posted April 10, 2021 Hi Everyone, I would like to why the @giveitem command is not working properly for example "@giveitem 909 1 map" not everyone in the map is able to get the item what I encounter is only few of the people receive the item but not everyone. Quote Link to comment Share on other sites More sharing options...
0 Chaos92 Posted April 11, 2021 Share Posted April 11, 2021 9 hours ago, erick26 said: when i do map it's saying given to 0 players even if i have 2 players standing beside me. and if i want to give to everyone including vendors i just need to remove && !checkvending([email protected]$[[email protected]]) getmapxy( [email protected]$,[email protected],[email protected],0,[email protected]$[[email protected]] ); try change 0 to BL_PC getmapxy( [email protected]$,[email protected],[email protected],BL_PC,[email protected]$[[email protected]] ); Quote Link to comment Share on other sites More sharing options...
0 Chaos92 Posted April 10, 2021 Share Posted April 10, 2021 20 minutes ago, erick26 said: Hi Everyone, I would like to why the @giveitem command is not working properly for example "@giveitem 909 1 map" not everyone in the map is able to get the item what I encounter is only few of the people receive the item but not everyone. // usage : // [npc:Sample]map#512#10 // [npc:Sample]all#512#123 - script itemall -1,{ OnWhisperGlobal: if( getgroupid() >= 99 ){ // check map if( @whispervar0$ == "all" ) set [email protected]$,""; else if( @whispervar0$ == "map" ) set [email protected]$,strcharinfo(3); else { dispbottom "Error, pick 'map' or 'all' "; end; } // check item set [email protected],atoi( @whispervar1$ ); set [email protected],atoi( @whispervar2$ ); if( getitemname( [email protected] ) == "null" || [email protected] < 1 ){ dispbottom "Enter valid item id and amount."; } set [email protected]_id,getcharid(3); query_sql( "SELECT COUNT(`account_id`) FROM `char` WHERE `online` = 1 ", [email protected] ); while( [email protected] < [email protected] ){ query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY `account_id` LIMIT 128 OFFSET "[email protected], [email protected],[email protected]$ ); set [email protected],0; set [email protected],getarraysize( [email protected] ); while( [email protected] < [email protected] ){ if( [email protected][[email protected]] != [email protected]_id && !checkvending([email protected]$[[email protected]]) ){ if( [email protected]$ != "" ){ getmapxy( [email protected]$,[email protected],[email protected],0,[email protected]$[[email protected]] ); if( [email protected]$ == [email protected]$ ){ getitem [email protected],[email protected],[email protected][[email protected]]; set [email protected],[email protected] + 1; } }else{ getitem [email protected],[email protected],[email protected][[email protected]]; set [email protected],[email protected] + 1; } } set [email protected],[email protected] + 1; set [email protected],[email protected] + 1; } set [email protected],[email protected] + [email protected]; deletearray [email protected],[email protected]; deletearray [email protected]$,[email protected]; } dispbottom "Gave "[email protected]+" x "+getitemname( [email protected] )+" to "[email protected]+" Player(s)."; } end; } usage : whisper to npc:itemall (required groupid 99 or above or edit it in the script). in textbox try type : map#501#1 all#501#1 Quote Link to comment Share on other sites More sharing options...
0 erick26 Posted April 10, 2021 Author Share Posted April 10, 2021 Quote usage : whisper to npc:itemall (required groupid 99 or above or edit it in the script). in textbox try type : map#501#1 all#501#1 when i do map it's saying given to 0 players even if i have 2 players standing beside me. and if i want to give to everyone including vendors i just need to remove && !checkvending([email protected]$[[email protected]]) Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted April 10, 2021 Share Posted April 10, 2021 (edited) - script sample -1,{ OnInit: bindatcmd "giveitem", strnpcinfo(3)+"::OnAtcommand", 99, 99; end; OnAtcommand: if ([email protected]_numparameters < 2) { dispbottom [email protected]_command$ + " failed. Usage: " + [email protected]_command$ + " <item_id> <amount> <map>"; end; } [email protected]_id = atoi([email protected]_parameters$[0]); if (getitemname([email protected]_id) == "null") { dispbottom [email protected]_command$ + " failed. Invalid item #" + [email protected]_id; end; } [email protected] = 1; [email protected]$ = strcharinfo(3); if ([email protected]_parameters$[1] != "") [email protected] = min(atoi([email protected]_parameters$[1]), 30000); if ([email protected]_parameters$[2] != "") [email protected]$ = [email protected]_parameters$[2]; announce "<SYSTEM> GM "+strcharinfo(0)+" gave "[email protected]+"x "+getitemname([email protected]_id)+" everyone in "[email protected]$+".", bc_all; addrid(5, 0 , [email protected]$); getitem [email protected]_id, [email protected]; end; } @giveitem <item_id> <amount> {<map>} Edited April 10, 2021 by Emistry updated Quote Link to comment Share on other sites More sharing options...
0 erick26 Posted April 10, 2021 Author Share Posted April 10, 2021 Quote @giveitem <item_id> <amount> {<map>} have tried but keeps getting invalid item #1 Quote Link to comment Share on other sites More sharing options...
Hi Everyone,
I would like to why the @giveitem command is not working properly for example "@giveitem 909 1 map" not everyone in the map is able to get the item what I encounter is only few of the people receive the item but not everyone.
Link to comment
Share on other sites