How to make a Healing like in other RP?
#6

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;
}
Reply


Messages In This Thread
How to make a Healing like in other RP? - by Reklez - 25.03.2012, 03:29
Re: How to make a Healing like in other RP? - by Reklez - 25.03.2012, 05:45
Re: How to make a Healing like in other RP? - by Joshb93 - 25.03.2012, 06:25
Re: How to make a Healing like in other RP? - by Reklez - 25.03.2012, 06:31
Re: How to make a Healing like in other RP? - by Joshb93 - 25.03.2012, 06:42
Re : How to make a Healing like in other RP? - by Ultrascipter - 25.03.2012, 08:07
Re: How to make a Healing like in other RP? - by Reklez - 25.03.2012, 08:28
Re: How to make a Healing like in other RP? - by GNGification - 25.03.2012, 08:32
Re : Re: How to make a Healing like in other RP? - by Ultrascipter - 25.03.2012, 18:40

Forum Jump:


Users browsing this thread: 3 Guest(s)