- script CheckIn -1,{
end;
OnCheck:
getmapxy(@map$,@x,@y,0);
set .@x,0;
query_sql "SELECT `map` FROM `checkin_rank`", .@mapas$[0];
for ( set .@i, 0; .@i < getarraysize(.@mapas$); set .@i, .@i+1 ){
if ( @map$ == .@mapas$[.@i] ){ set .@x,1; }
}
deletearray .@mapas$[0], getarraysize(.@mapas$);
if ( .@x == 0 ){
dispbottom ">No puedes realizar un checkin en este lugar<";
end;
}else{
if ( !query_sql ("SELECT `userid` FROM `checkin` WHERE account_id = "+getcharid(3), .@useridcheck$) ){
query_sql "SELECT `userid` FROM login WHERE account_id = " +getcharid(3), @userid$;
query_sql "INSERT INTO `checkin` (`account_id`,`userid`) VALUES ('"+getcharid(3)+"','"+@userid$+"');";
}
// Comprobamos si ya ha realizado checkin en el mapa en las últimas 24 horas, y si el tiempo ha expirado
query_sql "SELECT `lastmap` FROM `checkin` WHERE account_id = "+getcharid(3), @lastmap$;
query_sql "SELECT (expire > curdate()) FROM `checkin` WHERE account_id = "+getcharid(3), @expire;
if ( (@lastmap$ == @map$) && (@expire == 1) ){
dispbottom "> Ya has estado aquí recientemente. Check-in no válido. <";
end;
}else{
dispbottom "> Realizaste un checkin exitosamente <";
query_sql "SELECT `"+@map$+"` FROM `checkin` WHERE account_id = "+getcharid(3),@checkin;
if ( @checkin == 0 ){
dispbottom ">>> ¡Es tu primera vez aquí! ¡Felicidades! <<<";
}else if ( @checkin == 1 ){
dispbottom "> ¡Esta ha sido tu segunda vez aquí! <";
}else{
dispbottom "> ¡Ya has estado aquí "+(@checkin+1)+" veces! <";
}
// Le asignamos tiempo de expiración para volver a realizar Checkin en el mismo mapa
query_sql "UPDATE `checkin` SET `"+@map$+"` = `"+@map$+"`+1 WHERE account_id = "+getcharid(3);
query_sql "UPDATE `checkin` SET expire = ADDDATE('"+gettimestr("%Y-%m-%d %H:%M:%S",21)+"',INTERVAL 1 DAY) WHERE account_id = "+getcharid(3);
query_sql "UPDATE `checkin` SET lastmap = '"+@map$+"' WHERE account_id = "+getcharid(3);
// Añadimos los puntos correspondientes al mapa del Checkin
query_sql "SELECT `mappoints` FROM `checkin_rank` WHERE map = '"+@map$+"'",@mappoints;
query_sql "UPDATE `checkin` SET `points` = `points`+"+@mappoints+" WHERE account_id = "+getcharid(3);
}
}
// Comprobamos y designamos Major del mapa.
query_sql "SELECT `"+@map$+"` FROM `checkin` WHERE account_id = "+getcharid(3),@mapcheckin;
query_sql "SELECT `user_checks` FROM `checkin_rank` WHERE map = '"+@map$+"'",@mapcheckinrank;
if ( @mapcheckin == @mapcheckinrank ){
query_sql "UPDATE `checkin_rank` SET `account_id_major` = NULL WHERE map = '"+@map$+"'";
query_sql "UPDATE `checkin_rank` SET `userid_major` = NULL WHERE map = '"+@map$+"'";
dispbottom ">>> ¡Estás luchando por conseguir el liderazgo de "+@map$+"! <<<";
}
else if ( (@mapcheckin > @mapcheckinrank) && (@mapcheckin > 7) ){
query_sql "SELECT `userid` FROM login WHERE account_id = " +getcharid(3), @userid$;
query_sql "SELECT `mapname` FROM checkin_rank WHERE map = '" +@map$+"'", @mapname$;
query_sql "UPDATE `checkin_rank` SET `account_id_major` = "+getcharid(3)+" WHERE map = '"+@map$+"'";
query_sql "UPDATE `checkin_rank` SET `userid_major` = '"+@userid$+"' WHERE map = '"+@map$+"'";
query_sql "UPDATE `checkin_rank` SET `user_checks` = '"+@mapcheckin+"' WHERE map = '"+@map$+"'";
dispbottom ">>> ¡Te has convertido en el líder de "+@mapname$+"! <<<";
announce "|> ["+@userid$+"] encabeza la lista de exploración de ["+@mapname$+"] <|",bc_all|bc_blue;
}
end;
}
- script CheckInRank -1,{
OnSat2000:
query_sql "SELECT `account_id_major` FROM `checkin_rank` WHERE `user_checks` > '7' AND `userid_major` != 'NULL'", .@checkin_rank[0];
query_sql "SELECT `mapname` FROM checkin_rank WHERE `user_checks` > '7' AND `userid_major` != 'NULL'", .@checkin_rank_map$[0];
for ( set .@i, 0; .@i < getarraysize(.@checkin_rank); set .@i, .@i+1 ){
announce "Prueba: "+.@checkin_rank[.@i], bc_all;
if (isloggedin(.@checkin_rank[.@i])) {
getitem 8001, 1, .@checkin_rank[.@i];
message rid2name(.@checkin_rank[.@i]),"Has recibido un premio por encabezar la lista de exploración de ["+.@checkin_rank_map$[.@i]+"]";
} else {
query_sql("INSERT INTO `mail` (send_name,dest_id,title,message,nameid,amount,identify,zeny,time) VALUES ('KyrieRO',"+.@checkin_rank[.@i]+",'** Checkin Ranking **','Has recibido un premio por encabezar la lista de exploración de ["+.@checkin_rank_map$[.@i]+"]',8001,1,0,0,UNIX_TIMESTAMP(NOW()))");
}
}
deletearray .@checkin_rank[0], getarraysize(.@checkin_rank);
deletearray .@checkin_rank_map$[0], getarraysize(.@checkin_rank_map$);
end;
}
- script CheckInMajors -1,{
OnWhisperGlobal:
OnCommand:
if ( !query_sql ("SELECT `mapname` FROM checkin_rank WHERE `account_id_major` = '"+getcharid(3)+"'", @mapname$[0]) ){
dispbottom " >> No ostentas el liderazgo en ningún mapa <<";
} else {
set @leadership$, "";
for ( set .@i, 0; .@i < getarraysize(@mapname$); set .@i, .@i+1 ){
if (.@i == getarraysize(@mapname$)-1){
set @leadership$, @leadership$ + @mapname$[.@i]+"";
} else {
set @leadership$, @leadership$ + @mapname$[.@i]+", ";
}
}
dispbottom ">>> Ostentas el liderazgo de: "+@leadership$+" <<<";
}
deletearray @mapname$[0], getarraysize(@mapname$);
end;
}