Hp bar help!
#1

I have this ->
PHP код:
new Text:Health[MAX_PLAYERS];
new 
Text:Armour[MAX_PLAYERS];
         
Health[i] = TextDrawCreate(566.0,67.0,"100%");
         
TextDrawBackgroundColor(Health[i],255);
         
TextDrawFont(Health[i],1);
         
TextDrawLetterSize(Health[i],0.219,0.89);
         
TextDrawColor(Health[i],COLOR_RED);
         
TextDrawSetOutline(Health[i],1);
         
TextDrawSetProportional(Health[i],1);
        
        
Armour[i] = TextDrawCreate(566.0,44.0,"100%");
        
TextDrawBackgroundColor(Armour[i],255);
        
TextDrawFont(Armour[i],1);
        
TextDrawLetterSize(Armour[i],0.219,0.89);
        
TextDrawColor(Armour[i],COLOR_WHITE);
        
TextDrawSetOutline(Armour[i],1);
        
TextDrawSetProportional(Armour[i],1);
            
SetTimer("vitals",1000,1);
public 
OnPlayerSpawn(playerid)
{
    
TextDrawShowForPlayer(playeridHealth[playerid]);
public 
OnPlayerUpdate(playerid)
{
    new 
Float:pArmour;
    
GetPlayerArmour(playerid,pArmour);
    if(
pArmour == 0)
    {
        
TextDrawHideForPlayer(playerid,Armour[playerid]);
    }
    else
    {
        
TextDrawShowForPlayer(playerid,Armour[playerid]);
    }
forward vitals(playerid);
public 
vitals(playerid)
{
    new 
string[5];
    new 
Float:pHealth,Float:pArmour;
    
GetPlayerHealth(playerid,pHealth);
    
GetPlayerArmour(playerid,pArmour);
     
format(string,sizeof(string),"%.0f%",pHealth);
    
TextDrawSetString(Health[playerid],string);
    
format(string,sizeof(string),"%.0f%",pArmour);
    
TextDrawSetString(Armour[playerid],string);

Everything is working well but i tested with friend. first who connects it works for him but second who connectes the 100% doesn't change when i shoot him what is missing?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)