Hunger
#1

I have a hunger and restaurant system. For example I have 95% of hunger. I can buy food that gives 1-5% of hunger. And if I buy food that gives 6-20%, it is supposed to pop out a message that I should choose other food. How to make?
Example:
I have 75% hunger.
I can buy food that gives 1-25% of hunger(Max.100% of hunger), not 26%
Reply
#2

So it isn't really unclear what you want but:

You should simply store a variable that contains the amount of food and perhaps a timer that removes the amount of food everytime some time has passed.

Then, you can make a function GetPlayerHunger() in which you check the variable and return the amount of hunger.

After that you check if when he's buying amounts of food that give higher than his possible maximum amount
(playerHunger > selectedOption) and if it is, you simply show a dialog.
Reply
#3

To use: Player[playerid][Hunger];
I have this code:
Код:
if(listitem == 0)
{
	if(GetPlayerMoney(playerid) >= 5)
	{
		GivePlayerMoney(playerid, -5);
		Player[playerid][Hunger] = Player[playerid][Hunger] + 10;
	}
	else
	{
		return SendClientMessage(playerid, -1, "You can not afford this dish!");
	}
}
Reply
#4

@ref
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)