//---- MvP Ladder Logic Script
- script mvpladder -1,{
OnInit:
// Configurações
.map_killannounce = 1; // anunciar quando o MVP é morto no mapa onde o MVP foi morto: 0 - desativado, 1 - ativado
.killannounce = 1; // anunciar quando o MVP é morto globalmente: 0 - desativado, 1 - ativado
.gmnokill = 60; // GMs não devem matar MVPs. Um GM com nível <estenúmero> ou superior não fará nada. Se definido como 60, GMs de nível 60 ou superior não receberão nada ao matar jogadores: 0 - desativado
// .min_gm_menu = 90; // nível mínimo do GM que pode usar o menu do GM no NPC da escada
.showtotal = 10; // mostrar o comprimento da escada.
.showpage = 10; // definir as visualizações por página.
.showstatue = 3; // número de estátuas. Este número deve corresponder ao número de duplicatas no final do script.
.fix_custom_sprite = true; // se o seu servidor tem sprites animados personalizados que se sobrepõem à animação da estátua repetidamente, ative isso
// Config ends ------------------------------------------------------------------------------------------
// to prevent bug happen
if (.gmnokill <= 0) .gmnokill = 100;
sleep 1;
OnTimer10000: // refresh statues every 1 minute. Note the `char` table is unrealiable, player still need to perform certain task to save the character -> see 'save_settings' in conf\map-server.conf
.@query$ = "SELECT `char`.`char_id`, `char`.`name`, `char`.`guild_id`, `char`.`class`, "
+ "`char`.`sex`, `char`.`hair`, `char`.`hair_color`, `char`.`clothes_color`, "
+ "`char`.`body`, `char`.`head_top`, `char`.`head_mid`, `char`.`head_bottom`, `char`.`robe`, "
+ "SUM(`mvpladder`.`kills`) as `orderKills` "
+ "FROM `char` RIGHT JOIN `mvpladder` ON `char`.`char_id` = `mvpladder`.`char_id` GROUP BY `char`.`char_id` ORDER BY `orderKills` DESC LIMIT " + .showstatue;
.@nb = query_sql(.@query$, .@cid, .@name$, .@guild_id, .@class, .@sex$, .@hair, .@hair_color, .@clothes_color, .@body, .@head_top, .@head_mid, .@head_bottom, .@robe, .@kills);
if (.fix_custom_sprite) {
for (.@i = 0; .@i < .@nb; ++.@i) {
setunitdata .statue[.@i +1], UNPC_HEADTOP, 0;
setunitdata .statue[.@i +1], UNPC_HEADMIDDLE, 0;
setunitdata .statue[.@i +1], UNPC_HEADBOTTOM, 0;
setunitdata .statue[.@i +1], UNPC_ROBE, 0;
}
}
for (.@i = 0; .@i < .@nb; ++.@i) {
setunitdata .statue[.@i +1], UNPC_CLASS, .@class[.@i];
setunitdata .statue[.@i +1], UNPC_SEX, (.@sex$[.@i] == "F")? SEX_FEMALE:SEX_MALE;
setunitdata .statue[.@i +1], UNPC_HAIRSTYLE, .@hair[.@i];
setunitdata .statue[.@i +1], UNPC_HAIRCOLOR, .@hair_color[.@i];
setunitdata .statue[.@i +1], UNPC_CLOTHCOLOR, .@clothes_color[.@i];
setunitdata .statue[.@i +1], UNPC_BODY2, .@body[.@i];
setunitdata .statue[.@i +1], UNPC_HEADTOP, .@head_top[.@i];
setunitdata .statue[.@i +1], UNPC_HEADMIDDLE, .@head_mid[.@i];
setunitdata .statue[.@i +1], UNPC_HEADBOTTOM, .@head_bottom[.@i];
setunitdata .statue[.@i +1], UNPC_ROBE, .@robe[.@i];
setnpcdisplay "mvp_ladder_statue#"+(.@i +1), .@name$[.@i];
.statue_name$[.@i +1] = .@name$[.@i];
.statue_guild$[.@i +1] = getguildname(.@guild_id[.@i]);
.statue_kills[.@i +1] = .@kills[.@i];
}
for (.@i = .@nb; .@i < .showstatue; ++.@i)
setunitdata .statue[.@i +1], UNPC_CLASS, HIDDEN_WARP_NPC;
initnpctimer;
end;
OnNPCKillEvent: // Logic to detect when a MvP is killed
if(getgmlevel() < 3) {
if (getmonsterinfo(killedrid, MOB_MVPEXP) > 0) {
//announce "[ Ranking MVP ] : O jogador ["+ strcharinfo(0) +"] acaba de matar o MVP "+ getmonsterinfo( killedrid, MOB_NAME ) +" em "+ strcharinfo(3), bc_all;
.@selectIfKillExistQuery$ = "SELECT char_id, mob_id, kills FROM mvpladder WHERE char_id = '" + getcharid(0) + "' AND mob_id = '" + killedrid + "';";
if (query_sql(.@selectIfKillExistQuery$, .@charid, .@kills, .@name$) > 0) { // Exist a kill of that MVP so +1 to kill count
.@updateLadderQuery$ = "UPDATE mvpladder SET kills = kills + 1 WHERE char_id = '" + getcharid(0) + "' AND mob_id = '" + killedrid + "'";
} else { // Create a new kill of specific MVP
//.@updateLadderQuery$ = "INSERT INTO mvpladder (char_id, mob_id, kills) VALUES ('" + getcharid(0) + "','" + killedrid + "','1');";
.@updateLadderQuery$ = "INSERT INTO mvpladder (`char_id` , `mob_id` , `kills`) VALUES ('" + getcharid(0) + "','" + killedrid + "','1');";
}
query_sql(.@updateLadderQuery$);
}
}
end;
}
//Pontos MVP
- script mvppoint01 -1,{
OnNPCKillEvent:
setarray .@monsterID[0],1038,1039,1046,1059,1086,1087,1112,1115,1147,1150,1157,1159,1190,1251,1252,1272,1312,1373,1389,1418,1492,1511,1583,1623,1630,1658,1685,1688,1719,1785,1885,2068; // ID Dos Boss
for(set @a,0; @a <= getarraysize(.@monsterID); set @a,@a+1)
if(killedrid == .@monsterID[@a]){
set #MVPPOINTS,#MVPPOINTS+1;
message strcharinfo(0),"[FriendsRO]: Você possui "+#MVPPOINTS+" ponto(s) de MvPs.";
}
}
- script mvppoint03 -1,{
OnNPCKillEvent:
setarray .@monsterID[0],1708,1734,1751,1768,1779,1832,1871,1917,1990,1991,2202; // ID Dos Boss
for(set @a,0; @a <= getarraysize(.@monsterID); set @a,@a+1)
if(killedrid == .@monsterID[@a]){
set #MVPPOINTS,#MVPPOINTS+3;
message strcharinfo(0),"[FriendsRO]: Você possui "+#MVPPOINTS+" ponto(s) de MvPs.";
}
}
- script mvppoint05 -1,{
OnNPCKillEvent:
setarray .@monsterID[0],1646,1647,1648,1649,1650,1651,1874,1929,1956,1957,2022; // ID Dos Boss
for(set @a,0; @a <= getarraysize(.@monsterID); set @a,@a+1)
if(killedrid == .@monsterID[@a]){
set #MVPPOINTS,#MVPPOINTS+5;
message strcharinfo(0),"[FriendsRO]: Você possui "+#MVPPOINTS+" ponto(s) de MvPs.";
}
}
//---- Informações do NPC Lider MVP
prontera,142,173,5 script Caçador MVP 733,{
.@npcname$ = strnpcinfo(0);
while (1) {
mes "["+ .@npcname$ +"]";
mes "Olá ^A020F0"+ strcharinfo(0) +"^000000...";
mes "Você tem atualmente ^0000ff"+#MVPPOINTS+"^000000 Pontos MVP.";
next;
switch (select("^339966[»]^000000 Ranking MVP","^008aff[»]^000000 MVPs mais Caçados","^A020F0[»]^000000 Abrir a Loja")) {
case 1:
mes "^FF0000O ranking é resetado todo dia 01.^000000";
mes "";
.@queryKillerList$ = "SELECT t1.char_id, SUM(t1.kills) as `orderKills`, t2.name " +
"FROM `mvpladder` t1 " +
"INNER JOIN `char` t2 " +
"ON t1.char_id = t2.char_id " +
"GROUP BY t1.char_id " +
"ORDER BY `orderKills` DESC " +
"LIMIT " + getvariableofnpc(.showtotal, "mvpladder") + ";";
.@nb = query_sql(.@queryKillerList$, .@charid, .@kills, .@name$);
if (!.@nb) {
mes "O Ranking está vazio no momento.";
next;
}
for (.@j = 0; .@j < .@nb; .@j += getvariableofnpc(.showpage,"mvpladder")) {
for (.@i = .@j; .@i < (getvariableofnpc(.showpage,"mvpladder") + .@j) && .@i < .@nb; ++.@i)
mes "^996600" + (.@i+1) + ": ^006699" + .@name$[.@i] + " - ^00AA00[" + .@kills[.@i] + "]^FF0000 MVPs Mortos^000000";
next;
}
break;
case 2:
.@queryKilledList$ = "SELECT char_id, mob_id, SUM(kills) as `orderKills` " +
"FROM `mvpladder` " +
"GROUP BY mob_id " +
"ORDER BY `orderKills` DESC " +
"LIMIT " + getvariableofnpc(.showtotal, "mvpladder") + ";";
.@nb = query_sql(.@queryKilledList$, .@charid, .@mobid, .@kills);
if (!.@nb) {
mes "O top está vazio no momento.";
next;
}
for (.@j = 0; .@j < .@nb; .@j += getvariableofnpc(.showpage,"mvpladder")) {
for (.@i = .@j; .@i < (getvariableofnpc(.showpage,"mvpladder") + .@j) && .@i < .@nb; ++.@i) {
mes "^996600" + (.@i+1) + ": ^006699" + strmobinfo(1, .@mobid[.@i]) + " ^FF0000MVP ^00AA00[Morto ^FF0000" + .@kills[.@i] + " ^00AA00Vezes]^000000";
}
next;
}
query_sql("SELECT SUM(kills) FROM mvpladder;", .@killCount);
mes "^996600==> ^006699Total de MVPs Mortos [^00AA00" + .@killCount[0] + "^000000^006699]^FF0000";
break;
case 3:
dispbottom "Você tem "+#MVPPOINTS+" Pontos de MVP.";
close2;
callshop "Shop_MVPPOINTS";
end;
}
OnInit:
initnpctimer;
setunittitle(getnpcid(0), "[ Ranking e Loja ]");
end;
OnTimer10000:
showscript("Líder MVP");
setnpctimer 0;
end;
}
close;
}
//---- MSG board NPCs
- script mvp_ladder_statue -1,{
.@id = getelementofarray(getvariableofnpc(.npcgid, "mvpladder"), getnpcid(0));
mes "^996600[TOP MVP "+ .@id +"]";
mes "^006699Nome: "+ getelementofarray(getvariableofnpc(.statue_name$, "mvpladder"), .@id);
.@guildname$ = getelementofarray(getvariableofnpc(.statue_guild$, "mvpladder"), .@id);
mes "^00AAAAGuild: "+((.@guildname$ == "null")? "^AAAAAANone": .@guildname$);
mes "^00AA00Matou: ["+ getelementofarray(getvariableofnpc(.statue_kills, "mvpladder"), .@id) +"]";
close;
OnInit:
.@id = strnpcinfo(2);
set getvariableofnpc(.statue[.@id], "mvpladder"), getnpcid(0);
set getvariableofnpc(.npcgid[getnpcid(0)], "mvpladder"), .@id;
end;
}
prontera,142,178,4 duplicate(mvp_ladder_statue) mvp_ladder_statue#1 1_F_MARIA
prontera,140,180,4 duplicate(mvp_ladder_statue) mvp_ladder_statue#2 1_F_MARIA
prontera,138,182,4 duplicate(mvp_ladder_statue) mvp_ladder_statue#3 1_F_MARIA
//== clone base
prontera,142,178,5 script #2 PORTAL,{
end;
OnInit:
while(1) {
specialeffect EF_MVP;
sleep 10000;
}
}
//prontera,172,204,4 script #npcuniquename PORTAL,{}
prontera,140,180,4 script #npcuniquename1 PORTAL,{}
prontera,138,182,4 script #npcuniquename2 PORTAL,{}
//== msg top da cabeça
prontera,142,178,4 script #top1 111,{
OnInit:
initnpctimer;
end;
OnTimer1000:
showscript("Top-1 MVP");
setnpctimer 0;
end;
}
prontera,140,180,4 script #top2 111,{
OnInit:
initnpctimer;
end;
OnTimer1000:
showscript("Top-2 MVP");
setnpctimer 0;
end;
}
prontera,138,182,4 script #top3 111,{
OnInit:
initnpctimer;
end;
OnTimer1000:
showscript("Top-3 MVP");
setnpctimer 0;
end;
}
- script reset_ranking -1,{
OnClock0005:
if(gettime(DT_DAYOFMONTH) == 1){
query_sql ("TRUNCATE `mvpladder`");
end;
}
OnInit:
bindatcmd "resetrankingmvp", strnpcinfo(0) +"::OnReset";
end;
OnReset:
if (getgmlevel() > 98) {
query_sql ("TRUNCATE `mvpladder`");
dispbottom "Ranking MVP resetado com sucesso!";
end;
} else {
dispbottom "Somente Administradores podem usar este comando";
end;
}
end;
}
Can anyone help me add an automatic award system to this script?
I wanted every day 1, the prize for 1st, 2nd and 3rd place, to automatically fall into the player's account
Question
FrajolazitoH
Can anyone help me add an automatic award system to this script? I wanted every day 1, the prize for 1st, 2nd and 3rd place, to automatically fall into the player's account
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.