Jump to content
  • 0
Sign in to follow this  
playgron

Change weekly to monthly

Question

Hello guys so im using mvp script with rank every week player will get rewards (automated) , can any of you modify the script to change the reward into monthly ? thanks.

 

OnInit:
	// set reward here ... 1st place won 10 red pot, 2nd place won 9 orange pot ... etc ...
	setarray .reward, 501, 502, 503;
	setarray .amount, 10, 9, 8;
	
	if ( !$mvp_rank_1st_sunday )
		query_sql "select curdate() - dayofweek( curdate() ) +1", $mvp_rank_1st_sunday; // TRICK !! how to save the 1st sunday once the script installed

OnSun0000:
	query_sql "select datediff( curdate(), '"+ $mvp_rank_1st_sunday +"' ) /7", .this_week_index;
	if ( .this_week_index == $mvp_rank_week_index ) end;
	[email protected]$  = "SELECT char_id, `name`, IF(@d=t.`mvp_kills`, @r, @r:[email protected]), @d:=t.`mvp_kills`, @i:[email protected]+1 ";
	[email protected]$ += "FROM `mvp_rank` t, (SELECT @d:=0, @r:=0, @i:=1)q ";
	[email protected]$ += "ORDER BY `mvp_kills` DESC LIMIT 10";
	[email protected] = query_sql([email protected]$, [email protected], [email protected]$, [email protected], [email protected], [email protected]);
	if ( [email protected] ) {
		for ( [email protected] = 0; [email protected] < [email protected]; [email protected] ) {
			[email protected]_query$[[email protected]] = "( "+ [email protected][[email protected]] +", "+ $mvp_rank_week_index +", "+ [email protected][[email protected]] +" )";
			[email protected]_query$[[email protected]] = "( "+ $mvp_rank_week_index +", "+ [email protected][[email protected]] +", "+ [email protected][[email protected]] +", '"+ escape_sql([email protected]$[[email protected]]) +"', "+ [email protected][[email protected]] +" )";
		}
	//	query_sql "truncate table mvp_rank_archive"; // uncomment this line if you love to periodically clean your data
		query_sql "insert into mvp_rank_reward values "+ implode( [email protected]_query$, ", " );
		query_sql "insert into mvp_rank_archive values "+ implode( [email protected]_query$, ", " );
		query_sql "truncate table mvp_rank";
	}
	$mvp_rank_week_index = .this_week_index;
	end;

 

Edited by playgron

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 1
OnSun0000:

to

OnClock0000:
if(gettime(DT_DAYOFMONTH)!=1) end;


If it helps you, please mark it as Answer

Edited by Haruka Mayumi
  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0

Increase a global var once per week.

if global var % 4 is equal to 0 give out the reward. 

But there are probably better/cleaner ways too achieve what you need. 

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.