25.03.2012, 08:07
Exact code:
Код:
new HealingTimer[MAX_PLAYERS]; new IsPlayerDead[MAX_PLAYERS]; public OnPlayerConnect(playerid) { IsPlayerDead[playerid] = 0; } public OnPlayerSpawn(playerid) { if(IsPlayerDead[playerid] == 1) { SetPlayerHealth(playerid, 1.0);// If not death SetPlayerVWIPosAng(playerid, 0, 0, 2012.0902,-1451.8118,13.5547,92.7932); SetPlayerCamPosLookAt(playerid, 2010.6136,-1440.9576,13.6466, 2032.8142,-1408.2061,17.1641); TogglePlayerControllable(playerid, 0); HealingTimer[playerid] = SetTimerEx("Healing", 1000, 1, "i", playerid); return 1; } return 1; } public Healing(playerid) { new Float:hp; GetPlayerHealth(playerid, hp); if(hp >= 100.0) { if(GetPlayerMoney(playerid) > 100) { GivePlayerMoney(playerid, -100); SendClientMessage(playerid, COLOR_GREY, "Medical Bills: $100, You pay $100 to the doctor"); } else if(GetPlayerMoney(playerid) < 100) { SendClientMessage(playerid, COLOR_GREY, "The Doctor heals you for free, because you do not have enough money to pay him!"); } SetPlayerVWIPosAng(playerid, 0, 0, 2030.7820,-1407.5547,17.1802,164.7021); SetCameraBehindPlayer(playerid); TogglePlayerControllable(playerid, 1); KillTimer(HealingTimer[playerid]); } SetPlayerHealth(playerid, hp + 1); return 1; } public OnPlayerDeath(playerid, killerid, reason) { IsPlayerDead[playerid] = 1; return 1; }