Death system help
#9

because the player already dead you are just stopping the player from respawning with TogglePlayerControllable(playerid, 0); thats why when you use /revive command and set it back to normal player spawn to another position if you want the player to spawn in same position you need to create global variables to store player injured position and another variable to check if the player has been revived:

Код:
new Revived[MAX_PLAYERS];
new Float:InjurLastX[MAX_PLAYERS];
new Float:InjurLastY[MAX_PLAYERS];
new Float:InjurLastZ[MAX_PLAYERS];

//under oonplayerdeath replace these lines
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);

//to these
GetPlayerPos(playerid, InjurLastX[playerid], InjurLastY[playerid], InjurLastZ[playerid]);
SetPlayerPos(playerid, InjurLastX[playerid], InjurLastY[playerid], InjurLastZ[playerid]);


//under onplayerspawn put this code
if(Revived[playerid]== 1) //checks if the player has been revived
{
 	SetPlayerPos(playerid, InjurLastX[playerid], InjurLastY[playerid], InjurLastZ[playerid]); //if yes then sets player position to the last injured position
}

//in /revive command put add this line it confirms that the player has been revived
Revived[playerid] = 1;
Reply


Messages In This Thread
Death system help - by silverms - 31.12.2016, 11:58
Re: Death system help - by dakata994 - 31.12.2016, 12:03
Re: Death system help - by silverms - 31.12.2016, 12:09
Re: Death system help - by dakata994 - 31.12.2016, 12:13
Re: Death system help - by silverms - 31.12.2016, 12:31
Re: Death system help - by silverms - 31.12.2016, 12:38
Re: Death system help - by silverms - 31.12.2016, 13:22
Re: Death system help - by silverms - 31.12.2016, 14:04
Re: Death system help - by lackmail - 31.12.2016, 14:05
Re: Death system help - by silverms - 31.12.2016, 21:12

Forum Jump:


Users browsing this thread: 1 Guest(s)