Jump to content
  • 0

Help Sader Houry Reward


lucasjaco

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   1
  • Joined:  04/10/18
  • Last Seen:  

I would like to make that when the player leaves the game, time stops counting, and when it returns, the time goes back to where it stopped. For example, if the point is received every 1 hour, if the player leaves after 20 minutes, when he enters again, the time continues at 20 minutes, this way the player does not waste time if he needs to change char or disconnected .

Is it possible?

//===== rAthena Script =======================================
  //= saders Hourly Rewards
  //===== By: ==================================================
  //= Sader1992
  //https://rathena.org/board/profile/30766-sader1992/
  //===== Current Version: =====================================
  //= 1.2
  //===== Compatible With: =====================================
  //= rAthena Project
  //https://rathena.org/board/files/file/3647-saders-hourly-rewards/
  //https://github.com/sader1992/sader_scripts
  //===== Description: =========================================
  //==== all the configuration are in the last
  //==== support gepard / ip / or without them
  //==== if you use ip/gepard sql will be used for that
  //==== can add minimem level to get the rewards
  //==== can change the time
  //==== can ban the vending from the rewards (it will reset after relogin)
  //==== can add rewards else then variable
  //==== there is a shop npc for the variable
  //==== you can make it only for vip
  //==== can ban idle players for X time from the Hourly Rewards
  //==== player can ban his char from getting the reward by @HourlyBan (it will reset after relogin)
  //============================================================
  //==== please send me a message if you find error
  //==== if you like my work maybe consider support me at paypal
  //==== [email protected]
  //============================================================
  //==== 1.1 FIX Critical issue with gepard/ip and compatibility with my other scripts
  //==== 1.2 FIX GrPard Variable
  //============================================================
  - script sader_Hourly_Rewards -1,{
   
  OnHourlyRewards:
  if(#Hourly_Ban){
  message strcharinfo(0),"[Hourly Rewards]: You did ban this char from the Hourly Rewards , Relogin to change that .";
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  end;
  }
  if(.s_idle){
  if(checkidle() > .s_idle_time){
  message strcharinfo(0),"[Hourly Rewards]: No Hourly Rewards for IDLE Players!.";
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  end;
  }
  }
  if(.s_vip){
  if(!vip_status(VIP_STATUS_ACTIVE)){
  message strcharinfo(0),"[Hourly Rewards]: if you are a VIP you will get Hourly Rewards!.";
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  end;
  }
  }
  if(BaseLevel < .s_hourly_level){
  message strcharinfo(0),"[Hourly Rewards]: if you are level "+.s_hourly_level+" and more you will get Hourly Rewards!.";
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  end;
  }
  if(.s_vinding){
  if(checkvending() & .s_vinding){
  message strcharinfo(0),"[Hourly Rewards]: No Hourly Rewards for Venders , Relogin to change that .";
  if(.s_GePard_ip){
  query_logsql("delete from `sader_variables_log` where `variable` = '#Hourly_Rewads_Check' AND `account_id`= '"+getcharid(3)+"'");
  }
  #Hourly_Rewads_Check = 0;
  #Hourly_Ban = 1;
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  end;
  }
  }
  #Hourly_Rewads_Check += 1;
  if(.s_GePard_ip == 1){
  query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = '"+getcharid(3)+"'", .@s_last_unique_id$);
  query_logsql("SELECT value FROM `sader_variables_log` WHERE unique_id = '"+.@s_last_unique_id$+"' AND `variable` = '#Hourly_Rewads_Check'", .@s_GePard);
  if(.@s_GePard >= #Hourly_Rewads_Check){
  message strcharinfo(0),"[Hourly Rewards]: You already got the Hourly Rewards from this PC";
  #Hourly_Rewads_Check -= 1;
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  end;
  }
  if(.@s_GePard == 0){
  query_logsql("INSERT INTO `sader_variables_log` (`unique_id`,`ip`,`variable`,`index`,`value`, `account_id`, `char_id`, `char_name`) VALUES ('"+.@s_last_unique_id$+"', '"+getcharip()+"', '#Hourly_Rewads_Check', '0', '"+#Hourly_Rewads_Check+"', '"+getcharid(3)+"', '"+getcharid(0)+"', '"+strcharinfo(0)+"')");
  }
  query_logsql("Update `sader_variables_log` SET `value` = '"+#Hourly_Rewads_Check+"' WHERE `unique_id`= '"+.@s_last_unique_id$+"' AND `variable` = '#Hourly_Rewads_Check'");
  }else if(.s_GePard_ip == 2){
  query_logsql("SELECT value FROM `sader_variables_log` WHERE ip = '"+getcharip()+"' AND `variable` = '#Hourly_Rewads_Check'", .@s_ip);
  if(.@s_ip >= #Hourly_Rewads_Check){
  message strcharinfo(0),"[Hourly Rewards]: You already got the Hourly Rewards from this IP";
  #Hourly_Rewads_Check -= 1;
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  end;
  }
  if(.@s_ip == 0){
  query_logsql("INSERT INTO `sader_variables_log` (`unique_id`,`ip`,`variable`,`index`,`value`, `account_id`, `char_id`, `char_name`) VALUES ('"+.@s_last_unique_id$+"', '"+getcharip()+"', '#Hourly_Rewads_Check', '0', '"+#Hourly_Rewads_Check+"', '"+getcharid(3)+"', '"+getcharid(0)+"', '"+strcharinfo(0)+"')");
  }
  query_logsql("Update `sader_variables_log` SET `value` = '"+#Hourly_Rewads_Check+"' WHERE `ip`= '"+getcharip()+"' AND `variable` = '#Hourly_Rewads_Check'");
  }
  message strcharinfo(0),"[Hourly Rewards]: you Gain your Reward.";
  callsub Hourly_Rewads;
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  end;
   
  OnHourlyBan:
  if(!#Hourly_Ban){
  message strcharinfo(0),"[Hourly Rewards]: You did ban this char from the Hourly Rewards , Relogin to change that .";
  if(.s_GePard_ip){
  query_logsql("delete from `sader_variables_log` where `variable` = '#Hourly_Rewads_Check' AND `account_id`= '"+getcharid(3)+"'");
  }
  #Hourly_Rewads_Check = 0;
  #Hourly_Ban = 1;
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  }
  end;
   
  OnUnHourlyBan:
  #Hourly_Ban = 0;
  end;
  OnPCLogoutEvent:
  if(.s_GePard_ip){
  query_logsql("delete from `sader_variables_log` where `variable` = '#Hourly_Rewads_Check' AND `account_id`= '"+getcharid(3)+"'");
  }
  if(#Hourly_Ban == 1){
  #Hourly_Ban = 0;
  }
  #Hourly_Rewads_Check = 0;
  end;
   
  OnPCLoginEvent:
  addtimer .s_time, strnpcinfo(3)+"::OnHourlyRewards";
  end;
   
  OnMyHourlyPoints:
  message strcharinfo(0),"[Hourly Rewards]: You have " + #HourlyRewards + " Hourly Points .";
  end;
   
  OnInit:
  .s_idle = 0; // ban hourly rewards from idle players ? 0 no / 1 yes {if player didn't move for x time he wont get hourly reward} , DEFAULT = 0
  .s_idle_time = 1800; // this the time for idle in secend , DEFAULT = 1800 (30 min)
  .s_vip = 0; // 1 = only for VIP / 0 = for everyone , DEFAULT = 0
  .s_time = 3600000; // 1000 = 1 secend | 60000 = 1 min | 3600000 = 1 houre , DEFAULT = 3600000 (1 hr)
  .s_hourly_level = 0; // Minimam level to get the Houerly rewards / 0 = no minimem level , DEFAULT 0
  .s_GePard_ip = 0; // 0 = no Gepard / 1 = Gepard / 2 = IP , DEFAULT 0
  .s_vinding = 7; // DEFAULT 7 / 0 = will give the reward even if vending / 1 = no normal vending / 2 = no @autotrade / 4 = no buyingstore | Example: if you want to ban normal vend and buying store you add the numbers 1+4=5
  query_logsql("CREATE TABLE IF NOT EXISTS `sader_variables_log` (`unique_id` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0',`ip` VARCHAR(100) NOT NULL,`variable` VARCHAR(32) NOT NULL, `index` INT NOT NULL, `value` INT NOT NULL,`account_id` INT NOT NULL,`char_id` INT NOT NULL,`char_name` VARCHAR(30) NOT NULL) ENGINE=MyISAM");
  bindatcmd("UnHourlyBan",strnpcinfo(3)+"::OnUnHourlyBan",99,99);
  bindatcmd("HourlyBan",strnpcinfo(3)+"::OnHourlyBan",0,99);
  bindatcmd("MyHourlyPoints",strnpcinfo(3)+"::OnMyHourlyPoints",0,99);
  bindatcmd("MHP",strnpcinfo(3)+"::OnMyHourlyPoints",0,99);
  end;
   
  Hourly_Rewads:
  //put the Hourly Rewards here
  #HourlyRewards += 1;
  //getitem 905,1; // if you want to add items as reward you can add them here like that
  //getexp 10000,5000; // if you wanna add exp as reward add them here like that
  //if(#Hourly_Rewads_Check == 5){getitem 905,1;} // like this you can add reward for Xhr and this reward will be given for that X in this example 5 mean that the player did pass 5hr
  //if(#Hourly_Rewads_Check >= 5){getitem 905,1;} // like this you can add reward for Xhr and this reward will be given for that X in this example 5 mean that the player did pass 5hr or more
  return;
  }
  prontera,151,171,5 pointshop Hourly Rewards Shop 667,#HourlyRewards,901:1,902:10,903:15,904:1,905:200
  //<ITEM_ID>:<PRICE>,<ITEM_ID>:<PRICE>,<ITEM_ID>:<PRICE>,<ITEM_ID>:<PRICE>

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

I don't have my scripting command reference on me via mobile... But... OnPCLogoutEvent:

Get value of timer... And play it in a perm char var... Then OnPCLoginEvent: first check for the existence of the perm char var... And if it exists... Addtimer... For .s_time - permcl char var... Else not exist... .s_time

 

Also you will need to make sure to clear that perm char var on hourly pickup, or whenever else in the script the timer is reset or added... But it should work just fine

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...