SA-MP Forums Archive
Death help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Death help (/showthread.php?tid=375758)



Death help - Deaglez - 08.09.2012

OK, how do i make when player died, then spawn in the same last death place?


Re: Death help - vIBIENNYx - 08.09.2012

Add this to the top

pawn Код:
new Float:deathx[MAX_PLAYERS], Float:deathy[MAX_PLAYERS], Float:deathz[MAX_PLAYERS];
new died[MAX_PLAYERS];
Then:

pawn Код:
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.


Re: Death help - Deaglez - 08.09.2012

Thnks, 1 rep for ya