Ragnarok Crew Discussion
Ragnarok Crew Discussion
Ragnarok Crew Discussion
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Ragnarok Crew Discussion

Discuss topics about ways in making/running Ragnarok server and get the required database server/client and also custom made ( Item/Map/Web Template/Monster/and more else).
 
HomeHome  Latest imagesLatest images  RegisterRegister  Log inLog in  

 

 Daily Login Reward

Go down 
AuthorMessage
AirVine-X
Poring
Poring
AirVine-X


Posts : 62
Join date : 25/02/2013

Daily Login Reward Empty
PostSubject: Daily Login Reward   Daily Login Reward I_icon_minitimeThu Jun 20, 2013 4:10 pm

ciri-ciri:
penuh Customizable
Bolehkah Tetapkan Bilangan Waktu Antara Hadiah Masuk dan Kehilangan Hadiah berturut-turut, Membuat Jam, Hari, Minggu atau Bulan
Boleh Set Ganjaran Zeny dan Multiplier
Hadiah berturut-turut sehingga 64 Ganjaran
Termasuk Kaunter Masuk, untuk Akaun Watak dan / atau Server, Melumpuhkan secara lalai

To do:
Cadangan?
Mengoptimumkan?



Code:


/===== RO-crew Scripts ==================================
//= Daily Prize, OnPCLoginEvent
//===== By: ==================================================
//= Stolao
//===== Current Version: =====================================
//= 1.2F
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= Events that happen when a player logs in
//===== Comments: ============================================
//= N/A
//===== Additional Comments: =================================
//= 1.00 Daily Prize
//= 1.01 Fixed Typo
//= 1.02 Removed unessisary calculation
//= 1.03 Added a sleep2 for delayed reward
//= 1.04 Added dispbottom
//= 1.05 Made Clearer
//= 1.06 Made Disbutton Dynamic
//= 1.07 Added .RewardQnt for configable Reward Quantity
//= 1.08 Fixed Typo
//= 1.09 Seperated .ZMulti into .Mode and .ZMulti
//= 1.0A Changed zeny formula for .Mode 0
//= 1.0B Changed Variable Names, More detailed exsplanations
//= 1.0C Fixed typo again lol
//= 1.0D Added in .PointType$, can now configure zeny into any point types
//= 1.0E Added LoginCount
//= 1.0F Made LoginCount Customisable
//= 1.10 Changed Variable Names, More detailed exsplanations
//= 1.11 Added Wipe feature
//= 1.12 Fixed bug, changed "close;" to "close2;"
//= 1.13 Changed .LogCount to bitwise
//= 1.14 Changed .wipe to a whisper event, per Euphys Suggestion
//= 1.15 Changed Formatting of config, per Euphys Suggestion
//= 1.16 Added Login Reward Countdown, on each login
//= 1.17 Added .PointName$
//= 1.18 Fixed Typo
//= 1.19 Added Checkweight
//= 1.1A Changed query_sql for $LOGINCOUNT to set
//= 1.1B Fixed bug with #DRewardCon, arraysize compersison (Thanks AnnieRuru)
//= 1.1C Added meathod for characters online for attachrid
//= 1.1D Actually Fixed the 1.1B Bug
//= 1.1F Changed zeny formula to remove .ZMulti from mode 0
//= 1.20 Changed .Reminder to .Welcome
//= 1.21 Fixed missing details in Welcome Message
//= 1.22 Changed .Mode to be bitwise
//= 1.23 Added Item enable disable to .Mode
//= 1.24 Changed whisper to allow for player Whispers
//= 1.25 Added "time" Whisper Command for players, Thanks arzzae for suggestion
//= 1.26 Made Whisper commands configable
//= 1.27 Made GmLvl for wipe Configable
//= 1.28 Fixed "Points" bitwise
//= 1.29 Added Exp to .Mode
//= 1.2A Optimized Rewards Script a little
//= 1.2B Bug Fix with Display message on reciving rewards
//= 1.2C Optimize a little more
//= 1.2D Added server xp rate to config
//= 1.2F Re-added checkweight
//===== Contact Ifo: =========================================
//= [Stolao]
//= Email: ro-crew.rpgboard.com
//============================================================
-   script   LOGIN   -1,{
OnWhisperGlobal:
   if (@whispervar0$ == .Wipe$){
      if (getgmlevel() < .GmLvl) end;
      query_sql("DELETE FROM `global_reg_value` WHERE `str` = 'LOGINCOUNT'");
      query_sql("DELETE FROM `global_reg_value` WHERE `str` = '#LOGINCOUNT'");
      set $LOGINCOUNT,0;
      set .@self, getcharid(3);
      set .@size, query_sql("select account_id from `char` where online = 1", .@aid);
      for(set .@i,0; .@i<.@size; set .@i,.@i+1) {
         if(attachrid(.@aid[.@i])){
            set LOGINCOUNT,0;
            set #LOGINCOUNT,0;
         }   
      }
   attachrid(.@self);
   dispbottom "Cleared all login count data.";
   }
   if (@whispervar0$ != .time$) end;
OnLoginCmnd:
   set .@i,((gettime(7))*365*24)+(gettime(8)*24)+gettime(3);
   if(.@i >= (#LastDailyReward + .MinWait)){ dispbottom "Your login reward is available, please relog to calim your prize~";
   } else { dispbottom "You have "+(#LastDailyReward + .MinWait-.@i)+" hours till your next reward"; }
   end;
OnPCLoginEvent:
   if(.LogCount){
      if(.LogCount & 1) set LOGINCOUNT,LOGINCOUNT+1;
      if(.LogCount & 2) set #LOGINCOUNT,#LOGINCOUNT+1;
      if(.LogCount & 4) set $LOGINCOUNT,$LOGINCOUNT+1;
      if( ( LOGINCOUNT + #LOGINCOUNT + $LOGINCOUNT )%.Welcome[1] == 0 || (LOGINCOUNT + #LOGINCOUNT) < .Welcome[0] ){
         Mes "~Welcome to "+.Servername$+"~";
         Mes .Message$;
         close2;
      }
   }
   if(.DailyPrize){
      if( #DRewardCon == 0 ) set #DRewardCon,1;
      set .@i,((gettime(7))*365*24)+(gettime(8)*24)+gettime(3);
      set .@g,getarraysize(.Rewards);
      sleep2 .Rest*60000;
      if(.@i >= (#LastDailyReward + .MinWait)){
         if(.@i < #LastDailyReward + .MaxWait){ set #DRewardCon,#DRewardCon+1;
          } else { set #DRewardCon,1; }
         if(#DRewardCon*2 > .@g-1){ set .@p,.Rewards[.@g-2]; set .@q,.Rewards[.@g-1];
         } else { set .@p,.Rewards[#DRewardCon*2-2];  set .@q,.Rewards[#DRewardCon*2-1]; }
         dispbottom "You have collected your daily reward, for "+#DRewardCon+" day(s) in a row, of ";
         if(.Mode&1&&.@p){ if(!checkweight(.@p,.@q)){ dispbottom "You see to be oveweight, put some stuff away and relog to claim prize"; end; }
         getitem .@p,.@q; dispbottom ""+.@q+" "+getitemname(.@p)+""; }
         if(.Mode&2) set .@A,#DRewardCon*.ZMulti;
         if(.Mode&8) set .@A,.@A+.@q;
         if(.Mode&2||.Mode&8){  setd .PointType$,getd(.PointType$)+.@A; dispbottom ""+.@A+" "+.PointType$+""; }
         if(.Mode&4){ set .@B,#DRewardCon*.XPMulti[0]; set .@C,#DRewardCon*.XPMulti[1]; }
         if(.Mode&16){ set .@B,.@B+.@q; set .@C,.@C+.@q; }
         if(.Mode&4||.Mode&16){ getexp .@B,.@C; dispbottom ""+(.@B*.Sxp/100)+"/"+(.@c*.Sxp/100)+" XP"; }
         set #LastDailyReward,.@i;
      } else { dispbottom "You have "+(#LastDailyReward + .MinWait-.@i)+" hours till your next reward"; }
   }
end;
OnInit:
// -----------------------------------------------------------
//  Login Count & Welcome Message
// -----------------------------------------------------------

   // Login types to track.
   //  1: Character | 2: Account | 4: Server
   // (a bit value, e.g. 5 = character + server)
   set .LogCount,0;

   // Number of logins to display welcome message.
   //  [0]: First x Logins, 0 will never give a message
   //  [1]: Remider message every x Logins (combined server account and character)
   setarray .Welcome,3,250;

   // Server name to display.
   set .Servername$,"Server";

   // Login message
   // * Must have at least 1 Login Count Enabled
   set .Message$,"Before playing, make sure you've read the rules, located in our forum at ^0000FF~TBA~^000000";

// -----------------------------------------------------------
//  Daily Reward
// -----------------------------------------------------------

   //To Enable @ Command '@LoginReward' unslash next lines
   // * Needs extra commands for typos
//   bindatcmd("LoginReward"   ,"LOGIN::OnLoginCmnd",0,99);
//   bindatcmd("loginReward"   ,"LOGIN::OnLoginCmnd",0,99);
//   bindatcmd("Loginreward"   ,"LOGIN::OnLoginCmnd",0,99);
//   bindatcmd("loginreward"   ,"LOGIN::OnLoginCmnd",0,99);

   //Data Wipe Whisper Command
   set .Wipe$,"wipe";

   //GM Level to use Wipe Whisper Command
   //  Kepp at 99 for security
   set .GmLvl,99;

   //Player Whisper Command to look up time till next reward
   set .time$,"Time";

   //Daily Prize
   //Toggle
   //  0: Off  | 1: On
   set .DailyPrize,1;

   //Minimum Hours Between Collecting Daily Reward
   //  Day: 22-24
   //  Week: 168
   set .MinWait,0;

   //Hours Before Lose Consecutive Daily Rewar
   //  Day: 48-50
   //  Week: 336
   set .MaxWait,9999;

   //Number of mins after logging before collecting prize
   set .Rest,0;

   //Type of Points/Zeny earned
   //  eg: CASHPOINTS, Zeny, LoginPoints
   set .PointType$,"Zeny";

   //Toggle
   //  1: Item | 2: "Points" from Multi | 4: Exp from Multi
   //  8: "Points" from Days with ItemID of 0 |16: Exp from Days with ItemID of 0
   // (a bit value, e.g. 3 = Items & Points from Multi)
   set .Mode,31;

   //Consecutive Day Points Multiplier
   // * If players login longer than the last set
   //  day, they will keep getting a larger Multiplier
   set .ZMulti,100;

   //Consecutive Day Exp Multiplier
   //  [0]: Base
   //  [1]: Job
   // * If players login longer than the last set
   //  day, they will keep getting a larger Multiplier.
   setarray .XPMulti,50,50;

   //Servers Xp Rate
   //  100 = 1x rate
   // * Doesn't efffect exp gained just the display of the rewards
   setarray .Sxp,100,100;

   // Daily Prize items (max 64 days):
   //  <itemID>,<amount>, // Day 1
   //  <itemID>,<amount>, // Day 2
   //  ...;
   // * If players login longer than the last set
   //  day, they will keep getting the last prize.
   setarray .Rewards[0],
      512,1,      // Day 1
      513,2,      // Day 2
      514,3,      // Day 3
      0,1000;      // Day 4
end;
}


aa
Back to top Go down
https://ro-crew.forumms.net
 
Daily Login Reward
Back to top 
Page 1 of 1
 Similar topics
-
» Daily Login Reward
»  AntiBot Login Script

Permissions in this forum:You cannot reply to topics in this forum
Ragnarok Crew Discussion :: General Support and Release :: Scripting :: Script Releases-
Jump to: