[Question] Removing Player Name Tags
#1

Hello there,
I removed player name tags with this function
Код:
    {
    ShowNameTags(0);
}
So,my question is how can i make armour & health visible but not the names...


Regards,
Reply
#2

You can't hide or show the health or armor with any functions, but you can always do it this way:

pawn Код:
new Text3D:gHealthArmor[MAX_PLAYERS];
new Float:gFloatVars[MAX_PLAYERS][2];

public OnPlayerConnect(playerid)
{
    gHealthArmor[playerid] = Create3DTextLabel("{FFFF00}Armor:{FFFFFF} 0.0\n{FF0000}Health:{FFFFFF} 100.0", -1, 0.0, 0.0, 0.0, 20.0, 0);
    Attach3DTextLabelToPlayer(gHealthArmor[playerid], playerid, 0.0, 0.0, 0.54);
   
    gFloatVars[playerid][0] = 100.0; // Health
    gFloatVars[playerid][1] = 0.0; // Armor
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new
        string[64],
        Float:health,
        Float:armor;

    GetPlayerHealth(playerid, health);
    GetPlayerArmour(playerid, armor);
   
    if (floatcmp(health, gFloatVars[playerid][0]) != 0 || floatcmp(armor, gFloatVars[playerid][1]) != 0)
    {
        format(string, sizeof(string), "{FFFF00}Armor:{FFFFFF} %.1f\n{FF0000}Health:{FFFFFF} %.1f", gFloatVars[playerid][0], gFloatVars[playerid][1]);
        Update3DTextLabelText(gHealthArmor[playerid], -1, string);
    }
    return 1;
}
Reply
#3

when i try to put this
Код:
public OnPlayerConnect(playerid)
{
    gHealthArmor[playerid] = Create3DTextLabel("{FFFF00}Armor:{FFFFFF} 0.0\n{FF0000}Health:{FFFFFF} 100.0", -1, 0.0, 0.0, 0.0, 20.0, 0);
    Attach3DTextLabelToPlayer(gHealthArmor[playerid], playerid, 0.0, 0.0, 0.54);
    
    gFloatVars[playerid][0] = 100.0; // Health
    gFloatVars[playerid][1] = 0.0; // Armor
    return 1;
}
Next line is unreachable code

