Help with hunger system -
ahmedkoki - 05.01.2015
I made a hunger system but I need to make it as percentage and textdraw so each minute it decreases 1 like for example my hunger is 99 next minute it should be 98 and so on...
Here is my script
http://pastebin.com/qJ8db6e2
Re: Help with hunger system -
HY - 05.01.2015
Set a timer every minute under OnFiletScriptInit()
pawn Код:
SetTimerEx("HungyCheck", 60000, true, "i", playerid);
Create function.
pawn Код:
forward HungryCheck();
public HungryCheck()
{
// YourVariableForHungy--;
return 1;
}
At your variable for hungry add your variable, but add "--" without " ". Because this will increase hungry with -1.
pawn Код:
public OnPlayerUpdate(playerid)
{
new text[4];
format(text, sizeof(text), "%d", YourHungryVariable);
TextDrawSetString(Hungy[playerid], text);
return 1;
}
This function under OnPlayerUpdate() will check how many hunger you are, and will display hunger on player's screens.
Replace all YourHungyVariable.
Re: Help with hunger system -
Clad - 05.01.2015
You can use ProgressBar include too
Re: Help with hunger system -
ahmedkoki - 05.01.2015
Quote:
Originally Posted by Clad
You can use ProgressBar include too
|
Can I use it to make percentage textdraw?
Re: Help with hunger system -
HY - 05.01.2015
Progress bar will create a bar. Wich can increase/decrease.
https://sampforum.blast.hk/showthread.php?tid=113443
Re: Help with hunger system -
MrCallum - 05.01.2015
He said can you make a percentage bar not a progress bar...
Re: Help with hunger system -
Schneider - 05.01.2015
@HY: Why don't you put the textdraw-update in that same timer, instead of under OnPlayerUpdate?
The variable gets changed once a minute, there's no need to update the textdraws 50 times a seconds...
Re: Help with hunger system -
ahmedkoki - 05.01.2015
When I put the hungry variable it gives me this error
Код:
.pwn(45) : error 022: must be lvalue (non-constant)
.pwn(45) : warning 215: expression has no effect
at this line
Код:
forward HungryCheck();
public HungryCheck()
{
thing --;
return 1;
}
Re: Help with hunger system -
HY - 05.01.2015
My foult:
pawn Код:
forward HungryCheck(playerid);
public HungryCheck(playerid)
{
thing --;
return 1;
}
Re: Help with hunger system -
Schneider - 05.01.2015
[removed]