Jump to content
  • 0

Adding a prize to top rank


Question

Posted

Hello I'm new here I would just like to ask how I can send a prize via ro dex for the top ranker in this script, this script ranks top 10 mvp players and I would like to give the top ranker a prize.

	    set MVPTotal, MVPTotal + 1;
    query_sql "SELECT char_id FROM ladder_mvp WHERE char_id = "+ getcharid(0) +"", .@cidA;
    if(!.@cidA)
        query_sql "INSERT INTO `ladder_mvp` (`char_id`, `char_name`, `kills`) VALUES ('"+ getcharid(0) +"', '"+ strcharinfo(0) +"', '1')";
    else
        query_sql "UPDATE ladder_mvp SET kills = kills + 1 WHERE char_id = "+ getcharid(0) +"";
    end;
OnDay0101:
OnDay0201:
OnDay0301:
OnDay0401:
OnDay0501:
OnDay0601:
OnDay0701:
OnDay0801:
OnDay0901:
OnDay1001:
OnDay1101:
OnDay1201:
    if(.autoReset){
        query_sql "SELECT * FROM ladder_mvp ORDER BY kills DESC LIMIT 10", .@creset, .@nreset$, .@kreset;
        query_sql("TRUNCATE TABLE ladder_mvp2");
        for(set .@i, 0; .@i < getarraysize(.@creset); set .@i, .@i + 1)
            query_sql "INSERT INTO `ladder_mvp2` VALUES ('"+ .@creset[.@i] +"', '"+ .@nreset$[.@i] +"', '"+ .@kreset[.@i] +"', '0')";
        query_sql("TRUNCATE TABLE ladder_mvp");
        if(.announceReset)
            announce "The MvP Ladder has resetted!",bc_yellow|bc_all;
    }
    end;
OnInit:
OnInit:

2 answers to this question

Recommended Posts

  • 0
Posted

Hi. You can put this before the autoreset so it goes automatically. I did not test.

query_sql "SELECT * FROM ladder_mvp ORDER BY kills DESC LIMIT 1", .@charid, .@name$, .@kill;

.@sender$ = "GM Team";
.@title$ = "Top MvP Prize";
.@body$ = "Congratulations " + .@name$ + "! You are the top ranker with " + .@kill + " kills!";
.@zeny = 0;
setarray .@mailitem[0], 504, 505; // White Potion, Blue Potion
setarray .@mailamount[0], 10, 5; // 10 White Potions, 5 Blue Potions
	
mail .@charid, .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount;

 

You can learn more about how to customize the rodex contents reading the file doc/script_commands.txt.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...