Hi, all i have script event emper breaker, so for 3 minutes player can break the emper repeatly
each break emper get 1 points.
my problem its how to save the higher result on my table rank
this is my script
OnStartEmp:
monster "quiz_01",50,49, "--ja--", 3002, 1,"Emperium War::OnEmpBreak";
end;
OnEmpBreak:
set .@notice$,"Character "+strcharinfo(0)+" ("+getcharid(0)+") broke the Emperium";
set #count, #count+1;
query_sql("INSERT INTO `breaker_ladder` SET `char_id` = '"+getcharid(0)+"', `count` = '1' ON DUPLICATE KEY UPDATE `count` = `count`+1");
announce strcharinfo(0)+" has break the Emperium!.", bc_ALL;
sleep 2000;
announce "Emperium will respawn in 3 seconds.", bc_ALL;
sleep 1000;
mapwarp "quiz_01","quiz_02",252, 377,0;
sleep 2000;
goto OnStartEmp;
end;
and this is the npc ranking
quiz_02,261,390,3 script Emp War Ranking 4_BOARD3,{
query_sql("SELECT `count` FROM `breaker_ladder` WHERE `char_id` = "+ getcharid(0), .@count);
mes "What would you like to do?";
next;
switch(select("~ View Top 10 Emp Breakers Weekly",(getgmlevel()> 60) ? "~ [GM MENU] Reset data":"")) {
case 1:
mes "Top 10 Emperium Breaker Weekly";
if(!(.@nb = query_sql("SELECT `char_id`, `count` FROM `breaker_ladder` ORDER BY `count` DESC LIMIT 10", .@cid, .@count))) {
mes "No data found.";
close;
}
for ( .@i = 0; .@i < .@nb; .@i++ ) {
query_sql("SELECT `name` FROM `char` WHERE `char_id` = '"+.@cid[.@i]+"'",.@name$);
mes (.@i+1) +". "+ .@name$ +" ~ "+ .@count[.@i] +" breaks.";
}
close;
case 2:
mes "Are you sure you want to delete all Emp Breaker Ladder data?";
next;
select("Yes");
message strcharinfo(0), "Deleting...";
progressbar "", 5;
query_sql("TRUNCATE TABLE `breaker_ladder`");
mes "Deleting complete..";
close;
}
end;
So my goal its to save higher score player get since player can try this event anytime.
Ex:
First time Try for 3 minutes player get result 11 points break
second time player will get 10 points
so if Last Score < Higher Score
didnt update to the table rank