13.04.2010, 00:42
My script has where player can visit hospital but when the player is in the hospital he stays for 1 second then he spawn to regular spot he suposed to spawn to outside the hospital any help please....Heres my code...
forward
OnPlayerDeath
Public
forward
Код:
forward ReleaseFromHospital(playerid);
Код:
public OnPlayerDeath(playerid, killerid, reason) { new rand; new string[256]; new cut = deathcost; //PlayerInfo[playerid][pLevel]*deathcost; PlayerInfo[playerid][pDeaths] += 1; GivePlayerMoney(playerid, -cut); format(string, sizeof(string), "DOC: Your Medical Bill comes to $%d, Have a nice day.", cut); SendClientMessage(playerid, TEAM_CYAN_COLOR, string); PlayerInfo[playerid][pDeaths] += 1; SetPlayerHealth(playerid, 100); SetPlayerInterior(playerid, 18); rand = random(sizeof(gMedicSpawns)); SetPlayerPos(playerid, gMedicSpawns[rand][0], gMedicSpawns[rand][1], gMedicSpawns[rand][2]); // Warp the player SetPlayerFacingAngle(playerid, 270.0); TogglePlayerControllable(playerid, 0); GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~You need to rest now ...", 5000, 3); SetTimerEx("ReleaseFromHospital", 10000, 0, "d", playerid); PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0); SetPlayerColor(playerid,COLOR_GRAD2); return 1; }
Код:
public ReleaseFromHospital(playerid) { SendClientMessage(playerid, COLOR_RED, "You have been released from Hospital."); TogglePlayerControllable(playerid, 1); SetCameraBehindPlayer(playerid); SetPlayerHealth(playerid, 50.0); new decidehosp = random(2); switch(decidehosp) { case 0: { SetPlayerPos(playerid, 1177.4866,-1323.9749,14.0731); SetPlayerFacingAngle(playerid, 270.0); SetPlayerInterior(playerid, 0); ResetPlayerWeapons(playerid); } case 1: { SetPlayerPos(playerid, 2025.1497,-1402.8643,17.2089); SetPlayerFacingAngle(playerid, 270.0); SetPlayerInterior(playerid, 0); ResetPlayerWeapons(playerid); } } return 1; }