PDA

View Full Version : [FIXED]3D label help


Nabster
18/02/2015, 01:30 PM
getting tag mismatch error on attach3dtext

CMD:adminduty(playerid,params[])
{
new string[128],pName[MAX_PLAYER_NAME];
new Float:X, Float:Y, Float:Z;
new PlayerText3D:admintextid;
if(PInfo[playerid][Level] < 1)
return SendClientMessage(playerid,STEALTH_BLUE,"You need to be level 1 to go on admin duty.");
CMDMessageToAdmins(playerid,"ADMINDUTY");
if(PInfo[playerid][God] == 0)
{
PInfo[playerid][God] = 1;
SetPlayerHealth(playerid,100000);
SetPlayerSkin(playerid,217);
ResetPlayerWeapons(playerid);
GetPlayerName(playerid,pName,sizeof pName);
format(string,sizeof(string),"Administrator %s is now on Admin Duty.",pName);
SendClientMessageToAll(COLOR_MENUHIGHLIGHT,string) ;
admintextid = CreatePlayer3DTextLabel(playerid,"!!ADMIN ON DUTY!!",COLOR_GREEN,X,Y,Z,40.0);
Attach3DTextLabelToPlayer(admintextid, playerid, 0.0, 0.0, 0.7);
}
else
{
PInfo[playerid][God] = 0;
GetPlayerName(playerid,pName,sizeof pName);
format(string,sizeof(string),"Administrator %s is now off Admin Duty.",pName);
SendClientMessageToAll(COLOR_MENUHIGHLIGHT,string) ;
SetPlayerHealth(playerid,0.0);
DeletePlayer3DTextLabel(playerid,admintextid);
}
return 1;
}

HazardouS
18/02/2015, 01:32 PM
admintextid has to be Text3D, not PlayerText3D, this is the mismatch. Read this: http://wiki.sa-mp.com/wiki/Attach3DTextLabelToPlayer

Nabster
18/02/2015, 01:33 PM
so what 3dtextforplayer do?

EDIT:

CMD:adminduty(playerid,params[])
{
new string[128],pName[MAX_PLAYER_NAME];
if(PInfo[playerid][Level] < 1)
return SendClientMessage(playerid,STEALTH_BLUE,"You need to be level 1 to go on admin duty.");
CMDMessageToAdmins(playerid,"ADMINDUTY");
if(PInfo[playerid][God] == 0)
{
PInfo[playerid][God] = 1;
SetPlayerHealth(playerid,100000);
SetPlayerSkin(playerid,217);
ResetPlayerWeapons(playerid);
GetPlayerName(playerid,pName,sizeof pName);
format(string,sizeof(string),"Administrator %s is now on Admin Duty.",pName);
SendClientMessageToAll(COLOR_MENUHIGHLIGHT,string) ;
new Text3D:label = Create3DTextLabel("!!ADMIN ON DUTY!!",COLOR_GREEN,30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(label,playerid,0.0,0.0,0 .7);
}
else
{
PInfo[playerid][God] = 0;
GetPlayerName(playerid,pName,sizeof pName);
format(string,sizeof(string),"Administrator %s is now off Admin Duty.",pName);
SendClientMessageToAll(COLOR_MENUHIGHLIGHT,string) ;
SetPlayerHealth(playerid,0.0);
DeletePlayer3DTextLabel(playerid,label);
}
return 1;
}

undefined symbol label in deleteplayer3d..

HazardouS
18/02/2015, 01:37 PM
Remove all instances of admintextid and Attach function. Use the Create per-player function parameters to attach the text to the player: http://wiki.sa-mp.com/wiki/CreatePlayer3DTextLabel
Also, declare a global variable to store text3d ids in order to destroy them when the admin goes off-duty.

Nabster
18/02/2015, 01:41 PM
Thanks,fixed now.