Player died 255 help please
#1

Hello,

When I died in game it spawn me on my position or in blueberry and show me

Код:
[debug] Player died 255 // this is showing around 20 times and them my game crash
OnPlayerDeath

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SetProgressBarValue(hungry[playerid], 100);
    SetSpawnInfo(playerid, -1, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPositionX], PlayerInfo[playerid][pPositionY], PlayerInfo[playerid][pPositionZ], PlayerInfo[playerid][pAngle], -1, -1, -1, -1, -1, -1);
    SpawnPlayer(playerid);
    return 1;
}
Reply
#2

The problem occurs because you put "SpawnPlayer" there.
I've tested it in my server with this code :
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
    SpawnPlayer(playerid);
    return 1;
}
It spams "[debug]: abc has died 255" at the server console.

I think the solution is to remove SpawnPlayer from OnPlayerDeath
Reply
#3

Yeah OnPlayerDeath automatically calls OnPlayerSpawn do something like this instead.

pawn Код:
new bool:JustDied[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    JustDied[playerid] = false;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    JustDied[playerid] = true;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(JustDied[playerid] == true)
    {
        SetPlayerPos(playerid,PlayerInfo[playerid][pPositionX], PlayerInfo[playerid][pPositionY], PlayerInfo[playerid][pPositionZ]);
        SetPlayerFacingAngle(playerid,PlayerInfo[playerid][pAngle]);
        SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
        SetProgressBarValue(hungry[playerid], 100);
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)