#1

I do not look correct health

I did a timer to run every second ..
SetTimer("System", 1000, true);


PHP код:
forward System( );
public 
System( )
{
    for(new 
0MAX_PLAYERSi++) {
        new 
FloathealthFloatarmour;
        
GetPlayerHealthihealth );
        
GetPlayerArmouriarmour );
        new 
hpstr50 ], apstr50 ];
        
formathpstr50"%d"health );
        
formatapstr50"%d"armour );
        
TextDrawSetStringHealth], hpstr );
        
TextDrawSetStringArmour], apstr ); }
    return 
1;

Reply
#2

May the problem perhaps be that you define health and armour to be explicitly used as floats but you format them as doubles?
Reply
#3

Health, and armour are floats not integers.

pawn Код:
forward System( );
public System( )
{
    for(new i = 0; i < MAX_PLAYERS; i++) {
        new Float: health, Float: armour;
        GetPlayerHealth( i, health );
        GetPlayerArmour( i, armour );
        new hpstr[ 50 ], apstr[ 50 ];
        format( hpstr, 50, "%.0f", health );// %.0f is used to get the aprox. percentage like 100 health , %f will get the accurate health like 99.732 health
        format( apstr, 50, "%.0f", armour );// %f
        TextDrawSetString( Health[ i ], hpstr );
        TextDrawSetString( Armour[ i ], apstr ); }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)