04.02.2014, 11:51
I'm trying to make the player spawn with an animation at the location where he died like in most of RP servers but the first time I die I get the CJ skin and I have to press spawn and then I will spawn with the animation but when I kill myself again I don't spawn at the hospital but I respawn at the location where I died.
This is my code
This is my code
Код:
new IsInjured[MAX_PLAYERS] = 0; new HospitalSpawn[MAX_PLAYERS] = 0;
Код:
stock SetPlayerSpawn(playerid) { if(IsInjured[playerid] == 1 && HospitalSpawn[playerid] == 0) { GameTextForPlayer(playerid, "~r~Injured", 5000, 3); ClearAnimations(playerid); //TogglePlayerControllable(playerid,0); SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid,0); SetPlayerPos(playerid, PlayerVar[playerid][LastPos][0], PlayerVar[playerid][LastPos][1], PlayerVar[playerid][LastPos][2]); ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0); HospitalSpawn[playerid] = 1; IsInjured[playerid] = 0; } if(HospitalSpawn[playerid] == 1) { SetCameraBehindPlayer(playerid); SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0); SetPlayerHealth(playerid, 55); SetPlayerArmour(playerid, 0); SetSpawnInfo(playerid, 0, PlayerVar[playerid][Skin], 1177.3965, -1323.7709, 14.0686, 0, 0, 0, 0, 0, 0, 0); SendClientMessage(playerid, COL_GREY, "NOTICE: You have been injured and immediately sent to the hospital for treatment"); SendClientMessage(playerid, COL_GREY, "(( OOC NOTICE: You have lost 30 minutes of your memory, to prevent Revenge Killing ))"); HospitalSpawn[playerid] = 0; } return 1; } public OnPlayerSpawn(playerid) { StopLoopingAnim(playerid); SetPlayerSkin(playerid, PlayerVar[playerid][Skin]); TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date); SetPlayerSpawn(playerid); return 1; } public OnPlayerDeath(playerid, killerid, reason) { new Float:Posx,Float:Posy,Float:Posz; GetPlayerPos(playerid, Posx, Posy, Posz); PlayerVar[playerid][LastPos][0] = Posx; PlayerVar[playerid][LastPos][1] = Posy; PlayerVar[playerid][LastPos][2] = Posz; if(IsInjured[playerid] == 0 && HospitalSpawn[playerid] == 0) { IsInjured[playerid] = 1; } return 1; }