Errorz...(REP+)
#5

This loop should be placed under a timer of your choice.
pawn Код:
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:health, string[128];
        GetPlayerHealth(playerid, health);
        if(GetProgressBarValue(hungry[playerid]) > 0)
        {
            SetProgressBarValue(hungry[playerid], GetProgressBarValue(hungry[playerid]) - 1)
            if(GetProgressBarValue(hungry[playerid] <= 50) // Player Less Then 50% Hunger Display Message?
            {
                format(string, 128, "* %s starts feeling hungry.", RPN(playerid));
                SendClientMessage(playerid, COLOR_HUNGRY, "You are hungry, go and eat something.");
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE);
            }
        }
        else // Player Starving Deduct Health?
        {
            SetPlayerHealth(playerid, health-5);
            format(string, 128, "* %s is starving.", RPN(playerid));
            SendClientMessage(playerid, COLOR_HUNGRY, "You are starving. You need to eat something.");
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE);
        }
    }
}
I am assuming you want something like that.

The above code has not be compiled or tested.
Reply


Messages In This Thread
Errorz...(REP+) - by bloodrocklee - 08.08.2012, 04:29
Re: Errorz...(REP+) - by AustinJ - 08.08.2012, 04:39
Re: Errorz...(REP+) - by bloodrocklee - 08.08.2012, 04:42
Re: Errorz...(REP+) - by Devilxz97 - 08.08.2012, 04:53
Re: Errorz...(REP+) - by AustinJ - 08.08.2012, 04:55
Re: Errorz...(REP+) - by bloodrocklee - 08.08.2012, 04:58
Re: Errorz...(REP+) - by AustinJ - 08.08.2012, 05:04
Re: Errorz...(REP+) - by bloodrocklee - 08.08.2012, 05:19
Re: Errorz...(REP+) - by bloodrocklee - 08.08.2012, 05:23
Re: Errorz...(REP+) - by Devilxz97 - 08.08.2012, 05:27

Forum Jump:


Users browsing this thread: 1 Guest(s)