Kusoo 3 Posted June 19, 2016 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 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: Quote Share this post Link to post Share on other sites
0 Felipe 4 Posted June 29, 2016 Did you try the C like syntax in the for ? for (set @i,0; @i < 3; set @i,@i+1) C like : for (set @i=0; @i < 3; set @i=@i+1) Looking the console, your first query is not getting the players, may be is not the query but the syntaxe to put the result in variable. For testing your query execute it into MySQL trough phpmyadmin Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted July 3, 2016 Your problem is in the for(loop). You're using @i without a player attached, you should be using .@i for (set @i,0; @i < 3; set @i,@i+1) into for (set .@i,0; .@i < 3; set .@i,.@i+1) After that, make sure you change all instances of " @i " into " .@i ". Or else the game will continue to spit out that error so long as a player is not attached. Quote Share this post Link to post Share on other sites
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
This is my console:
Share this post
Link to post
Share on other sites