08.02.2015, 12:25
code:
public HungerProgressBar(playerid)
{
if(Hunger[playerid] == 0)
{
KillTimer(progressUpdater[playerid]);
healthUpdater[playerid] = SetTimer("LoseHealth", 1000, true); // Losing 5 HP every one second, it's recommended you change this
}
else if(Hunger[playerid] > 0)
{
Hunger[playerid] -= 5;
SetPlayerProgressBarValue(playerid, HungerBar[playerid], Hunger[playerid]);
UpdatePlayerProgressBar(playerid, HungerBar[playerid]);
}
return 1;
}
error:
i have progress2.inc
thanks
public HungerProgressBar(playerid)
{
if(Hunger[playerid] == 0)
{
KillTimer(progressUpdater[playerid]);
healthUpdater[playerid] = SetTimer("LoseHealth", 1000, true); // Losing 5 HP every one second, it's recommended you change this
}
else if(Hunger[playerid] > 0)
{
Hunger[playerid] -= 5;
SetPlayerProgressBarValue(playerid, HungerBar[playerid], Hunger[playerid]);
UpdatePlayerProgressBar(playerid, HungerBar[playerid]);
}
return 1;
}
PHP код:
public LoseHealth(playerid)
{
new Float: health;
hbHealth[playerid] -= 5;
SetPlayerHealth(playerid, hbHealth[playerid]);
if(GetPlayerHealth(playerid, health) == 0) KillTimer(healthUpdater[playerid]);
return 1;
}
PHP код:
public OnPlayerSpawn(playerid)
{
//=====[PlayerSettings]
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
SetTimerEx("ucitavanjeobjekatatd", 50, false, "i", playerid);
Hunger[playerid] = 100, hbHealth[playerid] = 100;
HungerBar[playerid] = CreatePlayerProgressBar(playerid, 547.5, 58.0, 59.0, 5, 0x52875AFF, 100.0);
ShowPlayerProgressBar(playerid, HungerBar[playerid]);
SetPlayerProgressBarValue(playerid, HungerBar[playerid], 100);
UpdatePlayerProgressBar(playerid, HungerBar[playerid]);
progressUpdater[playerid] = SetTimer("HungerProgressBar", 1000, true); // 1000 = 1 second, change this to whatever time you want
return 1;
}
PHP код:
new PlayerBar:HungerBar[MAX_PLAYERS];
new progressUpdater[MAX_PLAYERS];
new healthUpdater[MAX_PLAYERS];
new Hunger[MAX_PLAYERS];
new hbHealth[MAX_PLAYERS];
Код:
error 017: undefined symbol "UpdatePlayerProgressBar"
thanks