Mythryx Posted March 4, 2020 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 9 Reputation: 0 Joined: 10/23/19 Last Seen: May 30, 2020 Share Posted March 4, 2020 As title says, would it be possible? Fairly new with scripting and is still learning. Any help would be very appreciated. Thank you. Quote Link to comment Share on other sites More sharing options...
0 Mabuhay Posted March 4, 2020 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 446 Reputation: 232 Joined: 03/20/12 Last Seen: October 22, 2020 Share Posted March 4, 2020 2 hours ago, Mythryx said: As title says, would it be possible? Fairly new with scripting and is still learning. Any help would be very appreciated. Thank you. https://rathena.org/board/files/file/4049-giveitem-command/ Quote Link to comment Share on other sites More sharing options...
0 Mythryx Posted March 5, 2020 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 9 Reputation: 0 Joined: 10/23/19 Last Seen: May 30, 2020 Author Share Posted March 5, 2020 (edited) On 3/4/2020 at 10:35 PM, Mabuhay said: https://rathena.org/board/files/file/4049-giveitem-command/ How would I actually use this? Sorry fairly new. Requesting help regarding this script. all#item#amount works but when i use map#item#amount it doesn't give out the items. - script gmnpc -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; } Edited March 5, 2020 by Mythryx Quote Link to comment Share on other sites More sharing options...
0 Chaos92 Posted March 15, 2020 Group: Members Topic Count: 49 Topics Per Day: 0.01 Content Count: 1826 Reputation: 288 Joined: 08/03/12 Last Seen: 40 minutes ago Share Posted March 15, 2020 u need to whisper npc:gmnpc About the map, I think because of new getmapxy https://github.com/rathena/rathena/blob/80810e24f820d0f5f92c3c62345de60a863eaf5a/doc/script_commands.txt#L3068 getmapxy( .@map$,.@x,.@y,0,.@name$[.@i] ); try to 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 noobzter003 Posted March 15, 2020 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 109 Reputation: 5 Joined: 03/17/16 Last Seen: April 15 Share Posted March 15, 2020 try this. Quote Link to comment Share on other sites More sharing options...
0 Mythryx Posted March 16, 2020 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 9 Reputation: 0 Joined: 10/23/19 Last Seen: May 30, 2020 Author Share Posted March 16, 2020 Thanks for all the answers! Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted March 16, 2020 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 March 16, 2020 (edited) if you're using a newer version of rAthena - script Sample -1,{ OnInit: bindatcmd "reward",strnpcinfo(3) + "::OnAtcommand", 99, 99; end; OnAtcommand: if (getgroupid() >= 99) { if (.@atcmd_parameters$[0] == "all" ) .map$ = "all"; else if (.@atcmd_parameters$[0] == "map" ) .map$ = strcharinfo(3); else if (getmapusers(.@atcmd_parameters$[0]) >= 0) .map$ = .@atcmd_parameters$[0]; else dispbottom "Error, pick 'map' or 'all' "; .itemid = atoi(.@atcmd_parameters$[1]); .amount = atoi(.@atcmd_parameters$[2]); if (getitemname(.itemid) == "null" || .amount < 1) dispbottom "Invalid item id #"+.itemid+" and amount ("+.amount+")."; else donpcevent strnpcinfo(3)+"::OnReward"; } end; OnWhisperGlobal: if (getgroupid() >= 99) { if (@whispervar0$ == "all" ) .map$ = "all"; else if (@whispervar0$ == "map" ) .map$ = strcharinfo(3); else if (getmapusers(@whispervar0$) >= 0) .map$ = @whispervar0$; else dispbottom "Error, pick 'map' or 'all' "; .itemid = atoi(@whispervar1$); .amount = atoi(@whispervar2$); if (getitemname(.itemid) == "null" || .amount < 1) dispbottom "Invalid item id #"+.itemid+" and amount ("+.amount+")."; else donpcevent strnpcinfo(3)+"::OnReward"; } end; OnReward: if (.map$ == "all") addrid(0); else if (.map$ != "") addrid(5, 0, .map$); getitem .itemid, .amount; end; } [npc:Sample] <map_mapname|map|all>#512#100 @reward <map_name|map|all> 512 100 Edited March 16, 2020 by Emistry Quote Link to comment Share on other sites More sharing options...
Question
Mythryx
As title says, would it be possible? Fairly new with scripting and is still learning.
Any help would be very appreciated.
Thank you.
Link to comment
Share on other sites
6 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.