Petey Pablo 0 Posted December 26, 2016 (edited) Help me to add 1m zeny fee to this script. Thank you - script broadcast FAKE_NPC,{ OnCommand: if ( !getstrlen( .@atcmd_parameters$ ) ) { message strcharinfo(0), "Please, enter a message (usage: @bst )."; end; } if (agitcheck()){ message strcharinfo(0), "Unable to use this command,"; message strcharinfo(0), "War of Emperium is ongoing!"; close; } $@input$ = implode(.@atcmd_parameters$," " ); $@name$ = strcharinfo(0); .@symbol$ = substr( .@atcmd_parameters$, 0,1 ); if ( .@symbol$ != "B>" && .@symbol$ != "S>" && .@symbol$ != "T>" ) { message strcharinfo(0), "Market Symbol is Needed when using this command ( B> S> T> )"; end; } if ( bst_delay + 60 > gettimetick(2) ) { message strcharinfo(0), "There is a 60 seconds delay of using this command again"; end; } query_sql ("SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` WHERE `char`.`online` = 1", .@account_id); bst_delay = gettimetick(2); // delay while ( .@i < getarraysize(.@account_id) ) { if ( attachrid( .@account_id[.@i] ) ) dispbottom "[ Market ] " + $@name$ + " : " + $@input$,0xFFD700; // display to every character on the server. detachrid; .@i++; } end; OnInit: bindatcmd "bst",strnpcinfo(0)+"::OnCommand", 0, 1; // bind @bst command. end; } Edited December 26, 2016 by Will Su Quote Share this post Link to post Share on other sites
0 Asheraf 123 Posted December 26, 2016 I would suggest using the channel system for this npc instead of looping for every player, however here you go - script broadcast FAKE_NPC,{ OnCommand: if (!getstrlen(.@atcmd_parameters$)) { message strcharinfo(PC_NAME), "Please, enter a message (usage: @bst)."; end; } if (agitcheck()) { message strcharinfo(PC_NAME), "Unable to use this command,"; message strcharinfo(PC_NAME), "War of Emperium is ongoing!"; close; } $@input$ = implode(.@atcmd_parameters$, " "); $@name$ = strcharinfo(PC_NAME); .@symbol$ = substr(.@atcmd_parameters$, 0, 1); if (.@symbol$ != "B>" && .@symbol$ != "S>" && .@symbol$ != "T>") { message strcharinfo(PC_NAME), "Market Symbol is Needed when using this command ( B> S> T>)"; end; } if (bst_delay + 60 > gettimetick(2)) { message strcharinfo(PC_NAME), "There is a 60 seconds delay of using this command again"; end; } if (Zeny < 1000000) { message strcharinfo(PC_NAME), "You need to pay a 1m fee before sending your message."; end; } Zeny -= 1000000; query_sql ("SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` WHERE `char`.`online` = 1", .@account_id); bst_delay = gettimetick(2); // delay while (.@i < getarraysize(.@account_id)) { if (attachrid( .@account_id[.@i])) dispbottom "[ Market ] " + $@name$ + " : " + $@input$,0xFFD700; // display to every character on the server. detachrid; ++.@i; } end; OnInit: bindatcmd "bst", strnpcinfo(NPC_NAME) + "::OnCommand", 0, 1; // bind @bst command. end; } 1 Legend reacted to this Quote Share this post Link to post Share on other sites
0 n0tttt 0 Posted December 26, 2016 (edited) I optimized it a bit. http://pastebin.com/raw/wJPtYU6c Edited December 26, 2016 by n0tttt Quote Share this post Link to post Share on other sites
Help me to add 1m zeny fee to this script. Thank you
Edited by Will SuShare this post
Link to post
Share on other sites