erick26 Posted April 10, 2021 Group: Members Topic Count: 12 Topics Per Day: 0.01 Content Count: 24 Reputation: 0 Joined: 02/08/21 Last Seen: March 15, 2023 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 Group: Members Topic Count: 49 Topics Per Day: 0.01 Content Count: 1826 Reputation: 288 Joined: 08/03/12 Last Seen: 56 minutes ago 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(.@name$[.@i]) getmapxy( .@map$,.@x,.@y,0,.@name$[.@i] ); try change 0 to BL_PC getmapxy( .@map$,.@x,.@y,BL_PC,.@name$[.@i] ); Quote Link to comment Share on other sites More sharing options...
0 Chaos92 Posted April 10, 2021 Group: Members Topic Count: 49 Topics Per Day: 0.01 Content Count: 1826 Reputation: 288 Joined: 08/03/12 Last Seen: 56 minutes ago 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 .@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 && !checkvending(.@name$[.@i]) ){ 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; } 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 Group: Members Topic Count: 12 Topics Per Day: 0.01 Content Count: 24 Reputation: 0 Joined: 02/08/21 Last Seen: March 15, 2023 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(.@name$[.@i]) Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted April 10, 2021 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted April 10, 2021 (edited) - script sample -1,{ OnInit: bindatcmd "giveitem", strnpcinfo(3)+"::OnAtcommand", 99, 99; end; OnAtcommand: if (.@atcmd_numparameters < 2) { dispbottom .@atcmd_command$ + " failed. Usage: " + .@atcmd_command$ + " <item_id> <amount> <map>"; end; } .@item_id = atoi(.@atcmd_parameters$[0]); if (getitemname(.@item_id) == "null") { dispbottom .@atcmd_command$ + " failed. Invalid item #" + .@item_id; end; } .@amount = 1; .@map$ = strcharinfo(3); if (.@atcmd_parameters$[1] != "") .@amount = min(atoi(.@atcmd_parameters$[1]), 30000); if (.@atcmd_parameters$[2] != "") .@map$ = .@atcmd_parameters$[2]; announce "<SYSTEM> GM "+strcharinfo(0)+" gave "+.@amount+"x "+getitemname(.@item_id)+" everyone in "+.@map$+".", bc_all; addrid(5, 0 , .@map$); getitem .@item_id, .@amount; 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 Group: Members Topic Count: 12 Topics Per Day: 0.01 Content Count: 24 Reputation: 0 Joined: 02/08/21 Last Seen: March 15, 2023 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...
Question
erick26
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
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.