Jump to content
  • 0

killedrid don't set char_id


serjtk

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  4
  • Reputation:   0
  • Joined:  11/12/14
  • Last Seen:  

Hey guys,

I am trying to create the script below that counts the kills depending on the faction that the killer and the victim belong to. It’s actually quite simple and obvious.

However, I’m not having success with the part where it checks if the players are in the same faction. It seems that the problem lies in killedrid, which is not correctly setting the char_id.

Quote

-    script    SistemaKillFaccoes    -1,{
    
    OnPCKillEvent:
        if (strcharinfo(3) != "guild_vs3") { end; }
        
        set .@killer, getcharid(0);
        set .@killed, killedrid;
            
        query_sql "SELECT faction FROM `char` WHERE char_id = " + .@killer + ";", .@killer_faction;
        query_sql "SELECT faction FROM `char` WHERE char_id = " + .@killed + ";", .@killed_faction;    
        
        if (.@killer_faction == .@killed_faction) {
            query_sql "UPDATE faction_kills SET mortes = mortes - 2 WHERE faction_id = " + .@killer_faction + ";";
            dispbottom "--- Você matou um membro da própria Facção [-2 pontos] -----";
        end;
        }
        if (.@killer_faction == 1 || .@killer_faction == 2) {
            query_sql "UPDATE faction_kills SET mortes = mortes + 1 WHERE faction_id = " + .@killer_faction + ";";
            dispbottom "----- Você eliminou um membro da Facção inimiga [+1 ponto] -----";
        }
        end;
}

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.02
  • Content Count:  215
  • Reputation:   11
  • Joined:  08/30/19
  • Last Seen:  

3 hours ago, serjtk said:

Hey guys,

I am trying to create the script below that counts the kills depending on the faction that the killer and the victim belong to. It’s actually quite simple and obvious.

However, I’m not having success with the part where it checks if the players are in the same faction. It seems that the problem lies in killedrid, which is not correctly setting the char_id.

 

 

-    script    SistemaKillFaccoes    -1,{

OnPCKillEvent:
    if (strcharinfo(3) != "guild_vs3") { end; }
    set .@killer, getcharid(0);
    set .@killed, killedrid;


    query_sql "SELECT faction FROM `char` WHERE char_id = " + .@killer + ";", .@killer_faction;
    query_sql "SELECT faction FROM `char` WHERE char_id = " + .@killed + ";", .@killed_faction;


    if (.@killer_faction == .@killed_faction) {
        query_sql "UPDATE faction_kills SET mortes = mortes - 2 WHERE faction_id = " + .@killer_faction + ";";
        dispbottom "--- Você matou um membro da própria Facção [-2 pontos] -----";
        end; 
    }


    if (.@killer_faction == 1 || .@killer_faction == 2) {
        query_sql "UPDATE faction_kills SET mortes = mortes + 1 WHERE faction_id = " + .@killer_faction + ";";
        dispbottom "----- Você eliminou um membro da Facção inimiga [+1 ponto] -----";
    }

    end;
}

Link to comment
Share on other sites

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.

×
×
  • Create New...