//by Sim0n
/*
TODO:
- Items für 1ne woche gespielt, 1 monat 1 jahr....
*/
- script online_counter -1,{
OnInit:
//--->AFK System<---\\
//Enable Anti AFK (Checks if the player moves or not) else the time will stop when a player stops mooving for X minutes and start when he's moving again
set .anti_afk,1;
//Time which is needed tiill the timer stops, if a player is AFK
set .afk_mins,10;
//--->Reward Item<---\\
//Get an Item each 24hrs after played a certain time (1 = Yes, 0 = No)
set .getitem,0;
//Time after you will get an item in minutes
set .item_time,120;
//Item and amount you will get
set .item,512;
set .item_amount,1;
end;
OnPCLoginEvent:
if(!.anti_afk) {
//Without AFK System
set login_time,gettimetick(2);
dispbottom callfunc("seconds_to_days", sum_time_char, 0);
dispbottom callfunc("seconds_to_days", ##sum_time_acc, 1);
if (.getitem) {
if (gettimetick(2)-last_login >= 86400) { set last_login,gettimetick(2); set got_item,0; }
if (!got_item) {
sleep2 (.item_time)*60000;
announce "You played more then "+ .item_time +" minutes! Here's your gift!",bc_self,0xFF0000;
//Reward item
getitem .item, .item_amount;
set got_item,1;
}
}
end;
} else {
//With AFK System
dispbottom callfunc("seconds_to_days", sum_time_char, 0);
dispbottom callfunc("seconds_to_days", ##sum_time_acc, 1);
//dispbottom "[OC DEBUG] AFK Mins: "+.afk_mins;
while ( isloggedin( getcharid(3), getcharid(0) ) ) {
getmapxy @OC_map$, @OC_x, @OC_y, 0;
//dispbottom "[OC DEBUG] "+ @OC_map$ +" == "+ @OC_map_cache$ +" && "+ @OC_x_cache +" == "+ @OC_x +" && "+ @OC_y_cache +" == "+ @OC_y;
//dispbottom "[OC DEBUG] IF = "+ (@OC_map$ == @OC_map_cache$ && @OC_x_cache == @OC_x && @OC_y_cache == @OC_y);
if (@OC_map$ == @OC_map_cache$ && @OC_x_cache == @OC_x && @OC_y_cache == @OC_y) {
set OC_afk_run,OC_afk_run + 1;
if (OC_afk_run >= .afk_mins) {
set OC_afk, 1;
announce "You didn't move for "+ .afk_mins +" minute(s). Online Time Counter stopped.",bc_self,0xFF0000;
}
} else {
set OC_afk, 0;
if (OC_afk_run >= afk_mins) {
announce "Online Time Counter Started again.",bc_self,0xFF0000;
set OC_afk_run,0;
}
}
sleep2 60000;
set @OC_map_cache$, @OC_map$;
set @OC_x_cache, @OC_x;
set @OC_y_cache, @OC_y;
}
}
OnPCLogoutEvent:
if(!.anti_afk) {
//Without AFK System
set logout_time,gettimetick(2);
if (login_time) set sum_time_char, sum_time_char + logout_time - login_time;
set ##sum_time_acc, ##sum_time_acc + logout_time - login_time;
} else
set ##sum_time_acc, ##sum_time_acc + tmp_online_sec;
if (##sum_time_acc < sum_time_char) set ##sum_time_acc, ##sum_time_acc + sum_time_char;
OnWhisperGlobal:
//RESET Time, only GMs
if (getgmlevel() >= 60 && @whispervar0$ == "reset") {
set ##sum_time_acc,0;
set sum_time_char,0;
dispbottom "[Online Counter] Time resetted...";
}
end;
}
- script online_seconds_counter -1,{
OnPCLoginEvent:
if(getvariableofnpc( .anti_afk, "online_counter" )) {
while (!OC_afk) {
sleep2 1000;
set sum_time_char, sum_time_char + 1;
set tmp_online_sec, tmp_online_sec + 1;
if (getvariableofnpc( .getitem, "online_counter" )) {
if (gettimetick(2)-last_login >= 86400) { set last_login,gettimetick(2); set got_item,0; }
if (tmp_online_sec == getvariableofnpc( .item_time, "online_counter" )) {
announce "You played more then "+ getvariableofnpc( .item_time, "online_counter" ) +" minutes! Here's your gift!",bc_self,0xFF0000;
//Reward item
getitem getvariableofnpc( .item_time, "online_counter" ),getvariableofnpc( .item_amount, "online_counter" );
set got_item,1;
}
}
}
}
}
function script seconds_to_days {
set @days, getarg(0) / 86400;
set @hrs, (getarg(0) - @days * 86400) / 3600;
set @mins, (getarg(0) - (@hrs * 3600) - (@days * 86400)) / 60;
set @sec, getarg(0) - (@hrs * 3600) - (@mins * 60) - (@days * 86400);
if (!getarg(1))
set @time$,"[Online Counter Current Char] Days: "+ @days +" || Hours: "+ @hrs +" || Mins: "+ @mins +" || Seconds: "+@sec;
else
set @time$,"[Online Counter Account] Days: "+ @days +" || Hours: "+ @hrs +" || Mins: "+ @mins +" || Seconds: "+@sec;
return @time$;
}
Instead of an item, what to change to make it "#Time" variable points per minute?
Question
Currently
From link: http://rathena.org/board/topic/87122-%E2%99%A5-sim0ns-oldskool-script-collection/
Instead of an item, what to change to make it "#Time" variable points per minute?
Link to comment
Share on other sites
0 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.