UpdatePlayerProgressBar error
#1

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;
}

PHP код:
public LoseHealth(playerid)
{
    new 
Floathealth;
    
hbHealth[playerid] -= 5;
    
SetPlayerHealth(playeridhbHealth[playerid]);
    if(
GetPlayerHealth(playeridhealth) == 0)    KillTimer(healthUpdater[playerid]);
    return 
1;

PHP код:
public OnPlayerSpawn(playerid)
{
    
//=====[PlayerSettings]
    
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
    
SetPlayerArmour(playeridPlayerInfo[playerid][pArmour]);
    
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
       
SetTimerEx("ucitavanjeobjekatatd"50false"i"playerid);
       
    
Hunger[playerid] = 100hbHealth[playerid] = 100;
    
HungerBar[playerid] = CreatePlayerProgressBar(playerid547.558.059.050x52875AFF100.0);
    
ShowPlayerProgressBar(playeridHungerBar[playerid]);
    
SetPlayerProgressBarValue(playeridHungerBar[playerid], 100);
    
UpdatePlayerProgressBar(playeridHungerBar[playerid]);
    
progressUpdater[playerid] = SetTimer("HungerProgressBar"1000true); // 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:
Код:
error 017: undefined symbol "UpdatePlayerProgressBar"
i have progress2.inc

thanks
Reply
#2

I just visited the progress2 include thread, i didn't see any UpdatePlayerProgressBar function, you might have wanted to use UpdateProgressBar?
Quote:
UpdateProgressBar(barid, playerid=INVALID_PLAYER_ID)

Everytime you change a progress bar value or color, you need to update it. I didn't include this function directly in SetProgressBarValue/SetProgressBarColor, because it's not efficient in this way.
You can simply not use the playerid parameter, and the progress bar will update for everyone.

Reply
#3

well, you dont need to use UpdatePlayerProgressBar after setting value, it's updating automatically.
delete lines with:
Код:
UpdatePlayerProgressBar(playerid, HungerBar[playerid]);
and it should work.
Reply
#4

use

https://github.com/Southclaw/PlayerProgressBar
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)