SA-MP Forums Archive
Timer Help [REP ++] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer Help [REP ++] (/showthread.php?tid=486277)



Timer Help [REP ++] - ScripteRMKD - 07.01.2014

Hi Scripterzz.I need problem with my hospital system.When i /exit but im in Hospital becouse im dead and /exit and Send me message You can't exit now Remaining: 150 sec and how can i make to send me a message You cant exit now Remaining: Secounds remained for Hospital ?? Ex. /time - 46 secounds and when i /exit to send me Remaining: 50 secounds and go down


Re: Timer Help [REP ++] - erminpr0 - 08.01.2014

Wha'the hell ??

If I understood you, you want to make this:

When player dies, he goes to hospital, and he can't exit it during 150 seconds is running out?

#if yes

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SetPVarInt(playerid, "Dead", 1);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(GetPVarInt(playerid, "Dead") == 1)
    {
        HospitalTimer[playerid] = SetTimerEx("HospTime", 1000, true, "d", playerid);
        SetPVarInt(playerid, "HospitalTime", 150);
        SetPVarInt(playerid, "Dead", 0);
    }
    return 1;
}

forward HospTime(playerid);
public HospTime(playerid)
{
    if(GetPVarInt(playerid, "HospitalTime") > 0)
    {
        SetPVarInt(playerid, "HospitalTime", GetPVarInt(playerid, "HospitalTime") - 1);
    }
    else KillTimer(HospitalTimer[playerid]);
}

YCMD:exit(playerid, params[], help)
{
    if(GetPVarInt(playerid, "HospitalTime") > 0)
    {
        new string_H[27];
        format(string_H, sizeof string_H, "Time left in hospital: %d", GetPvarInt(playerid, "HospitalTime"));
        return SendClientMessage(playerid, 0xFFFFFFFF, string_H);
    }

    SetPlayerPos(playerid, outsidehosp_X, outsidehosp_Y, outsidehosp_Z);
    return 1;
}



Re: Timer Help [REP ++] - ScripteRMKD - 15.01.2014

Hvala )