SA-MP Forums Archive
[Ajuda] erro no onplayerdeath - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] erro no onplayerdeath (/showthread.php?tid=471373)



erro no onplayerdeath - iTzDemon - 22.10.2013

Da crash no a partir do 3, algumas dicas?

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    //new Arma[50];
    print("1");
    if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
    print("2");
    UFO[playerid] = false;
    print("3");
    //GetWeaponName(reason, Arma, sizeof(Arma));
    if(killerid == INVALID_PLAYER_ID)
    {
        print("4");
        new string[500];
        print("5");
        format(string,sizeof(string),"[Kill:]{ffffff} O jogador {2CF52C}%s{ffffff} morreu.",GetPlayerNameEx(playerid));
        print("6");
        SendClientMessageToAll(COLOR_GREEN,string);
        print("7");
        PlayerInfo[playerid][Deaths]++;
        print("9");
    }
    return 1;
}



Re: erro no onplayerdeath - BielCOP - 22.10.2013

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    UFO[playerid] = false;

    if(killerid != INVALID_PLAYER_ID)
    {
        new string[64];

        format(string,sizeof(string),"[Kill:]{ffffff} O jogador {2CF52C}%s{ffffff} morreu.",GetPlayerNameEx(playerid));
        SendClientMessageToAll(COLOR_GREEN,string);

        PlayerInfo[playerid][Deaths]++;
    }
    return 1;
}



Re: erro no onplayerdeath - PT - 22.10.2013

coloca assim

pawn Код:
if(killerid != INVALID_PLAYER_ID)



Re: erro no onplayerdeath - iTzDemon - 22.10.2013

tp eu quero que apareзa essa msg se o player morrer sozinho


Re: erro no onplayerdeath - BielCOP - 22.10.2013

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    UFO[playerid] = false;

    if(!IsPlayerConnected(killerid))
    {
        new string[64];

        format(string,sizeof(string),"Player %s morreu sozinho!",GetPlayerNameEx(playerid));
        SendClientMessageToAll(COLOR_GREEN,string);

        PlayerInfo[playerid][Deaths]++;
    }
    return 1;
}