Jump to content
  • 0

Several commands OnInit


Sapito Sucio

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  172
  • Reputation:   89
  • Joined:  04/10/12
  • Last Seen:  

Hello there! I'm writing this code that will give prizes to the top 3 MvP killers

Should be triggered every monday, but for testing purposes I picked OnMinute1 smile.png

OnInit:

OnMinute1:

L_give:
announce "Entregando premios .",0;
query_sql("Select ragnarok.char_reg_num_db.char_id, ragnarok.char.name, ragnarok.char_reg_num_db.value FROM ragnarok.char_reg_num_db INNER JOIN ragnarok.char ON ragnarok.char.char_id=ragnarok.char_reg_num_db.char_id WHERE ragnarok.char_reg_num_db.`key`='MvP' ORDER BY ragnarok.char_reg_num_db.value DESC LIMIT 3", .@chrid); // Selects TOP 3 MVP

query_sql "DELETE FROM char_reg_num_db WHERE char_reg_num_db.`key`='USERAURA' OR char_reg_num_db.`key`='USERAURA1'";
    .@existeonel = query_sql ("Select exists(SELECT ragnarok.char_reg_num_db.char_id FROM ragnarok.char_reg_num_db WHERE ragnarok.char_reg_num_db.char_id=150003 AND ragnarok.char_reg_num_db.`key`= 'USERAURA')"); //DELETE Previous Prize
for (set @i,0; @i < 3; set @i,@i+1)
    {
    .@existeonel = query_sql ("Select exists(SELECT ragnarok.char_reg_num_db.char_id FROM ragnarok.char_reg_num_db WHERE ragnarok.char_reg_num_db.char_id=150003 AND ragnarok.char_reg_num_db.`key`= 'USERAURA')");
    mes "Encontrado: "+.@existeonel+"";
    if (.@existeonel == 1)
        {
            if (.@chrid[@i] != 0)
            {
            query_sql("INSERT INTO `ragnarok`.`char_reg_num_db` (`char_id`, `key`, `value`) VALUES ("+.@chrid[@i]+", 'USERAURA', 586)");
            query_sql("INSERT INTO `ragnarok`.`char_reg_num_db` (`char_id`, `key`, `value`) VALUES ("+.@chrid[@i]+", 'USERAURA1', 587)");
            }
        }
}
end; 

This is my console: 

 

8yt1v3L.png

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

change 

@i     // only can be used if there are player attached to the current script.

to

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