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;
.@query$ = "SELECT char_id, `name`, IF(@d=t.`mvp_kills`, @r, @r:=@i), @d:=t.`mvp_kills`, @i:=@i+1 ";
.@query$ += "FROM `mvp_rank` t, (SELECT @d:=0, @r:=0, @i:=1)q ";
.@query$ += "ORDER BY `mvp_kills` DESC LIMIT 10";
.@nb = query_sql(.@query$, .@cid, .@name$, .@rank, .@kills, .@dummy);
if ( .@nb ) {
for ( .@i = 0; .@i < .@nb; ++.@i ) {
.@reward_query$[.@i] = "( "+ .@cid[.@i] +", "+ $mvp_rank_week_index +", "+ .@rank[.@i] +" )";
.@archive_query$[.@i] = "( "+ $mvp_rank_week_index +", "+ .@rank[.@i] +", "+ .@cid[.@i] +", '"+ escape_sql(.@name$[.@i]) +"', "+ .@kills[.@i] +" )";
}
// 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( .@reward_query$, ", " );
query_sql "insert into mvp_rank_archive values "+ implode( .@archive_query$, ", " );
query_sql "truncate table mvp_rank";
}
$mvp_rank_week_index = .this_week_index;
end;