PDA

View Full Version : Death help


Deaglez
08/09/2012, 03:41 AM
OK, how do i make when player died, then spawn in the same last death place?

vIBIENNYx
08/09/2012, 03:53 AM
Add this to the top

new Float:deathx[MAX_PLAYERS], Float:deathy[MAX_PLAYERS], Float:deathz[MAX_PLAYERS];
new died[MAX_PLAYERS];

Then:

OnPlayerDeath(playerid)
{
GetPlayerPos(playerid, deathx[playerid], deathy[playerid], deathz[playerid]);
died[playerid] = 1;
}

OnPlayerSpawn(playerid);
{
if(died[playerid] == 1)
{
SetPlayerPos(playerid, deathx[playerid], deathy[playerid], deathz[playerid]);
}
}

Remember to set "died[MAX_PLAYERS]" to 0 when the player disconnects.

Deaglez
08/09/2012, 04:03 AM
Thnks, 1 rep for ya