Example
Код:
public OnPlayerConnect(playerid)
{
{
    gHealthArmor[playerid] = Create3DTextLabel("{FFFF00}Armor:{FFFFFF} 0.0\n{FF0000}Health:{FFFFFF} 100.0", -1, 0.0, 0.0, 0.0, 20.0, 0);
    Attach3DTextLabelToPlayer(gHealthArmor[playerid], playerid, 0.0, 0.0, 0.54);

    gFloatVars[playerid][0] = 100.0; // Health
    gFloatVars[playerid][1] = 0.0; // Armor
    return 1;
}
	// • Removed Objects for Bloodz HQ
	RemoveBuildingForPlayer(playerid, 3831, -2688.7266, 193.3125, 7.8672, 0.25);
	RemoveBuildingForPlayer(playerid, 3835, -2678.7266, 194.6953, 6.6094, 0.25);
	RemoveBuildingForPlayer(playerid, 3836, -2669.4453, 196.2969, 8.0313, 0.25);
	RemoveBuildingForPlayer(playerid, 3841, -2651.3203, 196.7578, 8.0313, 0.25);
	RemoveBuildingForPlayer(playerid, 3846, -2660.3828, 195.3672, 9.5313, 0.25);
	RemoveBuildingForPlayer(playerid, 3820, -2688.7266, 193.3125, 7.8672, 0.25);
	RemoveBuildingForPlayer(playerid, 1446, -2683.8047, 202.3203, 4.1328, 0.25);
Reply
#4

Put it to this:

Quote:

public OnPlayerConnect(playerid)
{
{
gHealthArmor[playerid] = Create3DTextLabel("{FFFF00}Armor:{FFFFFF} 0.0\n{FF0000}Health:{FFFFFF} 100.0", -1, 0.0, 0.0, 0.0, 20.0, 0);
Attach3DTextLabelToPlayer(gHealthArmor[playerid], playerid, 0.0, 0.0, 0.54);

gFloatVars[playerid][0] = 100.0; // Health
gFloatVars[playerid][1] = 0.0; // Armor
return 1;
}
// • Removed Objects for Bloodz HQ
RemoveBuildingForPlayer(playerid, 3831, -2688.7266, 193.3125, 7.8672, 0.25);
RemoveBuildingForPlayer(playerid, 3835, -2678.7266, 194.6953, 6.6094, 0.25);
RemoveBuildingForPlayer(playerid, 3836, -2669.4453, 196.2969, 8.0313, 0.25);
RemoveBuildingForPlayer(playerid, 3841, -2651.3203, 196.7578, 8.0313, 0.25);
RemoveBuildingForPlayer(playerid, 3846, -2660.3828, 195.3672, 9.5313, 0.25);
RemoveBuildingForPlayer(playerid, 3820, -2688.7266, 193.3125, 7.8672, 0.25);
RemoveBuildingForPlayer(playerid, 1446, -2683.8047, 202.3203, 4.1328, 0.25);
return 1

;
}
Reply
#5

That happens because you basically have empty braces which have no effect. So basically; 'return 1;' will always be called.
pawn Код:
public OnPlayerConnect(playerid)
{
    gHealthArmor[playerid] = Create3DTextLabel("{FFFF00}Armor:{FFFFFF} 0.0\n{FF0000}Health:{FFFFFF} 100.0", -1, 0.0, 0.0, 0.0, 20.0, 0);
    Attach3DTextLabelToPlayer(gHealthArmor[playerid], playerid, 0.0, 0.0, 0.54);

    gFloatVars[playerid][0] = 100.0; // Health
    gFloatVars[playerid][1] = 0.0; // Armor
    // • Removed Objects for Bloodz HQ
    RemoveBuildingForPlayer(playerid, 3831, -2688.7266, 193.3125, 7.8672, 0.25);
    RemoveBuildingForPlayer(playerid, 3835, -2678.7266, 194.6953, 6.6094, 0.25);
    RemoveBuildingForPlayer(playerid, 3836, -2669.4453, 196.2969, 8.0313, 0.25);
    RemoveBuildingForPlayer(playerid, 3841, -2651.3203, 196.7578, 8.0313, 0.25);
    RemoveBuildingForPlayer(playerid, 3846, -2660.3828, 195.3672, 9.5313, 0.25);
    RemoveBuildingForPlayer(playerid, 3820, -2688.7266, 193.3125, 7.8672, 0.25);
    RemoveBuildingForPlayer(playerid, 1446, -2683.8047, 202.3203, 4.1328, 0.25);
@xXSPRITEXx: That will do the exact same thing.
Reply
#6

Aaaaaa Thanks EiresJason and Emmet_ REP++
xXSPRITEXx - I tryed like that already beffore i posted

Now one more thing,on update of Armour/Health everyone health is 100 and armour 0.0 even if i set my health to 10 it's say 100 so something is wrong with Update
Reply
#7

Np
Try this.

pawn Код:
public OnPlayerUpdate(playerid)
{
    new
        string[64],
        Float:health,
        Float:armor;

    GetPlayerHealth(playerid, health);
    GetPlayerArmour(playerid, armor);
   
    if (floatcmp(health, gFloatVars[playerid][0]) != 0 || floatcmp(armor, gFloatVars[playerid][1]) != 0)
    {
        format(string, sizeof(string), "{FFFF00}Armor:{FFFFFF} %.1f\n{FF0000}Health:{FFFFFF} %.1f", armor, health);
        Update3DTextLabelText(gHealthArmor[playerid], -1, string);
    }
    return 1;
}
Reply
#8

Still same health 100.0 and armour 0.0
Reply
#9

Oh, maybe this will work as it directly updates the HP+Armour, without checking for anything.
pawn Код:
public OnPlayerUpdate(playerid)
{
    new
        string[64],
        Float:health,
        Float:armor;

    GetPlayerHealth(playerid, health);
    GetPlayerArmour(playerid, armor);
   
        format(string, sizeof(string), "{FFFF00}Armor:{FFFFFF} %.1f\n{FF0000}Health:{FFFFFF} %.1f", armor, health);
        Update3DTextLabelText(gHealthArmor[playerid], -1, string);
    return 1;
}
Reply
#10

Still same,btw i noticed till i uploaded gm i was wait to /gmx and some update was happen but on a sec armour was show 82 to player when he came back from afk and he had 82 i had 52 armour and it was show 52 but just froozed at that 82 and 52 thats all if i was shoot still player nothing happend he lose armour but wasn't update

Код:
public OnPlayerUpdate(playerid)
{
    new
        string[64],
        Float:health,
        Float:armor;

    GetPlayerHealth(playerid, health);
    GetPlayerArmour(playerid, armor);
    
    if (floatcmp(health, gFloatVars[playerid][0]) != 0 || floatcmp(armor, gFloatVars[playerid][1]) != 0)
    {
        format(string, sizeof(string), "{FFFF00}Armor:{FFFFFF} %.1f\n{FF0000}Health:{FFFFFF} %.1f", armor, health);
        Update3DTextLabelText(gHealthArmor[playerid], -1, string);
    }
    return 1;
}
And with last one same thing like beffore 100.0 and armour 0.0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)