mercredi 13 juillet 2016

Need some idea for textlabel

Problem 1:
I have an idea about mask system, when player using mask, It will disable their nametag to other player. Ok I have complete it, but I need to add Health and Armor (Because It's good for Roleplay and detect hacker). This is my simple code.

Code:

public OnPlayerConnect(playerid)
{
new Float:health, Float:armour;
        GetPlayerHealth(playerid, health);
        GetPlayerArmour(playerid, armour);
        if(PlayerInfo[playerid][pDangdeomask] == 1)
        {
            new string[128];
                masknamelabel[playerid] = Create3DTextLabel(" ",0x9ACD32AA,30.0,40.0,50.0,15.0,0);
                format(string,sizeof(string),"Stranger #%d\nHealth: %d, Armour: %d", GetPlayerSQLId(playerid), GetPlayerHealth(playerid, health), GetPlayerArmour(playerid, armour));
                Update3DTextLabelText(masknamelabel[playerid], 0x9ACD32AA, string);
                Attach3DTextLabelToPlayer(masknamelabel[playerid], playerid, 0.0, 0.0, 0.4);
        }
return 1;
}
But there some bug, when player connect and system detect player is masked. They 3dtextlabel will appear (sometime it disapear), but health and armor is show at record 1.0, In fact they're having more health and armour.
Example: Health: 1.0, Armour: 1.0

Problem 2:
I update 3dtext label when player take damage, it will appear their real health, armour. But it delay the last update about their health, armour.
Example: When player have 100 health and 100 armour, and they got damage from some source (example it will take 10 damage). In fact 3d text label will appear player have 90 health. But in my script, It will appear 100 health, and if they continuous been attack again, It will appear 90 health (But in real, it's 80 health)

Code:

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
        Delete3DTextLabel(masknamelabel[playerid]);
new string[128];
        if(PlayerInfo[playerid][pDangdeomask] == 1)
        {
                GetPlayerHealth(playerid, health);
                GetPlayerArmour(playerid, armour);
                masknamelabel[playerid] = Create3DTextLabel(" ",0x9ACD32AA,30.0,40.0,50.0,15.0,0);
                format(string,sizeof(string),"Nguoi la mat #%d\nMau: %d, Giap: %d", GetPlayerSQLId(playerid), floatround(health), floatround(armour));
                Update3DTextLabelText(masknamelabel[playerid], 0x9ACD32AA, string);
                Attach3DTextLabelToPlayer(masknamelabel[playerid], playerid, 0.0, 0.0, 0.4);
        }
        return 1;
}

This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at http://ift.tt/jcXqJW.
Recommended article from FiveFilters.org: Most Labour MPs in the UK Are Revolting.



Need some idea for textlabel

Aucun commentaire:

Enregistrer un commentaire