Need help with Attach3DTextLabelToPlayer
#1

I made two commands of /adutyon and /adutyoff for admin from level 3 only, the problem is when admin do /adutyon it make a text above is head but when he do /adutyoff it makes double text... how to resolve it? SS:



YELLOW text /adutyon on RED text /adutyoff = double text

i tried t use the function DeletePlayer3DTextLabel but no succeed...
Reply
#2

Show those both commands if you need help. Otherwise, you are not using the function of deleting the 3D text correctly.
Reply
#3

use Update3DTextLabelText
Reply
#4

lol i forgot to show you the codes XD:

Vanter - i tried to use Update3DTextLabelText but i dont know how to use that... can you write it for me please?

Код:
CMD:adutyon(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
	new string[128];
	new Text3D:adutyon = Create3DTextLabel("Admin On Duty", COLOR_YELLOW, 30.0, 40.0, 50.0, 40.0, 0);
	SetPlayerColor(playerid, 0x00FBFFAA);
	SetPlayerHealth(playerid, 99999);
	SetPlayerArmour(playerid, 99999);
	GivePlayerWeapon(playerid, 38, 60000);
	Attach3DTextLabelToPlayer(adutyon, playerid, 0.0, 0.0, 0.3);
 	format(string, sizeof(string), "The admin %s is on Admin Duty now, If you need support or help just /report to admin (Don't spam or abuse it)", GetPlayerNameEx(playerid));
 	SendClientMessageToAll(COLOR_CYAN, string);
	SendClientMessage(playerid, COLOR_WHITE, "Admin Duty on rules: Max report time to accept or deny is 30 seconds, You must help to players if they request, If you saw a bug, report it to scripter");
		}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	}
	return 1;	
}

CMD:adutyoff(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
	new string[128];
	new Text3D:adutyoff = Create3DTextLabel("Fuck off (Admin duty off)", COLOR_TWRED, 30.0, 40.0, 50.0, 40.0, 0);
	SetPlayerColor(playerid, COLOR_TWWHITE);
	SetPlayerHealth(playerid, 100);
	SetPlayerArmour(playerid, 100);
	DeletePlayer3DTextLabel(playerid, adutyoff);
	Attach3DTextLabelToPlayer(adutyoff, playerid, 0.0, 0.0, 0.3);
 	format(string, sizeof(string), "The admin %s is off Admin Duty now, If you need support or help just go fuck yourself and dont bother him!", GetPlayerNameEx(playerid));
 	SendClientMessageToAll(COLOR_TWRED, string);
		}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	}
	return 1;	
}
Reply
#5

pawn Код:
new Text3D:aduty

CMD:adutyon(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
    new string[128];
    aduty = Create3DTextLabel("Admin On Duty", COLOR_YELLOW, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(aduty, playerid, 0.0, 0.0, 0.3);
    SetPlayerColor(playerid, 0x00FBFFAA);
    SetPlayerHealth(playerid, 99999);
    SetPlayerArmour(playerid, 99999);
    GivePlayerWeapon(playerid, 38, 60000);
    format(string, sizeof(string), "The admin %s is on Admin Duty now, If you need support or help just /report to admin (Don't spam or abuse it)", GetPlayerNameEx(playerid));
    SendClientMessageToAll(COLOR_CYAN, string);
    SendClientMessage(playerid, COLOR_WHITE, "Admin Duty on rules: Max report time to accept or deny is 30 seconds, You must help to players if they request, If you saw a bug, report it to scripter");
        }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    }
    return 1;
}

CMD:adutyoff(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
    new string[128];
    aduty = Create3DTextLabel("Fuck off (Admin duty off)", COLOR_TWRED, 30.0, 40.0, 50.0, 40.0, 0);
    Update3DTextLabelText(aduty, COLOR_TWRED, string);
    SetPlayerColor(playerid, COLOR_TWWHITE);
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);
    format(string, sizeof(string), "The admin %s is off Admin Duty now, If you need support or help just go fuck yourself and dont bother him!", GetPlayerNameEx(playerid));
    SendClientMessageToAll(COLOR_TWRED, string);
        }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    }
    return 1;
}
Try this
Reply
#6

Vanter - error for your code /:

(60637) : error 001: expected token: ";", but found "forward"

lines 60635-60637
Код:
new Text3D:aduty

CMD:adutyon(playerid, params[])
Reply
#7

new Text3D:aduty;

add a ";"
Reply
#8

Vanter now The admin duty after /adutyoff stay on same condition /:

Reply
#9

First, if you type adutyon twice with that code, you will have 2 similar labels on your head.
Second, those 3d text labels will get bugged, and maybe show to non admin players.
So I recommend you to create all labels on OnGameModeInit and Destroy them on OnGameModeExit (Same if you are using the filterscripts, just place the code on OnFilterScriptInit and OnFilterScriptExit)
Everytime a player connects, attach the label to him, and everytime a player disconnects, Update the label to " " (Space), so the next player to join with the same ID as a previous admin, won't get a label on his head saying "Fuck Off (Admin Off Duty)"...
Here is the code:
pawn Код:
new Text3D:aduty[MAX_PLAYERS];

public OnGameModeInit()     // or public OnFilterScriptInit()
{
     for(new i = 0; i < 100; i++) aduty[i] = Create3DTextLabel(" ", 30.0, 40.0, 50.0, 40.0, 0);
     return 1;
}
public OnGameModeExit()     // or public OnFilterScriptExit()
{
     for(new i = 0; i < 100; i++) Delete3DTextLabel(aduty[i]);
     return 1;
}
public OnPlayerConnect(playerid)
{
     Attach3DTextLabelToPlayer(aduty[playerid], playerid, 0.0, 0.0, 0.3);
     return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
     Update3DTextLabelText(aduty[playerid], COLOR_YELLOW, " ");
     return 1;
}
CMD:adutyon(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
         new string[128];
         Update3DTextLabelText(aduty[playerid], COLOR_YELLOW, "Admin On Duty");
         SetPlayerColor(playerid, 0x00FBFFAA);
         SetPlayerHealth(playerid, 99999);
         SetPlayerArmour(playerid, 99999);
         GivePlayerWeapon(playerid, 38, 60000);
         format(string, sizeof(string), "The admin %s is on Admin Duty now, If you need support or help just /report to admin (Don't spam or abuse it)", GetPlayerNameEx(playerid));
         SendClientMessageToAll(COLOR_CYAN, string);
         SendClientMessage(playerid, COLOR_WHITE, "Admin Duty on rules: Max report time to accept or deny is 30 seconds, You must help to players if they request, If you saw a bug, report it to scripter");
    }
    else SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    return 1;
}

CMD:adutyoff(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
         new string[128];
         Update3DTextLabelText(aduty[playerid], COLOR_TWRED, "Fuck Off (Admin Off Duty)");
         SetPlayerColor(playerid, COLOR_TWWHITE);
         SetPlayerHealth(playerid, 100);
         SetPlayerArmour(playerid, 100);
         format(string, sizeof(string), "The admin %s is off Admin Duty now, If you need support or help just go fuck yourself and dont bother him!", GetPlayerNameEx(playerid));
         SendClientMessageToAll(COLOR_TWRED, string);
    }
    else SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    return 1;
}
Edit: You don't need to add/change anything here This was all, easy and not too complicated.
Reply
#10

Never mind... i think i will give up about the 3Dtextlabel above admin name because its too complicated to make it (even if i saw it on other server i played)

Anyway thanks for help /:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)