3DTextLabel Issue!!
#1

hi,

im creating some textlabels above the head of every player.
And theres a second label for admins only.
Normal players got only the first label and admins got both of them.
Now it seems that this 2 labels mix up somehow.
Cause I made a command admins can use to hide the admin label. But then it hides the normal first label instead of the admin label. But i didnt mix this label ids up so wheres the error?

pawn Код:
new Text3D:NormalLabel[MAX_PLAYERS];

new Text3D:AdminLabel[MAX_PLAYERS];

//Normal Label
NormalLabel[playerid] = Create3DTextLabel("Text",0xF97804FF,30.0,40.0,50.0,30,-1,0);
Attach3DTextLabelToPlayer(NormalLabel[playerid], playerid, 0.0, 0.0, 0.5);

//Admin Label
AdminLabel[playerid] = Create3DTextLabel("Admin",0xF97804FF,30.0,40.0,50.0,30,-1,0);

Attach3DTextLabelToPlayer(AdminLabel[playerid], playerid, 0.0, 0.0, 0.7);

//Admin label hide command
if (strcmp("/offduty", cmdtext, true) == 0)
{
if(Player[playerid][AdminLevel] > 0)//checks if player is admin
{
SendClientMessage(playerid, 0xFF0000FF, "The Admin Text Label has been removed. You are a secret admin now.");
Delete3DTextLabel(AdminLabel[playerid]);
}else return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin!");

return 1;
}
regards...
Reply
#2

someone gots an idea?
Reply
#3

Quote:
Originally Posted by BlackWolf120
Посмотреть сообщение
hi,

im creating some textlabels above the head of every player.
And theres a second label for admins only.
Normal players got only the first label and admins got both of them.
Now it seems that this 2 labels mix up somehow.
Cause I made a command admins can use to hide the admin label. But then it hides the normal first label instead of the admin label. But i didnt mix this label ids up so wheres the error?

pawn Код:
new Text3D:NormalLabel[MAX_PLAYERS];

new Text3D:AdminLabel[MAX_PLAYERS];

//Normal Label
NormalLabel[playerid] = Create3DTextLabel("Text",0xF97804FF,30.0,40.0,50.0,30,-1,0);
Attach3DTextLabelToPlayer(NormalLabel[playerid], playerid, 0.0, 0.0, 0.5);

//Admin Label
AdminLabel[playerid] = Create3DTextLabel("Admin",0xF97804FF,30.0,40.0,50.0,30,-1,0);

Attach3DTextLabelToPlayer(AdminLabel[playerid], playerid, 0.0, 0.0, 0.7);

//Admin label hide command
if (strcmp("/offduty", cmdtext, true) == 0)
{
if(Player[playerid][AdminLevel] > 0)//checks if player is admin
{
SendClientMessage(playerid, 0xFF0000FF, "The Admin Text Label has been removed. You are a secret admin now.");
Delete3DTextLabel(AdminLabel[playerid]);
}else return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin!");

return 1;
}
regards...
You made sure the Admin label is attached to only admins, and the non-admin only to non-admins?

pawn Код:
if(Player[playerid][AdminLevel] == 0)
{
NormalLabel[playerid] = Create3DTextLabel("Text",0xF97804FF,30.0,40.0,50.0,30,-1,0);
Attach3DTextLabelToPlayer(NormalLabel[playerid], playerid, 0.0, 0.0, 0.5);
}

//Admin Label
if(Player[playerid][AdminLevel] > 0)
{
AdminLabel[playerid] = Create3DTextLabel("Admin",0xF97804FF,30.0,40.0,50.0,30,-1,0);
Attach3DTextLabelToPlayer(AdminLabel[playerid], playerid, 0.0, 0.0, 0.7);

}
Reply
#4

Have you tried using a higher offset for the second label ?
Reply
#5

thx for ur answer
Yeah, i checked it twice.
I dont know why but theese 2 labels seem to mix up somehow.
Cause if i delete the admin label with the command you can see in my first post the normal label gets deleted and not the admin label. (admins got both lables above their head).
Any ideas why this happens?
Id be so happy about some help.
Reply
#6

i do it like in the folowing:

pawn Код:
//definings
new Text3D:NormalLabel[MAX_PLAYERS];
new Text3D:AdminLabel[MAX_PLAYERS];


//this is under OnPlayerSpawn it adds a rank label to every player also admins
Add3DTextLabelToPlayer(playerid);

//The admin label is added to admins only and only in case they want to go on duty with this cmd
if (strcmp("/onduty", cmdtext, true) == 0)//the admin gets his admin label
{
if(Spieler[playerid][AdminLevel] > 0)
{
Add3DTextLabelToAdmin(playerid);
SendClientMessage(playerid, 0xFF0000FF, "An Admin Text Label has been added. The players now can realize you as an Admin!");
}else return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin!");

return 1;
}

if (strcmp("/offduty", cmdtext, true) == 0)//the admin removes the admin label but heres the error, the normal label //gets removed instead of the admin label.
{
if(Spieler[playerid][AdminLevel] > 0)
{
SendClientMessage(playerid, 0xFF0000FF, "The Admin Text Label has been removed. You are a secret admin now.");
Delete3DTextLabel(AdminLabel[playerid]);
}else return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin!");

return 1;
}

//admin label adding stock function
stock Add3DTextLabelToAdmin(playerid)
{

    AdminLabel[playerid] = Create3DTextLabel("Admin",0xF97804FF,30.0,40.0,50.0,30,-1,0);

    Attach3DTextLabelToPlayer(AdminLabel[playerid], playerid, 0.0, 0.0, 0.7);

}

//normal label for every player adding stock function
stock Add3DTextLabelToPlayer(playerid)
{
           
    NormalLabel[playerid] = Create3DTextLabel("{1464F4}Rank",0xF97804FF,30.0,40.0,50.0,30,-1,0);
    Attach3DTextLabelToPlayer(NormalLabel[playerid], playerid, 0.0, 0.0, 0.5);
    new labelstring[50];
    format(labelstring, sizeof(labelstring), "{1464F4}CTU {20B2AA}%s", RankName[pRank[playerid]]);//rank update
    Update3DTextLabelText(NormalLabel[playerid], 0xF97804FF, labelstring);
}
//sorry for the double post
Reply
#7

so seems that code to be right?
...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)