Jump to content
  • 0

Daily Reward


jaynard09

Question


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  80
  • Reputation:   0
  • Joined:  07/03/12
  • Last Seen:  

//===== EinherjarRO Scripts ================================== 
//= Daily Prize, OnPCLoginEvent
//===== By: ================================================== 
//= Stolao
//===== Current Version: ===================================== 
//= 1.7B
//===== Compatible With: ===================================== 
//= rAthena SVN
//===== Description: ========================================= 
//= A reward system for players who play more frequently
//===== Todo: ================================================
//= Maybe make .MinWait an array mins,days,weeks,months,years;
//= Show time till login rewards, if .Rest is defined
//= Make Logging out then it continue count
//===== Additional Comments: =================================
//= For Older See Old Versions
//= 1.70 Removed all "set"
//= 1.71 Added CheckWeight
//= 1.72 Fixed Tabulation
//= 1.73 Added .Rest Option
//= 1.74 Added Cutin Support
//= 1.75 Fixed Typos (Thanks Everade)
//= 1.76 Fixed Bug with skipping 1st day on first time through
//= 1.77 Wrong Day in Mes
//= 1.78 Fixed Cutins Being a Day Off
//= 1.79 No Rewards for Autotraders option added
//= 1.7A No Rewards for Autotraders option added
//= 1.7B Tabulation Cleanup
//===== Contact Info: ========================================
//= [Stolao] 
//= Email: [email protected]
//============================================================
-	script	LOGIN	-1,{
OnWhisperGlobal:
OnLoginCmnd:
OnPCLoginEvent:
	if(.Rest) message strcharinfo(0),"[Daily Rewards]: to collect reward you must remain logged in for "+  .Rest +" minutes";
	.@i = (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) +gettime(2);
	if(.@i >= (#LastDailyReward + .MinWait)){
		sleep2 1000 + .Rest * 60000;
		if(checkvending() & 2 && .Mode & 64){
			message strcharinfo(0),"[Daily Rewards]: Venders cannot recive rewards.";
			end;
		}
		if(.@i < #LastDailyReward + .MaxWait)
			#DRewardCon += 1;
		else	#DRewardCon = 1;
		if(#DRewardCon >= getarraysize(.Rewards$)){
			if(.Reset)
				#DRewardCon = 1;
			else	.@g = getarraysize(.Rewards$)-1;
		} else	.@g = #DRewardCon;
		explode(.@XT$,.Rewards$[.@g],",");
		for(.@x = 0; .@x < getarraysize(.@XT$); .@x++)
			.@TT[.@x] = atoi(.@XT$[.@x]);
		if(.Mode & 1 && .@TT[4] > 0){
			for(.@x = 4; .@x <= getarraysize(.@TT) - 1 ; .@x += 2){
				.@itms[getarraysize(.@itms)] = .@TT[.@x];
				.@qnts[getarraysize(.@qnts)] = .@TT[.@x + 1];
			}
			if(checkweight2(.@itms,.@qnts)){
				for(.@x = 0; .@x < getarraysize(.@itms) && .@x < getarraysize(.@qnts); .@x++){
					if(.Mode & 32)
						getitembound  .@itms[.@x], .@qnts[.@x], Bound_Account;
					else	getitem  .@itms[.@x], .@qnts[.@x];
				}
			} else {
				message strcharinfo(0),"[Daily Rewards]: You cannot carry the prizes, please use storage and relog.";
				if(#DRewardCon) #DRewardCon -= 1;
				end;
			}
		}
		if(.Mode & 16){
			cutin .Cutins$[#DRewardCon],4;
		}
		if(.Mode & 2){
			if(.@TT[0]){
				zeny += .@TT[0];
				message strcharinfo(0),"[Daily Rewards]: Recieved "+ .@TT[0] +"z";
			}
			if(.@TT[1]){
				setd getd(.Points$[0]),getd(.Points$[0]) + .@TT[1];
				message strcharinfo(0),"[Daily Rewards]: Recieved "+ .@TT[1] +" "+.Points$[1];
			}
		}
		if(.Mode & 4 && (.@TT[3] || .@TT[4]))
			getexp .@TT[3], .@TT[4];
		if(.Mode & 8){
			for(.@x = 0; .@x < getarraysize(.BuffInfo); .@x += 4){
				if(#DRewardCon % .BuffInfo[.@x + 1] == 0)
					sc_start .BuffInfo[.@x], .BuffInfo[.@x + 2] * 60000, .BuffInfo[.@x + 3];
			}
		}
		message strcharinfo(0),"[Daily Rewards]: You have collected your daily reward, for "+callfunc("F_InsertPlural",#DRewardCon,"day")+" in a row.";
		#LastDailyReward = .@i;
		@Login_Time = 0;
	} else {
		.@days = (#LastDailyReward + .MinWait - .@i)/60/24;
		.@hours = ((#LastDailyReward + .MinWait - .@i)/60)%24;
		.@mins = (#LastDailyReward + .MinWait - .@i)%60;
		message strcharinfo(0),"[Daily Rewards]: You have "+ ((.@days) ? .@days +" Days " : "") +""+ ((.@hours) ? .@hours +" Hours " : "") +""+ ((.@mins) ? .@mins +" Minutes " : "") +"till your next reward.";
	}
end;
OnInit:
	// Basic Settings
	//   1: Item | 2: Points | 4: Exp  
	//   8: Gain Buffs Every X Consecutive Days logged in
	//   16: Show Cutins | 32: Account Bound Items
	//   64: No Rewards ffor Autotraders
	//     (a bit value, e.g. 3 = Items & Points from Multi)
	.Mode = 1|2|4|8|16|64;

	// To disable the command '@loginreward' comment the next lines
	// * Needs extra commands for typos
	bindatcmd("relog"	,"LOGIN::OnLoginCmnd",0,99);

	// Minimum minutes between collecting daily reward
	//   Day: 22*60 - 24*60
	//   Week: 10080
	.MinWait = 1320;

	// Minutes before losing the consecutive reward
	//   Day: 48*60 - 50*60
	//   Week: 20160
	.MaxWait = 3000;

	// Reset
	//   [0] Repeat last day
	//   [1] reset when reach end of days
	.Reset = 1;

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

	// Point Type
	//   [0] Points earned
	//   [1] Point name in mes
	setarray .Points$,"#KAFRAPOINTS","K-Points";

	// Consecutive Days Buff
	// Each buff contains 4 variables (32 Total Max)
	// <Type>,<Days>,<Duration>,<Rate>, // Buff 1
	// <Type>,<Days>,<Duration>,<Rate>, // Buff 2
	//   ...;
	//
	//  Example: 188,7,45,3
	//    -Every 7th consecutive day logged in Player gains +3 Str for 45 mins
	//
	//  Type is 188, which references which SC_ to use, SC_INCSTR in this example
	//     -For a full list of SC_ visit the db/const.txt
	//  Days is days buff is applied, in this example 7, so every 7th day, 14,21,28....
	//  Duration is buff duration is Minuits, in this example 45 mins
	//  Rate is buff strength, in this example player gains 3 Str
	setarray .BuffInfo
				,260,2,360,1	// Life Insurance for 360 Mins Every 2nd Day
				,198,3,120,10	// +10% Hp for 120 Mins Every 3th Day
				,196,5,120,25	// +25 Flee for 120 Mins Every 5th Day
				,257,7,240,50;	// +50% Exp for 240 Mins Every 7th Day

	// Daily Prize items (max 128 days):
	//   "<Zeny>|<Points>|<BaseExp>|<JobExp>|<itemID-1>|<amount-1>|<itemID-2>|<amount-2>...etc", // Day 1
	//   "<Zeny>|<Points>|<BaseExp>|<JobExp>|<itemID-1>|<amount-1>|<itemID-2>|<amount-2>...etc"  // Day 2
	//   ...;
	// Total length of any days string must be 255 or shorter
	// * If players login longer than the last set
	//   day, they will keep getting the last prize.
	setarray .Rewards$[1],
		"50000,5,0,0,12210,1,12263,1",	// Day 1: 50K+1 buble gum+ 1 manual field + 5 Cash points			// Day 1: 5 White Potion + 5 Green Potion
		"100000,10,0,0,12210,1,12263,1",	// Day 2: 100K+1 buble gum+ 1 manual field +10 Cash Points
		"200000,15,0,0,12210,1,12263,1",	// Day 3: 200K+1 buble gum+ 1 manual field +15 Cash points
		"250000,20,0,0,12210,1,12263,1",	// Day 4: 250K+1 buble gum+ 1 manual field +20 Cash points
		"300000,25,0,0,12210,1,12263,1",	// Day 5: 300K+1 buble gum+ 1 manual field +25 Cash points
		"350000,30,0,0,12210,1,12263,1",	// Day 6: 350K+1 buble gum+ 1 manual field +30 Cash points
		"400000,35,0,0,12210,1,12263,1",	// Day 7: 400K+1 buble gum+ 1 manual field +35 Cash points
		"450000,40,0,0,12210,1,12263,1",	// Day 8: 450K+1 buble gum+ 1 manual field +40 Cash points
		"500000,50,0,0,12210,2,12257,100",	// Day 9: 500K+1 buble gum+ 1 manual field +50 Cash points

	// Cutin Array
	//	Shows a cuting for each date
	//	
	setarray .Cutins$[1],
			"kafra_01",
			"kafra_02",
			"kafra_03",
			"kafra_04",
			"kafra_05",
			"kafra_06",
			"kafra_07",
			"kafra_08",
			"kafra_09";
end;
}

What's wrong? i got an error this

 

[Error]:  Loading NPC file: npc/gmh_freenpc/DailyReward.txtxtt.txttxttxt
script error on npc/gmh_freenpc/DailyReward.txt line 181
    need '('
   176 :                "500000,50,0,0,12210,2,12257,100",      // Day 9: 500K+1 buble gum+ 1 manual field +50 Cash points
   177 :
   178 :        // Cutin Array
   179 :        //      Shows a cuting for each date
   180 :        //
*  181 :        setarray '.'Cutins$[1],
   182 :                        "kafra_01",
   183 :                        "kafra_02",
   184 :                        "kafra_03",
   185 :                        "kafra_04",
   186 :                        "kafra_05",
[Info]: Done loading '13299' NPCs:h_freenpc/BetaBuffer.txtbe.txtt_2.0.txt
        -'3081' Warps
        -'247' Shops
        -'9971' Scripts
        -'4025' Spawn sets
        -'40679' Mobs Cached
        -'0' Mobs Not Cached
[Error]: script_rid2sd: fatal error ! player not attached!
[Debug]: Function: percentheal (2 parameters):
[Debug]: Data: number value=100
[Debug]: Data: number value=100
[Debug]: Source (NPC): Beta Caster at prontera (151,183)
[Status]: Event 'OnInit' executed with '1525' NPCs.
[Status]: Server is 'ready' and listening on port '5127'.

[Status]: Attempting to connect to Char Server. Please wait.

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

Line 176, at the end, change the , to a ;

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  80
  • Reputation:   0
  • Joined:  07/03/12
  • Last Seen:  

Big Thanks! /yawn i have to sleep now that give me a sign..  /pif

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...