Create3DTextLabel Issues
#1

I'm having an issue with this function. Basically, when the player types the /badge command, it will create a 3D text label and position it above the player for everybody to see, with their group and rank.

If the on duty variable is 1, then it displays it, if not, then it deletes it. The issue I have, is that with the following code, it deletes all text labels for every player, when you turn your badge off.

If the player logs out, and another player logs in with the same ID, they will have the label above them even if they aren't in a group or anything.

What's the best way to solve this issue?

pawn Код:
stock SetPlayerToTeamColor(playerid)
{
   
    if(IsPlayerConnected(playerid))
    {
        new Text3D:playergroupid[MAX_PLAYERS];
       
        if(PlayerInfo[playerid][pWantedLevel] > 0) {
            SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWantedLevel]);
        }
        else if((PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pTaxiLicense] == 1) && TransportDuty[playerid] != 0) {
            SetPlayerColor(playerid,TEAM_TAXI_COLOR);
        }
            else if(0 <= PlayerInfo[playerid][pMember] < MAX_GROUPS && PlayerInfo[playerid][pDuty])
        {
            Delete3DTextLabel(playergroupid[playerid]);
            new string[128], employer[GROUP_MAX_NAME_LEN], rank[GROUP_MAX_RANK_LEN], division[GROUP_MAX_DIV_LEN];
            GetPlayerGroupInfo(playerid, rank, division, employer);
            format(string, sizeof(string), "{%s}**%s %s**", Group_NumToDialogHex(arrGroupData[PlayerInfo[playerid][pMember]][g_hDutyColour]), employer, rank);
           
            playergroupid[playerid] = Create3DTextLabel(string, COLOR_WHITE, 30.0, 40.0, 50.0, 40.0, 0, 0);
            Attach3DTextLabelToPlayer(playergroupid[playerid], playerid, 0.0, 0.0, 0.20);
           
            //SetPlayerColor(playerid, arrGroupData[PlayerInfo[playerid][pMember]][g_hDutyColour] * 256);
            return 1;
        }
        else {
            SetPlayerColor(playerid,TEAM_HIT_COLOR);
            Delete3DTextLabel(playergroupid[playerid]);
        }
    }
    return 1;
}
Reply


Messages In This Thread
Create3DTextLabel Issues - by DLR - 03.04.2016, 03:40
Re: Create3DTextLabel Issues - by N0FeaR - 03.04.2016, 11:35

Forum Jump:


Users browsing this thread: 1 Guest(s)