/mask HP & Armour
#1

I've scripted a mask command and I have a question

Quote:

public OnPlayerUpdate(playerid)
{
if(UsingMask[playerid]==1)
{
new string[124];
new Float:armour;
GetPlayerArmour(playerid, armour);
new Float:health;
GetPlayerHealth(playerid,health);
format(string,sizeof(string), "HP:%0.f Armour:%0.f",health ,armour );
new Text3D:label = Create3DTextLabel(string, COLOR_GREY, 30.0, 40.0, 45.0, 40.0, 0);
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.1);
}
return 1;
}

It looks like this above a player: HP:100.0000000 Armour 100:0000000

How to change it to HP:100 Armour 100?
Reply
#2

%.0f or %d
Reply
#3

thanks worked, but it gets bugged when someone looses help, you see it 2 times above the players name
Reply
#4

Quote:

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
new string[256];
new attacker[MAX_PLAYER_NAME];
GetPlayerName(issuerid, attacker, sizeof (attacker));
format(string, sizeof(string), "-%.0f From %s", amount,attacker);
SetPlayerChatBubble(playerid, string, COLOR_RED, 20.0, 3000);
}
return 1;
}

it? =)
Reply
#5

Quote:
Originally Posted by Zio
Посмотреть сообщение
it? =)
no

//Edit:

Quote:

public OnPlayerUpdate(playerid)
{
if(UsingMask[playerid]==1)
{
new string[124];
new Float:armour;
GetPlayerArmour(playerid, armour);
new Float:health;
GetPlayerHealth(playerid,health);
format(string,sizeof(string), "HP:%.2f Armour:%.2f",health ,armour );
label = Create3DTextLabel(string, COLOR_GREY, 30.0, 40.0, 45.0, 40.0, 0);
}
else
{
Delete3DTextLabel(label);
}
return 1;
}

Fixed it but the health/armour does not update at all it stays the same
Reply
#6

https://sampwiki.blast.hk/wiki/Update3DTextLabelText
Reply
#7

Quote:

public OnPlayerUpdate(playerid)
{
if(UsingMask[playerid]==1)
{
new string[124];
new Float:armour;
GetPlayerArmour(playerid, armour);
new Float:health;
GetPlayerHealth(playerid,health);
format(string,sizeof(string), "HP:%.2f Armour:%.2f",health ,armour );
label = Create3DTextLabel(string, COLOR_GREY, 30.0, 40.0, 45.0, 40.0, 0);
Update3DTextLabelText(label, COLOR_GREY, string);
}
else
{
Delete3DTextLabel(label);
}
return 1;
}

nothing happens
Reply
#8

Give this a shot:

pawn Код:
new Text3D:label[MAX_PLAYERS];
new isusinglabel[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
    if(UsingMask[playerid] == 1)
    {
        new string[124];
        new Float:armour;
        GetPlayerArmour(playerid, armour);
        new Float:health;
        GetPlayerHealth(playerid,health);
        format(string,sizeof(string), "HP:%0.f\nArmour:%0.f", health, armour);
        label[playerid] = Create3DTextLabel(string, COLOR_GREY, 30.0, 40.0, 45.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.1);
        isusinglabel[playerid] = 1;
    }
    else
    {
        if(isusinglabel[playerid] != 0)
        {
            Delete3DTextLabel(label[playerid]);
            isusinglabel[playerid] = 0;
        }
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    isusinglabel[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(isusinglabel[playerid] != 0)
    {
        Delete3DTextLabel(label[playerid]);
        isusinglabel[playerid] = 0;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)