[Ajuda] Ъltima vнtima
#1

como eu faзo para pegar a ъltima vнtima de usuбrio? o ъltimo jogador que ele matou
Reply
#2

pawn Код:
new MatouOCara[MAX_PLAYERS]; //Global

public OnPlayerDeath(killerid, playerid, reason)
{
    MatouOCara[killerid] = playerid;
    return true;
}
Reply
#3

nгo entendi @_@, me explica oque vocк fez?

matouocara sempre vai receber o ъltiimo?
Reply
#4

MatouOCara sempre vai atribuir а variбvel do killerid(No caso o player que matou) o valor do ID do playerid(No caso o player que morreu).
Entгo, sempre a variбvel: MatouOCara[playerid] valerб ao ID do ultimo cara que ele matou.
Menos quando o player ainda nгo matou ninguйm.
Reply
#5

Quote:
Originally Posted by cotonete
Посмотреть сообщение
nгo entendi @_@, me explica oque vocк fez?

matouocara sempre vai receber o ъltiimo?
sim. de cada player.
para evitar erros use o meu cуdigo. =)
pawn Код:
new Matou[MAX_PLAYERS];


public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerConnected(playerid) && IsPlayerConnected(killerid))
    {
        Matou[killerid] = playerid;
    }
    return 1;
}
Reply
#6

Fiz agora e nгo testei:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    if(IsPlayerConnected(playerid) && IsPlayerConnected(killerid))
    {
        SetPVarInt(killerid, "player", Name[playerid]);
        SetPVarInt(killerid, "id", playerid);
    }
    return 1;
}
STRCMP

pawn Код:
if(strcmp(cmdtext, "/matei", true) == 0)
{
    new string[ 100 ];
    format(string, sizeof(string), "O ultimo player que vocк matou foi %s [%d].", GetPVarInt(playerid, "player"), GetPVarInt(playerid, "id"));
    SendClientMessage(playerid, -1, string);
    return 1;
}
ZCMD

pawn Код:
CMD:matei(playerid, params[])
{
    new string[ 100 ];
    format(string, sizeof(string), "O ultimo player que vocк matou foi %s [%d].", GetPVarInt(playerid, "player"), GetPVarInt(playerid, "id"));
    SendClientMessage(playerid, -1, string);
    return 1;
}
Espero ter ajudado
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)