01.03.2012, 23:37
Hi there! I made a hunger system and it works perfectly, Just one lil bug that sometimes appears.
Every 2 minuts your hunger goes up by 1 point, but sometimes it keeps stuck on one number but it still keeps counting!
So it would then show like 10 and 12 together at the same time, and 2 minuts later it would show "10 and 13" together at the same time,
Any idea what is going wrong?
OnPlayerSpawn(playerid)
thanks for the help and please dont use the script
Every 2 minuts your hunger goes up by 1 point, but sometimes it keeps stuck on one number but it still keeps counting!
So it would then show like 10 and 12 together at the same time, and 2 minuts later it would show "10 and 13" together at the same time,
Any idea what is going wrong?
OnPlayerSpawn(playerid)
pawn Код:
FoodText[playerid] = TextDrawCreate(246, 350, "");
TextDrawFont(FoodText[playerid],1); //font type of textdraw
TextDrawLetterSize(FoodText[playerid],0.799999,1.900000); //size...
TextDrawColor(FoodText[playerid],COLOR_ORANGE); //color
format(string54, sizeof(string54), "Hunger: %d", PlayerInfo[playerid][Food]);
TextDrawSetString(FoodText[playerid],string54);
KillTimer(FoodTimer[playerid]);
FoodTimer[playerid] = SetTimerEx("Food_Down", 120000, true, "i", playerid);
TextDrawShowForPlayer(playerid, FoodText[playerid]);
pawn Код:
forward Food_Down(playerid);
public Food_Down(playerid)
{
if(PlayerInfo[playerid][Food] < 100)
{
PlayerInfo[playerid][Food] = PlayerInfo[playerid][Food] + 1;
new string[64];
format(string,sizeof(string), "Hunger: %d", PlayerInfo[playerid][Food]);
TextDrawSetString(FoodText[playerid],string);
return 1;
}
if(PlayerInfo[playerid][Food] > 90 && PlayerInfo[playerid][Food] < 100)
{
//Not need to be shown
return 1;
}
if(PlayerInfo[playerid][Food] >= 100)
{
//Not need to be shown
}
return 1;
}
thanks for the help and please dont use the script


