Ranks don't appear above every player.
#1

On my script, ranks don't appear above EVERY players name, it only appears above 1 player.

I want someone to go on Team View with me, and sort it out if possible.
Reply
#2

show where you're making the labels please
Reply
#3

This is at the top of the script.
pawn Код:
new Text3D:RankLabel[MAX_PLAYERS];



This is a stock below, but mainly concentrate at the "RankLabel" stuff.


pawn Код:
stock SetRank3DText(playerid)
{
    new text[128], Float: XYZ[3];
    GetPlayerPos(playerid, XYZ[0], XYZ[1], XYZ[2]);
    Delete3DTextLabel(RankLabel[playerid]);

    if(aDuty[playerid] == 1 && AFK[playerid] == 1)
    {
        format(text, sizeof(text), "Administrator on duty and AFK\nDo not damage!");
        RankLabel[playerid] = Create3DTextLabel(text, 0x15FF00AA, XYZ[0], XYZ[1], XYZ[2]+0.5, 100.0, 0, 0);
    }
    else if(aDuty[playerid] == 1)
    {
        format(text, sizeof(text), "Administrator on duty\nDo not damage!");
        RankLabel[playerid] = Create3DTextLabel(text, 0x15FF00AA, XYZ[0], XYZ[1], XYZ[2]+0.5, 100.0, 0, 0);
    }
    else if(AFK[playerid] == 1)
    {
        format(text, sizeof(text), "AFK");
        RankLabel[playerid] = Create3DTextLabel(text, 0x2143DBFF, XYZ[0], XYZ[1], XYZ[2]+0.5, 100.0, 0, 0);
    }
    else
    {
        format(text, sizeof(text), "%s\n%s", RankName(playerid), ClassName(playerid));
        RankLabel[playerid] = Create3DTextLabel(text, TeamColor(playerid), XYZ[0], XYZ[1], XYZ[2]+0.5, 100.0, 0, 0);
    }

    Attach3DTextLabelToPlayer(RankLabel[playerid], playerid, 0.0, 0.0, 0.5);
    return 1;
}
Reply
#4

EDIT: Nevermind xD
Reply
#5

Can you show me all of the places where you're calling the SetRank3DText function?
Reply
#6

This is all I've got for you so far...

pawn Код:
new Text3D:RankLabel[MAX_PLAYERS];
new RankLabelActive[MAX_PLAYERS];

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

public OnPlayerSpawn(playerid)
{
    SetRank3DText(playerid);
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    if(RankLabelActive[playerid] != 0)
    {
        Delete3DTextLabel(RankLabel[playerid]);
        RankLabelActive[playerid] = 0;
    }
    return 1;
}

stock SetRank3DText(playerid)
{
    new text[128], Float: XYZ[3];
    GetPlayerPos(playerid, XYZ[0], XYZ[1], XYZ[2]);
    if(RankLabelActive[playerid] == 0)
    {
        RankLabel[playerid] = Create3DTextLabel(text, 0x15FF00AA, XYZ[0], XYZ[1], XYZ[2] + 0.5, 100.0, 0, 0);
        RankLabelActive[playerid] = 1;
    }

    if(aDuty[playerid] == 1)
    {
        if(AFK[playerid] == 1)
        {
            format(text, sizeof(text), "Administrator on duty and AFK\nDo not damage!");
            Update3DTextLabelText(RankLabel[playerid], 0x15FF00AA, text);
        }
        else
        {
            format(text, sizeof(text), "Administrator on duty\nDo not damage!");
            Update3DTextLabelText(RankLabel[playerid], 0x15FF00AA, text);
        }
    }
    else
    {
        if(AFK[playerid] == 1)
        {
            format(text, sizeof(text), "AFK");
            Update3DTextLabelText(RankLabel[playerid], 0x2143DBFF, text);
        }
        else
        {
            format(text, sizeof(text), "%s\n%s", RankName(playerid), ClassName(playerid));
            Update3DTextLabelText(RankLabel[playerid], TeamColor(playerid), text);
        }
    }

    Attach3DTextLabelToPlayer(RankLabel[playerid], playerid, 0.0, 0.0, 0.5);
    return 1;
}
Obviously, don't replace the callbacks entirely, just add these bits in to the appropriate callbacks...

EDIT: Obviously, you can add this to a timer, because OnPlayerSpawn updates the text, and I'm sure it gets updated more than once when a player spawns, so a timer would be a better option... in that case:
pawn Код:
public OnPlayerConnect(playerid)
{
    SetTimerEx("UpdateText", 5000, true, "i", playerid);
    return 1;
}

forward UpdateText(playerid);
public UpdateText(playerid)
{
    SetRank3DText(playerid);
    return 1;
}
Reply
#7

I hope i didn't understand you correctly but, i'll give you everything related.


These are my rank names and what i use as ranks.
pawn Код:
stock RankName(playerid)
{
    new rank = Rank(playerid);
    new rankname[24];
    if(rank == 1) rankname = RANK1NAME;
    if(rank == 2) rankname = RANK2NAME;
    if(rank == 3) rankname = RANK3NAME;
    if(rank == 4) rankname = RANK4NAME;
    if(rank == 5) rankname = RANK5NAME;
    if(rank == 6) rankname = RANK6NAME;
    if(rank == 7) rankname = RANK7NAME;
    if(rank == 8) rankname = RANK8NAME;
    if(rank == 9) rankname = RANK9NAME;
    if(rank == 10) rankname = RANK10NAME;
    if(rank == 11) rankname = RANK11NAME;
    if(rank == 12) rankname = RANK12NAME;
    if(rank == 13) rankname = RANK13NAME;
    if(rank == 14) rankname = RANK14NAME;
    return rankname;
}


These are the class name stocks.
pawn Код:
stock ClassName(playerid)
{
    new classname[32];
    if     (gClass[playerid] == ASSAULT) classname = ("Soldier");
    else if(gClass[playerid] == MEDIC) classname = ("Medic");
    else if(gClass[playerid] == ANTI-TANK) classname = ("Anti-Tank");
    else if(gClass[playerid] == ENGINEER) classname = ("Engineer");
    else if(gClass[playerid] == AIRFORCE) classname = ("Pilot");
    else if(gClass[playerid] == SPEC-OPS) classname = ("Spec-Ops");
    else if(gClass[playerid] == SNIPER) classname = ("Sniper");
    else if(gClass[playerid] == SPY) classname = ("Spy");
    return classname;
}


If you need more info, pm me if you're interested in connecting via Team View.
Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)