Need Help with onplayerdeath
#7

Ok, I got your problem. You are using the wrong callback, you should use the "OnPlayerSpawn" instead.
Try this:

pawn Код:
//On top:

new bool:pDead[MAX_PLAYERS] = false;

// Callbacks:

public OnPlayerDeath(playerid, killerid, reason)
{
    // Your code

    pDead[playerid] = true;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(pDead[playerid] == true)
    {
    SetPlayerInterior(playerid, 2);
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerPos(playerid, 2563.9680, -1821.03295, 1223.7919);
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("UnfreezePlayer", 10000, false, "i", playerid);
    return 1;    
    }

   // Put this code in the BEGINNING of the callback.
}


forward UnfreezePlayer(playerid);

public UnfreezePlayer(playerid)
{
      TogglePlayerControllable(playerid, 1);    
      pDead[playerid] = false;
      SpawnPlayer(playerid);
      SendClientMessage(playerid, -1, "You are free!");
      return 1;
}
Reply


Messages In This Thread
Need Help with onplayerdeath - by cyberlord - 28.12.2014, 19:30
Re: Need Help with onplayerdeath - by 1fret - 28.12.2014, 20:28
Re: Need Help with onplayerdeath - by cyberlord - 28.12.2014, 20:32
Re: Need Help with onplayerdeath - by Pasa - 28.12.2014, 20:39
Re: Need Help with onplayerdeath - by cyberlord - 28.12.2014, 21:04
Re: Need Help with onplayerdeath - by Facerafter - 28.12.2014, 21:32
Re: Need Help with onplayerdeath - by Boot - 28.12.2014, 21:55

Forum Jump:


Users browsing this thread: 1 Guest(s)