Death System doesn't respawn correctly after explosion.
#1

Title says all.

The player can fall, be shot, stabbed etc and they will respawn correctly in the death system. However, if the cause is an explosion the player is prompted with the (SPAWN) button which shouldn't happen.

Here is my death system:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerDead[playerid] = 1;
Player is dead..
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(PlayerDead[playerid] == 1 && PlayerIsDead[playerid] == 0)
    {
        PlayerDeath(playerid);
    }
pawn Код:
stock PlayerDeath(playerid)
{
    SetPlayerVirtualWorld(playerid, DeathVW[playerid]);
    SetPlayerInterior(playerid, DeathInt[playerid]);
    SetPlayerPos(playerid, DeathPosX[playerid], DeathPosY[playerid], DeathPosZ[playerid]);
    SetPlayerHealth(playerid, 99999);
   
    new model, GunAmmo, sqlid;
    new string[128];
    PlayerIsDead[playerid] = 1;
    format(string, sizeof(string), "D E A D\nB O D Y");
    DeathLabel[playerid] = CreateDynamic3DTextLabel(string, COLOUR_REALRED, 0.0, 0.0, -0.5, 50.0, playerid, INVALID_VEHICLE_ID);
    format(string, sizeof(string), "You have "COL_RED"died."COL_WHITE" Please assist players with the use of "COL_GREEN"'/do' "COL_WHITE"and do not "COL_RED"RK.");
    SendClientMessage(playerid, COLOUR_WHITE, string);
    SendClientMessage(playerid, COLOUR_GREY, "Depending on your cause of death, you may be revived. You must wait 3 minutes before you can '/accept death', EMT's have 4 minutes to respond before you cannot be revived.");
    TextDrawShowForPlayer(playerid, DeadDraw[playerid]);
    ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.1, 0, 1, 1, 1, 0, 1);
    DeathTimer[playerid] = 3;
    TextDrawHideForPlayer(playerid,BFText);
    KillTimer(BleedingTime[playerid]);
    PlayerDead[playerid] = 0;
    /*new Float: area[5];
    area[0] = 0.1;
    area[1] = 0.2;
    area[2] = 0.3;
    area[3] = 0.4;
    area[4] = 0.5;
*/

   
    for(new w = 0; w < 13; w++)
    {
        if(PlayerWeapons[playerid][w] > 0)
        {
            sqlid = PlayerWeapons[playerid][w];
            model = WepModel[sqlid];
            GunAmmo = WepAmmo[sqlid];
           
            DropGun(playerid, sqlid, model,GunAmmo,DeathPosX[playerid], DeathPosY[playerid], DeathPosZ[playerid] ,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
        }
    }
    return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(PlayerDead[playerid] == 1 || PlayerIsDead[playerid])return 1;
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(LoggedIn[playerid] == 0) return 0;
    if(PlayerDead[playerid] == 1 || PlayerIsDead[playerid])return 1;
RESOLVED.
Reply
#2

Well this code first have a lot of bugs.

Код:
public OnPlayerUpdate(playerid)
{
	if(PlayerDead[playerid] == 1 && PlayerIsDead[playerid] == 0)
	{
		PlayerDeath(playerid);
	}

}
this is wrong you need to use this code Under OnPlayerSpawn.

Like this

Код:
public OnPlayerSpawn(playerid)
{
	if(PlayerDead[playerid] == 1 && PlayerIsDead[playerid] == 0)
	{
		PlayerDeath(playerid);
	}

}
Код:
public OnPlayerRequestClass(playerid, classid)
{
	if(PlayerDead[playerid] == 1 || PlayerIsDead[playerid])return 1;
public OnPlayerRequestSpawn(playerid)
{
	if(LoggedIn[playerid] == 0) return 0;
	if(PlayerDead[playerid] == 1 || PlayerIsDead[playerid])return 1;
if(PlayerDead[playerid] == 1 || PlayerIsDead[playerid])

PlayerIsDead[playerid] == 1 or PlayerIsDead[playerid] is same thing.

for PlayerIsDead[playerid] ==0 or !PlayerIsDead[playerid] is same thing.

any i'll advice you don't you that under OnPlayerUpdate it will lag your server.
better to use it properly on Under OnPlayerSpawn
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)