Jump to content
  • 0

Adding a prize to top rank


noobonly

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  04/15/20
  • Last Seen:  

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:

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  128
  • Reputation:   53
  • Joined:  06/02/12
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  04/15/20
  • Last Seen:  

Thanks a lot it helped! ❤️

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