31.12.2016, 14:05
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;