Timer Help [REP ++]
#2

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


Messages In This Thread
Timer Help [REP ++] - by ScripteRMKD - 07.01.2014, 23:41
Re: Timer Help [REP ++] - by erminpr0 - 08.01.2014, 00:26
Re: Timer Help [REP ++] - by ScripteRMKD - 15.01.2014, 19:30

Forum Jump:


Users browsing this thread: 1 Guest(s)