Hunger Update -
ShoortyFl - 28.10.2014
Can somebody please tell me what is wrong with this, it should be 100% in textdraw
OnPlayerSpawn
Code:
if(ServerLoading[playerid] == 1)
{
SetTimerEx("ServerLoad", 7000, false, "d", playerid);
SetTimerEx("Hungry", 600000, 1, "i", playerid);
SCM(playerid, WHITE, "Server loading, please wait...");
}
Server Load
Code:
public ServerLoad(playerid)
{
ServerLoading[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
SCM(playerid, WHITE, "Server loaded...");
return 1;
}
Hungry Timer
Code:
public Hungry(playerid)
{
new Float:helt;
GetPlayerHealth(playerid, helt);
if(CurHealth[playerid] >= helt)
{
SCM(playerid, WHITE, "You're hungry, you should eat.");
SetPlayerHealth(playerid, helt-5);
CurHealth[playerid] = helt;
}
else
{
CurHealth[playerid] = helt;
}
}
OnPlayerUpdate
format(str2, sizeof(str), "Hunger: %d%", CurHealth[playerid]);
TextDrawSetString(PHunger[playerid], str2);
it shows textdraw but it's 0% not 100
Re: Hunger Update -
ShoortyFl - 28.10.2014
I fixed that, but now whats bothering me is showing that, it only saves in float, and float shows in textdraw like 100.00000 % how can i make it only show 100 %
Re: Hunger Update -
Quickie - 28.10.2014
down
down down
down
Re: Hunger Update -
Quickie - 28.10.2014
try this
pawn Code:
format(str2, sizeof(str2), "Hunger: %.0f%%", CurHealth[playerid]);// or %.f
TextDrawSetString(PHunger[playerid], str2);
Re: Hunger Update -
ShoortyFl - 28.10.2014
I've fixed it with floadround, but i've got another problem, now this
pawn Code:
if(CurHealth[playerid] >= helt)
{
SCM(playerid, WHITE, "You're hungry, you should eat.");
SetPlayerHealth(playerid, helt-5);
CurHealth[playerid] = helt;
}
Shows me that i'm hungry, even if my health is 100 or 95.
Re: Hunger Update -
ShoortyFl - 28.10.2014
Anyone ? It's pretty urgent
Re: Hunger Update -
ShoortyFl - 28.10.2014
Anyone ?
Re: Hunger Update -
ShoortyFl - 28.10.2014
So i think i got it, how can i convert this - 3 into float, because Hunger is defined as float in enum...
pawn Code:
public Hunger(playerid)
{
new Float:helt;
GetPlayerHealth(playerid, helt);
if(PI[playerid][Hunger] < 20)
{
SCM(playerid, WHITE, "You're hungry, you should eat.");
SetPlayerHealth(playerid, helt-3);
PI[playerid][Hunger] -= 3;
}
else
{
PI[playerid][Hunger] -= 3;
}
}
When i put it like this it shows 13171343% not 100 % or 65 %
Re: Hunger Update -
Quickie - 29.10.2014
THIS WILL FIX UR FLOAT FORMAT PROBLEM !
Quote:
try this
pawn Code:
format(str2, sizeof(str2), "Hunger: %.0f%%", CurHealth[playerid]);// or %.f TextDrawSetString(PHunger[playerid], str2);
|