Jump to content
  • 0

Question

Posted (edited)

Good guys, how are you?

Could someone help me with an excerpt from this script?

Quote

    query_sql("SELECT `league` FROM `pk_rating` WHERE `char_id` = '"+strcharinfo(0)+"' ", .@liga$);
    if ( .@liga$ == "" ) {
        cutin "unranked",4; mes "Sua Liga: Unranked";
    } else {
        mes "Sua Liga: "+.@liga$;
        for(@i = 0; @i < getarraysize($LeagueName$); @i ++){
            if($LeagueName$[@i] != "") {
                if(MPKAcc >= $MinRating[@i] && MPKAcc <= $MaxRating[@i]) cutin $CutinName$[@i], 4;
            }

Quote

function    script    PKLeagues    {
    query_sql "SELECT `league` FROM `pk_rating` WHERE `char_id` = '"+strcharinfo(0)+"'", .@league$;
    for(@i = 0; @i < getarraysize($LeagueName$); @i ++){
        if($LeagueName$[@i] != "") {
            if(MPKAcc >= $MinRating[@i] && MPKAcc <= $MaxRating[@i] && .@league$ != $LeagueName$[@i]){
                if(.@league$ == "Desafiante") return;

I think it would be something like this... " for(set .@i,0; @i < getarraysize($LeagueName$); @i ++){ "  but the error jumps forward @i ++){  !

 

The emulator I'm using is eAthena... if anyone still remembers it and can help me, I'd be very grateful!

 

 

Quote

 

 

error.png

Edited by Yukaiii

3 answers to this question

Recommended Posts

  • 0
Posted
1 hour ago, Mice said:

Try this

if ( getarraysize(.@liga$) == 0 || .@liga$[0] == "") {

 

the npc is showing this error

[Error]: npc_click: npc_id != 0

it does not display any additional errors in the console.
everything appears on the map correctly.

 

and it is not counting the pvp rank

 

Quote

// -------------- PVP RATING (SQL ONLY)! ----------------- //
// ---- fez Kubix.

/*
tabelas:

CREATE TABLE  `pk_rating` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`char_id` varchar(30) NOT NULL,
`kill_count` int(11) NOT NULL,
`die_count` int(11) NOT NULL,
`score` int(11) NOT NULL,
`league` varchar(30) NOT NULL,
PRIMARY KEY (`id`)
);

*/

-    script    PvP_FunctionS    -1,{

    OnPCKillEvent:
    getmapxy .@charmap$,.@x,.@y,0;
    if(strcharinfo(3) == "prontera") end;
    for(set .@i,0; .@i <=getarraysize($Rating_Location$); set .@i,.@i+1){
        if(.@charmap$ == $Rating_Location$[.@i]){
            callfunc "Announcing"; // Anúncios metragens e sons.
            callfunc "PKGetRating"; // A função de emitir uma classificação.
            end;
        }
    }
    end;

OnMKReset: set @MultiKIll, 0; 
end;
}    


-    script    PvP_FunctionSS    -1,{
OnPCDieEvent:
if(strcharinfo(3) == "prontera") end;
if((killerrid == getcharid(0)) || (killerrid < 150000)) end;
// Verificando no mapa.
getmapxy .@charmap$,.@x,.@y,0;
for(set .@i,0; .@i <=getarraysize($Rating_Location$); set .@i,.@i+1){
    if(.@charmap$ == $Rating_Location$[.@i]){
        if((killerrid == getcharid(0)) || (killerrid < 150000)) end;
        sleep2 500;
        deltimer "PvP_FunctionS::OnMKReset";
        if(@MultiKill > 0)set @MultiKill, 0;
        if(@KillingSpree > 0)set @KillingSpree, 0;
        if(@PKKills >0)set @PKKills, 0;
        callfunc "PKTakeRating"; // Classificação Minusuem.
        end;
    }
}
end; 
}

-    script    PvP_LogoutEvent    -1,{
OnPCLogoutEvent:
if(strcharinfo(3) == "prontera") end;
getmapxy .@charmap$,.@x,.@y,0;
if ( getarraysize(.@liga$) == 0 || .@liga$[0] == "") {
    if(.@charmap$ == $Rating_Location$[.@i]){
        if(@MultiKill > 0)set @MultiKill, 0;
        if(@KillingSpree > 0)set @KillingSpree, 0;
        if(@PKKills >0)set @PKKills, 0;
        deltimer "PvP_FunctionS::OnMKReset";
        end;
    }
}    
end;
}

function    script    PKGetRating    {
    set PKRatingF, 0; // Classificações são adicionados à base.
    set @PKKills, @PKKills + 1; // Matança.
    set PKRatingF, PKRatingF + 2 * (rand(2,3) + @PCKills); 
    set MPKAcc, MPKAcc + 2 * (rand(2,3) + @PCKills);   // a avaliação principal
    set PCKills, PCKills + 1; // contador de Kills
    callfunc "PKLeagues";
    dispbottom "[PvP Ranking]: Classificação [ +"+PKRatingF+" ].";
    query_sql ("SELECT `char_id` FROM `pk_rating` WHERE `char_id` = '"+strcharinfo(0)+"' ", .@existe$);
    if(.@existe$ != ""){
        query_sql "UPDATE `pk_rating` SET `kill_count` = '"+PCKills+"', `score` = '"+MPKAcc+"' WHERE `char_id` = '"+strcharinfo(0)+"'";
    }else{
        query_sql "INSERT INTO `pk_rating` (char_id,kill_count,score,league) VALUES ('"+strcharinfo(0)+"','"+PCKills+"','"+MPKAcc+"','Bronze')";
    }
    end;
}

function    script    PKTakeRating    {
    set PKRatingF, 0; // Classificações são adicionados à base.
    set @PKDies, @PKDies + 1; // Uma série de mortes
    set PKRatingF, PKRatingF - 2 * (rand(2,3) + @PCDies);  
    set MPKAcc, MPKAcc - 2 * (rand(2,3) + @PCDies);   // A avaliação principal.
    set PCDies, PCDies + 1; // Mortes balcão.
    if( MPKAcc < 0 ) { set MPKAcc,0; }
    callfunc "PKLeagues";
    dispbottom "[PvP Ranking]: Classificação [ "+PKRatingF+" ].";
    query_sql("SELECT `char_id` FROM `pk_rating` WHERE `char_id` = '"+strcharinfo(0)+"' ", .@existe$);
    if(.@existe$ != ""){
        query_sql "UPDATE `pk_rating` SET `die_count` = '"+PCDies+"', `score` = '"+MPKAcc+"' WHERE `char_id` = '"+strcharinfo(0)+"'";
    }else{
        query_sql "INSERT INTO `pk_rating` (char_id,die_count,score,league) VALUES ('"+strcharinfo(0)+"','"+PCDies+"','"+MPKAcc+"','Bronze')";
    }
    end;
}
// PK Top
prontera,139,180,5    script    PvP Ranking    857,{
    /*
    mes " ";
    cutin "unranked",4;
    next;
    mes " ";
    cutin "bronze",4;
    next;
    mes " ";
    cutin "prata",4;
    next;
    mes " ";
    cutin "ouro",4;
    next;
    mes " ";
    cutin "platina",4;
    next;
    mes " ";
    cutin "diamante",4;
    next;
    mes " ";
    cutin "mestre",4;
    next;
    mes " ";
    cutin "desafiante",4;
    next;
    */
    mes "[PvP Ranking]";
    mes "Mostra os Players com uma classificação maior que 0.";
    mes "Sua nota pessoal: " + MPKAcc;
    query_sql("SELECT `league` FROM `pk_rating` WHERE `char_id` = '"+strcharinfo(0)+"' ", .@liga$);
    if ( .@liga$ == "" ) {
        cutin "unranked",4; mes "Sua Liga: Unranked";
    } else {
        mes "Sua Liga: "+.@liga$;
        for(set @i,0; @i < getarraysize($LeagueName$); set @i,@i+1 ){
            if($LeagueName$[@i] != "") {
                if(MPKAcc >= $MinRating[@i] && MPKAcc <= $MaxRating[@i]) cutin $CutinName$[@i], 4;
            }
        }
    }
    query_sql("SELECT `league` FROM `pk_rating` WHERE `char_id` = '"+strcharinfo(0)+"' ", .@liga$);
        if ( .@liga$ == "Bronze" ) { cutin "bronze",4; } else if ( .@liga$ == "Desafiante" ) { cutin "desafiante",4; }
    next;
    if(select("> TOP PvP:> Sair") == 2) {
        close2;
        cutin "", 255;
        end;
    }
    query_sql "SELECT `char_id`,`kill_count`,`die_count`,`score`,`league` FROM `pk_rating` ORDER BY `score` DESC LIMIT 10", .@cname$, .@kcount, .@dcount, .@rscore, .@leaguel$;
    mes "Nome / Kill / Death / Ratio / Liga";
    for(set .i, 0; .i < 10; set .i, .i + 1) {
        if(.@cname$[.i] != "" && .@rscore[.i] > 0) {
            mes "" + (.i+1) + ".^FF0000" + .@cname$[.i] + "^000000/" + .@kcount[.i] + "/" + .@dcount[.i] + "/^6699DD" + .@rscore[.i] + "^000000/^0000FF" + .@leaguel$[.i] + "^000000.";
        } else {
            mes (.i+1)+".Ninguém";
        }
    }
    close2;
    cutin "", 255;
    end;
    
    
    OnInit:
    // === Settings
    set $FirstBlood, 0;
    set $Sound, 1;
    set $Announce, 1;
    setarray $KS_Ann$[0],"IS ON A KILLING SPREE!!!","IS ON A RAMPAGE!!!","IS UNSTOPPABLE!!!","IS DOMINATING!!!","IS G-G-G-GODLIKE!!!","IS LEGENDARY!!!";
    setarray $MK_Ann$[0],"HAS SCORED A DOUBLE KILL!!!","HAS SCORED A TRIPLE KILL!!!","HAS SCORED A QUADRA KILL!!!","HAS SCORED A PENTA KILL!!!!";
    setarray $Rating_Location$[0],"guild_vs1","guild_vs3","2009rwc_01","2009rwc_02"; // Adicione a sua localização aqui.
    setarray $LeagueName$[0], "Bronze","Prata","Ouro","Platina","Mestre","Diamante","Desafiante";
    setarray $MinRating[0], 0, 1000, 2000, 3000, 4000, 5000, 6000;
    setarray $MaxRating[0], 999, 1999, 2999, 3999, 4999, 5999, 100000;
    setarray $CutinName$[0], "bronze","prata","ouro","platina","diamante","mestre","desafiante";
    // === end of settings

    while(1) {
        query_sql "SELECT `char_id`,`score` FROM `pk_rating` ORDER BY `score` DESC LIMIT 1", .@char_id$, .@score;
        if(.@char_id$ == "" || .@score <= 0) waitingroom "[ PvP Ranking ]", 0; 
        else waitingroom "[Top PvP]: " + .@char_id$ + " ["+.@score+"] ", 0;
        sleep 60000;
        delwaitingroom;
    }
}

function    script    Announcing    {
if(!$FirstBlood){
  set $FirstBlood,1;
  if($Announce) announce strcharinfo(0) + " HAS DRAW A FIRST BLOOD!",bc_map|bc_red;
  if($Sound){
   soundeffectall "firstblood.wav",strcharinfo(3);
  }
}
set @KillingSpree, @KillingSpree +1;
set @MultiKill, @MultiKill +1;
deltimer "PvP_FunctionS::OnMKReset";
addtimer 10000, "PvP_FunctionS::OnMKReset";
if($Announce){
  switch(@KillingSpree){
   case 0: case 1: case 2: break;
   case 3: mapannounce strcharinfo(3),strcharinfo(0)+" " +$KS_Ann$[@KillingSpree -3],bc_all; break;
   case 4: mapannounce strcharinfo(3),strcharinfo(0)+" " +$KS_Ann$[@KillingSpree -3],bc_all; break;
   case 5: mapannounce strcharinfo(3),strcharinfo(0)+" " +$KS_Ann$[@KillingSpree -3],bc_all; break;
   case 6: mapannounce strcharinfo(3),strcharinfo(0)+" " +$KS_Ann$[@KillingSpree -3],bc_all; break;
   case 7: mapannounce strcharinfo(3),strcharinfo(0)+" " +$KS_Ann$[@KillingSpree -3],bc_all; break;
  }
}
if(@KillingSpree == 1){
  if($Sound) soundeffectall "firstblood.wav",strcharinfo(3);
}
if(@KillingSpree >= 3 && @KillingSpree <= 7){
  if($Sound) soundeffectall "killingspree"+@KillingSpree+".wav", 0, strcharinfo(3);
}
if($Announce){
  switch(@MultiKill){
   case 0: case 1: break;
   case 2: mapannounce strcharinfo(3),strcharinfo(0)+" " +$MK_Ann$[@MultiKill -2],bc_all; break;
   case 3: mapannounce strcharinfo(3),strcharinfo(0)+" " +$MK_Ann$[@MultiKill -2],bc_all; break;
   case 4: mapannounce strcharinfo(3),strcharinfo(0)+" " +$MK_Ann$[@MultiKill -2],bc_all; break;
   case 5: mapannounce strcharinfo(3),strcharinfo(0)+" " +$MK_Ann$[@MultiKill -2],bc_all; break;
  }
}
sleep2 1500;
if(@MultiKill >= 2 && @MultiKill <= 5) {
  if($Sound) soundeffectall "multikill"+@MultiKill+".wav", 0, strcharinfo(3);
}

if(@KillingSpree < 3){
  if($Announce) mapannounce strcharinfo(3),strcharinfo(0)+" HAS SLAIN A "+rid2name(killedrid),bc_all;
}
  if($Sound){
   soundeffectall "slain.wav",0,strcharinfo(3);
  }

if(@KillingSpree >= 7){
  if($Announce) mapannounce strcharinfo(3),strcharinfo(0)+" IS LEGENDARY!!!",bc_all;
  if($Sound){
   soundeffectall "legendary.wav",0,strcharinfo(3);
  }
}

if(@MultiKill > 5) set @MultiKill, 0;
return;
}

// a Liga das
function    script    PKLeagues    {
    query_sql "SELECT `league` FROM `pk_rating` WHERE `char_id` = '"+strcharinfo(0)+"'", .@league$;
if ( getarraysize(.@liga$) == 0 || .@liga$[0] == "") {
        if($LeagueName$[@i] != "") {
            if(MPKAcc >= $MinRating[@i] && MPKAcc <= $MaxRating[@i] && .@league$ != $LeagueName$[@i]){
                if(.@league$ == "Desafiante") return;
                query_sql "UPDATE `pk_rating` SET `league` = '"+$LeagueName$[@i]+"' WHERE `char_id` = '"+strcharinfo(0)+"'";
                dispbottom "[PvP Info] : Sua nova divisão : " + $LeagueName$[@i] + ".";
                cutin $CutinName$[@i], 4;
                sleep2 3000;
                cutin "", 255;
            }
        }
    }        
    return;
}

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...