21.12.2014, 18:16
Hey guys im a bit stuck, i am making a hunger system, but when i use /eat it puts my hunger over the MAX_HUNGER limit. could someone show me what i am doing wrong? i will +rep the person who can help fix this.
Here's my code (i have more to it but will only show if needed).
Thank you guys in advance
Here's my code (i have more to it but will only show if needed).
pawn Код:
#define MAX_HUNGER 100.0
enum PlayerInfo
{
Float:Hunger
}
new pInfo[MAX_PLAYERS][PlayerInfo];
CMD:eat(playerid, params [])
{
if(pInfo[playerid][Hunger] >= MAX_HUNGER) return SendClientMessage(playerid, -1, "You Are Full!");
if(pInfo[playerid][Food] < 1) return SendClientMessage(playerid, -1, "You do not have enough food to eat, use /buyfood to buy some food");
pInfo[playerid][Hunger] += 5;
pInfo[playerid][Food] -= 1;
SendClientMessage(playerid, -1, "You have Eaten and restored your hunger by 5");
return 1;
}


