xlaws27 3 Posted May 30, 2015 can someone make it? i dont wnt plug in because its very hard to insert thanks example: i am on prontera then i type @shower 501 100 all players on prontera will get an 100 pcs of red potion then the player will receive a message "Something has been drop from the sky" Quote Share this post Link to post Share on other sites
0 Angelmelody 221 Posted May 31, 2015 (edited) yeah thank u so much its working now.. do you recommend this instead of plug in? because @@Oxxy said --tho that's madness, imagine server with 200 online. Query'll load server a lot.-- btw can u make it like on the plug in? @shower (itemid) (quantity) example @shower 501 100 sorry for asking too much. frequently query problem wasn't exist on new one , and here you go! @shower <Item ID> <amount> - script asdfgadhjkl -1,{ end;OnInit: bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; end;OnShowerCommand: .@showeritemid = atoi(.@atcmd_parameters$[0]); .@showeritamount = atoi(.@atcmd_parameters$[1]); if ( !.@showeritemid ) { message strcharinfo(0), "@shower <Item ID> <amount>"; end; } if ( getiteminfo(.@showeritemid,2) == -1 ) { message strcharinfo(0), "Invalid Item ID"; message strcharinfo(0), "@shower <Item ID> <amount>"; end; } if(.@showeritamount <= 0) { message strcharinfo(0), "Invalid Item Amount"; message strcharinfo(0), "@shower <Item ID> <amount>"; end; } query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid); query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid); .@showermap$ = strcharinfo(3); freeloop(1); while ( .@minaid <= .@maxid ) { if(!attachrid(.@minaid++)) continue; if(strcharinfo(3) !=.@showermap$ ) continue; if(checkvending()) continue; getitem .@showeritemid,.@showeritamount; announce "Something has been drop from the sky!",bc_self,0xFFC0CB; } freeloop(0);end;} Edited May 31, 2015 by Angelmelody Quote Share this post Link to post Share on other sites
0 Oxxy 24 Posted May 30, 2015 (edited) You gotta compile plugin, because there's no efficient way to attach every player on map. Use @itemmap/getitem_map Edited May 30, 2015 by Oxxy Quote Share this post Link to post Share on other sites
0 Angelmelody 221 Posted May 30, 2015 (edited) db/re/map_zone_db.confinsert the "loadevent" into the mapflags brackets of the zone named "All".mapflags: ("loadevent",) - script asdfghjkl -1,{ end;OnInit: bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; end;OnShowerCommand: .@size = query_sql("select account_id from `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid); for ( .@i = 0; .@i < .@size; .@i++ ) { if(!attachrid(.@aid[.@i])) continue; if(CheckVending()) continue; getitem 501,100; announce "Something has been drop from the sky!",bc_self,0xFFC0CB; } end;OnPCLoadMapEvent: query_sql("UPDATE `char` SET last_map='"+strcharinfo(3)+"'");end;} Edited May 31, 2015 by Angelmelody Quote Share this post Link to post Share on other sites
0 Oxxy 24 Posted May 30, 2015 (edited) db/re/map_zone_db.conf insert the "loadevent" into the mapflags brackets of the zone named "All". mapflags: ( "loadevent", ) - script asdfghjkl -1,{ end;OnInit: bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; end;OnShowerCommand: .@size = query_sql("select account_id form `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid); for ( .@i = 0; .@i < .@size; .@i++ ) { if(!attachrid(.@aid[.@i])) continue; if(CheckVending()) continue; getitem 501,100; announce "Something has been drop from the sky!",bc_self,0xFFC0CB; } end;OnPCLoadMapEvent: query_sql("UPDATE `char` SET last_map='"+strcharinfo(3)+"'");end;} The problem in your script is that last_map isn't getting updated real time so some of players may not get the items. -- oh, I see your solution, tho that's madness, imagine server with 200 online. Query'll load server a lot. correct line: .@size = query_sql("select account_id form `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid); have to be .@size = query_sql("select account_id FROM `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid); Edited May 30, 2015 by Oxxy Quote Share this post Link to post Share on other sites
0 xlaws27 3 Posted May 31, 2015 (edited) db/re/map_zone_db.conf insert the "loadevent" into the mapflags brackets of the zone named "All". mapflags: ( "loadevent", ) - script asdfghjkl -1,{ end;OnInit: bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; end;OnShowerCommand: .@size = query_sql("select account_id from `char` where online = 1 and last_map ='"+strcharinfo(3)+"'",.@aid); for ( .@i = 0; .@i < .@size; .@i++ ) { if(!attachrid(.@aid[.@i])) continue; if(CheckVending()) continue; getitem 501,100; announce "Something has been drop from the sky!",bc_self,0xFFC0CB; } end;OnPCLoadMapEvent: query_sql("UPDATE `char` SET last_map='"+strcharinfo(3)+"'");end;} zones: ( { /* All zone is a dynamic (very special) zone that is forcebly inherited by ALL maps automatically */ name: "All" /* changing this name requires MAP_ZONE_ALL_NAME to also be changed in src/map/map.h file */ disabled_skills: { //both examples below disable napalm beat (id 11) to players //MG_NAPALMBEAT: "PLAYER" //ID11: "PLAYER" } disabled_items: { //Both examples below disable apple (id 501) //Apple: true //ID501: true } mapflags: ( "loadevent", ) mapflags: ( ) -------------------------------------------------------------------------------------------------------- this is what i did. is it okay? and theres an error what i did to fix it is i remove the () but i think what i did was wrong .. can u help me Edited May 31, 2015 by xlaws27 Quote Share this post Link to post Share on other sites
0 Angelmelody 221 Posted May 31, 2015 (edited) try this new one , it's no need to modify map_zone_db.conf now - script asdfgadhjkl -1,{ end;OnInit: bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; end;OnShowerCommand: query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid); query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid); .@showermap$ = strcharinfo(3); freeloop(1); while ( .@minaid <= .@maxid ) { if(!attachrid(.@minaid++)) continue; if(strcharinfo(3) !=.@showermap$ ) continue; if(checkvending()) continue; getitem 501,100; announce "Something has been drop from the sky!",bc_self,0xFFC0CB; } freeloop(0);end;} Edited May 31, 2015 by Angelmelody Quote Share this post Link to post Share on other sites
0 xlaws27 3 Posted May 31, 2015 (edited) thnks its working now Edited May 31, 2015 by xlaws27 Quote Share this post Link to post Share on other sites
0 Angelmelody 221 Posted May 31, 2015 (edited) now i type .@shower no more lag but I received nothing updated, try again... - script asdfgadhjkl -1,{ end;OnInit: bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; end;OnShowerCommand: query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid); query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid); .@showermap$ = strcharinfo(3); freeloop(1); while ( .@minaid <= .@maxid ) { if(!attachrid(.@minaid++)) continue; if(strcharinfo(3) !=.@showermap$ ) continue; if(checkvending()) continue; getitem 501,100; announce "Something has been drop from the sky!",bc_self,0xFFC0CB; } freeloop(0);end;} Edited May 31, 2015 by Angelmelody Quote Share this post Link to post Share on other sites
0 xlaws27 3 Posted May 31, 2015 now i type .@shower no more lag but I received nothing updated, try again... - script asdfgadhjkl -1,{ end;OnInit: bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; end;OnShowerCommand: query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid); query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid); .@showermap$ = strcharinfo(3); freeloop(1); while ( .@minaid <= .@maxid ) { if(!attachrid(.@minaid++)) continue; if(strcharinfo(3) !=.@showermap$ ) continue; if(checkvending()) continue; getitem 501,100; announce "Something has been drop from the sky!",bc_self,0xFFC0CB; } freeloop(0);end;} yeah thank u so much its working now.. do you recommend this instead of plug in? because @@Oxxy said --tho that's madness, imagine server with 200 online. Query'll load server a lot.-- btw can u make it like on the plug in? @shower (itemid) (quantity) example @shower 501 100 sorry for asking too much. Quote Share this post Link to post Share on other sites
0 xlaws27 3 Posted May 31, 2015 (edited) yeah thank u so much its working now.. do you recommend this instead of plug in? because @@Oxxy said --tho that's madness, imagine server with 200 online. Query'll load server a lot.-- btw can u make it like on the plug in? @shower (itemid) (quantity) example @shower 501 100 sorry for asking too much. frequently query problem wasn't exist on new one , and here you go! @shower <Item ID> <amount> - script asdfgadhjkl -1,{ end;OnInit: bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; end;OnShowerCommand: .@showeritemid = atoi(.@atcmd_parameters$[0]); .@showeritamount = atoi(.@atcmd_parameters$[1]); if ( !.@showeritemid ) { message strcharinfo(0), "@shower <Item ID> <amount>"; end; } if ( getiteminfo(.@showeritemid,2) == -1 ) { message strcharinfo(0), "Invalid Item ID"; message strcharinfo(0), "@shower <Item ID> <amount>"; end; } if(.@showeritamount <= 0) { message strcharinfo(0), "Invalid Item Amount"; message strcharinfo(0), "@shower <Item ID> <amount>"; end; } query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` ASC LIMIT 1", .@minaid); query_sql("SELECT `account_id` FROM `login` WHERE `sex`!='S' ORDER BY `account_id` DESC LIMIT 1", .@maxid); .@showermap$ = strcharinfo(3); freeloop(1); while ( .@minaid <= .@maxid ) { if(!attachrid(.@minaid++)) continue; if(strcharinfo(3) !=.@showermap$ ) continue; if(checkvending()) continue; getitem .@showeritemid,.@showeritamount; announce "Something has been drop from the sky!",bc_self,0xFFC0CB; } freeloop(0);end;} THANK YOU SO MUCH!!!! BTW will i received some lag/error issues if i showered it to 100~200 players? Edited May 31, 2015 by xlaws27 Quote Share this post Link to post Share on other sites
0 Aurora 4 Posted May 31, 2015 Does this have a GM level restriction? Quote Share this post Link to post Share on other sites
0 Kuya Jeo 120 Posted May 31, 2015 @@Aurora yeah it has restriction bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; Quote Share this post Link to post Share on other sites
0 Aurora 4 Posted May 31, 2015 @@Aurora yeah it has restriction bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; Can you translate this line in english? Quote Share this post Link to post Share on other sites
0 Angelmelody 221 Posted May 31, 2015 (edited) will i received some lag/error issues if i showered it to 100~200 players? It won't lag if players are over 200 , becoz the freeloop command can prevent the lagging of huge loop @@Aurora yeah it has restriction bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; Can you translate this line in english? you can read doc/script_commands.txt Edited May 31, 2015 by Angelmelody Quote Share this post Link to post Share on other sites
0 Aurora 4 Posted May 31, 2015 will i received some lag/error issues if i showered it to 100~200 players? It won't lag if players are over 200 , becoz the freeloop command can prevent the lagging of huge loop > @@Aurora yeah it has restriction bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; Can you translate this line in english? you can read doc/script_commands.txt 80,80 is the required GM Level. Did I get that right? Quote Share this post Link to post Share on other sites
0 Kuya Jeo 120 Posted May 31, 2015 will i received some lag/error issues if i showered it to 100~200 players? It won't lag if players are over 200 , becoz the freeloop command can prevent the lagging of huge loop >> @@Aurora yeah it has restriction bindatcmd "shower",strnpcinfo(3)+"::OnShowerCommand",80,80; Can you translate this line in english? you can read doc/script_commands.txt 80,80 is the required GM Level. Did I get that right? GM Level 80 and above 80 Quote Share this post Link to post Share on other sites
can someone make it? i dont wnt plug in because its very hard to insert thanks
example:
i am on prontera then
i type @shower 501 100
all players on prontera will get an 100 pcs of red potion then the player will receive a message "Something has been drop from the sky"
Share this post
Link to post
Share on other sites