buda Posted November 22, 2012 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 36 Reputation: 0 Joined: 06/21/12 Last Seen: December 19, 2012 Share Posted November 22, 2012 (edited) guys, the script below is a lucky pick for every 15 mins for only one person, but how can i edit it into all the online players? thanks master scripters!!! - script AutoFunEvent -1,{ OnMinute15: OnMinute30: OnMinute45: OnMinute00: while(1) { query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid; attachrid .@aid; if(CheckVending()) { DetachRID(); continue; } announce strcharinfo(0) +" has won the Rychi Lucky Pick Event!!!", 0; getitem 607,1 break; } end; } dear master scripters, how can i have an auto reward to all the players online every 5 minutes except for the vendors? Edited November 22, 2012 by Mysterious Topic Merged - Please use [CODEBOX] for content longer than 10 lines. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 22, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 22, 2012 - script itemall -1,{ OnMinute00: OnMinute15: OnMinute30: OnMinute45: freeloop 1; while ( getusers(1) > .@count ) { .@nb = query_sql("select account_id from `char` where online = 1 limit 128 offset "+ .@count, .@aid ); .@i = 0; while ( .@i < .@nb ) { if ( attachrid(.@aid[.@i]) ) if ( !checkvending() && !checkchatting() ) getitem "Yggdrasilberry_Box", 1; .@i++; } .@count += 128; } freeloop 0; end; } Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 22, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 22, 2012 @Annie - There really isn't a need for attachrid in this case, since your already doing a sql_query. You can simply pull the player's name as well. - script itemall -1,{ OnMinute00: OnMinute15: OnMinute30: OnMinute45: freeloop 1; while ( getusers(1) > .@count ) { .@nb = query_sql("select account_id, name from `char` where online = 1 limit 128 offset "+ .@count, .@aid,.@name$ ); .@i = 0; while ( .@i < .@nb ) { if ( !checkvending( .@name$[.@i] ) && !checkchatting( .@name$[.@i] ) getitem "Yggdrasilberry_Box", 1,.@aid[.@i]; .@i++; } .@count += 128; } freeloop 0; end; } This is only since you are already running the script for online players. However, I do see why you used attachrid. It's because someone may log out....The more I think about it, your way is more efficient lol. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 22, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 22, 2012 (edited) its been sometime someone able to criticize my scripts ... hehehe ... however I think your method is more efficient - script itemall -1,{ OnInit: for ( .@i = 2000004; .@i >= 2000000; .@i-- ) { query_sql "select name from `char` where account_id = "+ .@i +" limit 1", .@name$; announce checkvending( .@name$ ) +" "+ readparam(bVit, .@name$), 0; // success to loop through even offline getitem 501, 1, .@i; // also success to loop through even offline } } certain kinds of script commands that can optionally specify a player name field these kinds of script commands can continue to loop through even if the player is offline if specified a player name/account_id field EDIT: on 2nd thought ... now I think mine more efficient ... because its from the source if(script_hasdata(st,2)) sd = map_nick2sd(script_getstr(st,2)); else sd = script_rid2sd(st); I used attachrid already, so it just called out script_rid2sd but your map_nick2sd has to search through every online player with a specified name... I mean, my script just attachrid once and script_rid2sd 3 times ( checkchatting() checkvending() getitem ) but your script parse map_nick2sd 3 times in the source ... Edited November 22, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 22, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 22, 2012 I see... I just assumed that if the player logged off in the 1 second it'd take the script to run, you'd get an error for him onto being online. But if specifying a name for certain commands stops this error, then I guess your right lol. Quote Link to comment Share on other sites More sharing options...
buda Posted November 23, 2012 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 36 Reputation: 0 Joined: 06/21/12 Last Seen: December 19, 2012 Author Share Posted November 23, 2012 thanks for the quick response master scrpters, how can i edit this into vending only, ? if ( !checkvending( .@name$[.@i] ) && !checkchatting( .@name$[.@i] ) how can i delete the checkchatting? Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 23, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 23, 2012 (edited) By... Deleting it along with the & &.... You seriously should look into script_commands.txt, especially if you are a server owner. Edit: @Annie - I guess your right lol. While mine may look more efficient at first glance... it sure a heck isnt lol. Edited November 23, 2012 by GmOcean Quote Link to comment Share on other sites More sharing options...
buda Posted November 23, 2012 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 36 Reputation: 0 Joined: 06/21/12 Last Seen: December 19, 2012 Author Share Posted November 23, 2012 hmmmmm,, so this will be our final script master scripters? - script itemall -1,{ OnMinute00: OnMinute15: OnMinute30: OnMinute45: freeloop 1; while ( getusers(1) > .@count ) { .@nb = query_sql("select account_id, name from `char` where online = 1 limit 128 offset "+ .@count, .@aid,.@name$ ); .@i = 0; while ( .@i < .@nb ) { if ( !checkvending( .@name$[.@i] ) && !checkchatting( .@name$[.@i] ) getitem "Yggdrasilberry_Box", 1,.@aid[.@i]; .@i++; } .@count += 128; } freeloop 0; end; } Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 23, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 23, 2012 Both will work, but you should use Annieruru's script, since it is more efficient. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 23, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 23, 2012 (edited) @buda, though script request section is a place ask for a script, but we usually don't make this kind of simple edit I strongly suggest you should hire a scripter by posting in this area, so you can assign someone to help organize your server here you go ... simple edit - script itemall -1,{ OnMinute00: OnMinute15: OnMinute30: OnMinute45: freeloop 1; while ( getusers(1) > .@count ) { .@nb = query_sql("select account_id from `char` where online = 1 limit 128 offset "+ .@count, .@aid ); .@i = 0; while ( .@i < .@nb ) { if ( attachrid(.@aid[.@i]) ) if ( !checkvending() ) getitem "Yggdrasilberry_Box", 1; .@i++; } .@count += 128; } freeloop 0; end; } EDIT: for below... suddenly feel lazy to do this request ... x.x Edited November 23, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
buda Posted November 23, 2012 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 36 Reputation: 0 Joined: 06/21/12 Last Seen: December 19, 2012 Author Share Posted November 23, 2012 (edited) Thanks Master Anie and Master Ocean... Please come at my house on December 25! i will treat you both! hahaahahah thanks for your efforts, i hope we can fix the final script, cuz it is not working I have a thought, can we convert the hourly points to ygg berry every 15 minutes? Includes: online players and AFK player Excludes: Vending players //===== Hourly Points Script ========================================= //===== By: ========================================================== //= nostafu //===== Current Version: ============================================= //= 1.3 //===== Compatible With: ============================================= //= Any eAthena Version //===== Description: ================================================= //= Get Points every successful hours of gameplay, you cannot get //= the points even if you miss a second or a minute. A player will //= get a very big bonus if they played 12 hours consecutively //= or without logging out of the game. If the player is vending //= the script will then stop. //==================================================================== - script Hourly Points -1,{ //--Start of the Script OnPCLoginEvent: attachnpctimer ""+strcharinfo(0)+""; initnpctimer; end; OnTimer30000: //Check if Vending (normal or @at) if(checkvending() >= 1 || checkchatting() == 1) { dispbottom "Your Hourly Points have stopped because you were vending / chatting. Please relog if you wish to start again."; stopnpctimer; end; } //Check if Idle getmapxy( .@map$, .@x, .@y, 0 ); if(@map$ == .@map$ && @x == .@x && @y == .@y) { set @afk, @afk + 1; } //If move timer resets else { set @afk, 0; } set @map$, .@map$; set @x, .@x; set @y, .@y; //Idle Check for 30 Minutes if(@afk == 30) { dispbottom "Your Hourly Points have stopped because you were idle for 30 minutes. Please relog if you wish to start again."; stopnpctimer; end; } end; OnTimer60000: set #minute, #minute + 1; //Check for 1 Minute if(#minute == 60){ set #minute,0; set .@point_amt, 10; //Points to get every hour (default: 10) set #KAFRAPOINTS, #KAFRAPOINTS + .@point_amt; dispbottom "You received "+.@point_amt+" Hourly Points by staying in Rychi Infinity Ragnarok Online Server for 1 hour."; dispbottom "Current Balance = "+#KAFRAPOINTS+" Hourly Points"; set @consecutive_hour, @consecutive_hour + 1; } //Check for 12 hours consecutive if(@consecutive_hour == 12) { set @consecutive_hour,0; set .@cpoint_amt, 50; //Points to get for 12 Consecutive hours (default: 50) set #KAFRAPOINTS, #KAFRAPOINTS + .@cpoint_amt; dispbottom "You received "+.@cpoint_amt+" Hourly Points in playing for 12 consecutive hours."; dispbottom "Current Balance = "+#KAFRAPOINTS+" Hourly Points"; } stopnpctimer; initnpctimer; end; } //--End of the Script Edited November 23, 2012 by AnnieRuru use [codebox] if the script > 10 lines Quote Link to comment Share on other sites More sharing options...
GM Takumirai Posted November 23, 2012 Group: Members Topic Count: 69 Topics Per Day: 0.01 Content Count: 592 Reputation: 31 Joined: 11/14/11 Last Seen: July 29, 2015 Share Posted November 23, 2012 im confuse on this script request Quote Link to comment Share on other sites More sharing options...
Emistry Posted November 25, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 20 hours ago Share Posted November 25, 2012 @buda replace set #KAFRAPOINTS, #KAFRAPOINTS + .@point_amt; with getitem 607,.@point_amt; refer getitem or getitem2 Quote Link to comment Share on other sites More sharing options...
buda Posted November 25, 2012 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 36 Reputation: 0 Joined: 06/21/12 Last Seen: December 19, 2012 Author Share Posted November 25, 2012 Thanks Master Emi!!!!!! mery xmas! Quote Link to comment Share on other sites More sharing options...
Question
buda
guys, the script below is a lucky pick for every 15 mins for only one person,
but how can i edit it into all the online players?
thanks master scripters!!!
dear master scripters,
how can i have an auto reward to all the players online every 5 minutes except for the vendors?
Edited by MysteriousTopic Merged - Please use [CODEBOX] for content longer than 10 lines.
Link to comment
Share on other sites
13 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.