AOD Color
#1

Hey guys,

Im having some issues with aod, when a person is going AOD, his color should be changed, to ff387a (pinkish)
However i have no clue on why it is not working, i've been trying and trying all day now and i just can't seem to find out what i have been doing wrong, i added 0x infront of the hex code but no luck..
also the 3D text label is staying when i am aod and toggle it off.

Код:
CMD:aod(playerid) //Doesnt need params function
{
	if(pData[playerid][Admin] >=1)
	{
		if (aod[playerid] == 0) //Check if player is on duty
		{
			new Float:x,Float:y,Float:z;
			new Text3D:label = Create3DTextLabel("{ff387a}Admin On Duty!", 0xff387a,x,y,z, 40.0, 0, 0); //Creates 3d text label at player position
			GetPlayerPos(playerid,x,y,z); //Looks for players position
			SetPlayerHealth(playerid,999999); //makes player godmode
			SetPlayerColor(playerid,0xff387aa); //set admin colour red
			SendClientMessage(playerid,COLOR_WHITE,"You are now on duty!"); //Tell admin he is now on duty
			Attach3DTextLabelToPlayer(label,playerid,0.0, 0.0, 0.7); //attach 3d text label made before to player
			aod[playerid] = 1; //Set player on duty
		}
		else if (aod[playerid] == 1) //Check if player is on duty
		{
  			new Float:x,Float:y,Float:z;
  			new Text3D:label = Create3DTextLabel("Admin On Duty!", 0xff387a,x,y,z, 40.0, 0, 0);
  			Delete3DTextLabel(label); //Delete 3d text label saying "Admin On Duty!"
     		SetPlayerHealth(playerid,100); //sets player health back to 100
     		SetPlayerToTeamColour(playerid);
			SendClientMessage(playerid, COLOR_WHITE,"{ff387a}[Admin]:{ffffff} You are now off duty!"); //send admin message he is off duty
			aod[playerid] = 0; //sets admin off duty
		}
 	}
	else SendClientMessage(playerid,COLOR_WHITE,"{ff0000}[Error]:{ffffff} You are not authorized to use this command."); //Error message to send to players who arent admins
	return 1;
}
Reply
#2

you color
Код:
0x0FF387AA
he should be

Код:
0xFF387AAA
Reply
#3

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

// connect
aod[playerid] = Text3D:INVALID_3DTEXT_ID;

// disconnect
if(aod[playerid] != Text3D:INVALID_3DTEXT_ID)
{
    Delete3DTextLabel(aod[playerid]);
    aod[playerid] = Text3D:INVALID_3DTEXT_ID;
}

CMD:aod(playerid) //Doesnt need params function
{
    if(pData[playerid][Admin] < 1) SendClientMessage(playerid,COLOR_WHITE,"{ff0000}[Error]:{ffffff} You are not authorized to use this command."); //Error message to send to players who arent admins
    else
    {
        if(aod[playerid] == Text3D:INVALID_3DTEXT_ID) //Check if player is on duty
        {
            aod[playerid] = Create3DTextLabel("Admin On Duty!", 0xFF387AFF, 0.0, 0.0, 0.0, 40.0, 0, 0); //Creates 3d text label at player position
            SetPlayerHealth(playerid,999999.0); //makes player godmode
            SetPlayerColor(playerid,0xFF387AFF); //set admin colour red
            SendClientMessage(playerid,COLOR_WHITE,"You are now on duty!"); //Tell admin he is now on duty
            Attach3DTextLabelToPlayer(aod[playerid],playerid,0.0,0.0,0.7); //attach 3d text label made before to player
        }
        else //Check if player is on duty
        {
            Delete3DTextLabel(aod[playerid]); //Delete 3d text label saying "Admin On Duty!"
            SetPlayerHealth(playerid,100.0); //sets player health back to 100
            SetPlayerToTeamColour(playerid);
            SendClientMessage(playerid, COLOR_WHITE,"{FF387A}[Admin]:{ffffff} You are now off duty!"); //send admin message he is off duty
            aod[playerid] = Text3D:INVALID_3DTEXT_ID; //sets admin off duty
        }
    }
    return 1;
}
aod must be per player so you need MAX_PLAYERS array
Reply
#4

I am doing that @jeff, thanks tho, it was just the removal of the label and color which bugged me.
Reply
#5

Im using SetPlayerToTeamColour

Код:
public SetPlayerToTeamColour(playerid) //Set player's to their team colour
{
	if(gTeam[playerid] == TEAM_COP)
	{
	    SetPlayerColor(playerid,0x3E7EFFFF);
	}
	if(gTeam[playerid] == TEAM_ARMY)
	{
	    SetPlayerColor(playerid,0x8F48F5FF);
	}
	if(gTeam[playerid] == TEAM_CIA)
	{
	    SetPlayerColor(playerid,0x2F205B11);
	}
	if(gTeam[playerid] == TEAM_MEDIC)
	{
	    SetPlayerColor(playerid,0x00CC00FF);
	}
	if(gTeam[playerid] == TEAM_FBI)
	{
	    SetPlayerColor(playerid,0x1C3EFFFF);
	}
	if(gTeam[playerid] == TEAM_CIVIL && GetPlayerWantedLevel(playerid) == 0)
	{
	    SetPlayerColor(playerid,COLOR_WHITE);
	}
	return 1;
}
However, if i would place
Код:
	if(aod[playerid] == 1);
	{
	SetPlayerColor(playerid,0xFF387AFF);
	}
it would tell me its an empty statement, any suggestions?
Reply
#6

pawn Код:
if(aod[playerid] != Text3D:INVALID_3DTEXT_ID)
Reply
#7

@jeff, i have not used your code, i had it defined already.
im using
Код:
new aod[MAX_PLAYERS];
aod[playerid] = 0; //OnplayerConnect
aod[playerid] = 0; //OnplayerDisconnect
Reply
#8

I fixed the color thingy, however the label never gets deleted when you toggle aod off.
current code :
Код:
CMD:aod(playerid) //Doesnt need params function
{
	if(pData[playerid][Admin] >=1)
	{
		if (aod[playerid] == 0) //Check if player is on duty
		{
			new Float:x,Float:y,Float:z;
			new Text3D:label = Create3DTextLabel("{ff387a}Admin On Duty!", 0xff387a,x,y,z, 40.0, 0, 0); //Creates 3d text label at player position
			GetPlayerPos(playerid,x,y,z); //Looks for players position
			SetPlayerHealth(playerid,9999); //makes player godmode
			SetPlayerColor(playerid,0xFF387AFF);//set the color
			SendClientMessage(playerid,COLOR_WHITE,"{ff387a}[Admin]:{ffffff} You are now on duty."); //Tell admin he is now on duty
			Attach3DTextLabelToPlayer(label,playerid,0.0, 0.0, 0.7); //attach 3d text label made before to player
			aod[playerid] = 1; //Set player on duty
		}
		else if (aod[playerid] == 1) //Check if player is on duty
		{
  			new Float:x,Float:y,Float:z;
  			new Text3D:label = Create3DTextLabel("{ff387a}Admin On Duty!", 0xff387a,x,y,z, 40.0, 0, 0);
  			Delete3DTextLabel(label); //Delete 3d text label saying "Admin On Duty!"
     		SetPlayerHealth(playerid,100); //sets player health back to 100
     		SetPlayerToTeamColour(playerid);
			SendClientMessage(playerid, COLOR_WHITE,"{ff387a}[Admin]:{ffffff} You are now off duty."); //send admin message he is off duty
			aod[playerid] = 0; //sets admin off duty
		}
 	}
	else SendClientMessage(playerid,COLOR_WHITE,"{ff0000}[Error]:{ffffff} You are not authorized to use this command."); //Error message to send to players who arent admins
	return 1;
}
Reply
#9

new Text3D:label = Create3DTextLabel("Admin On Duty!", 0xff387a,x,y,z, 40.0, 0, 0);
Delete3DTextLabel(label); //Delete 3d text label saying "Admin On Duty!"

You are recreating a new label, then deleting it !
Save it in a global variable like Jeff does (some aodlabel[playerid] or sth)
Reply
#10

Using jeff's code now however, why is it
Код:
aod[playerid] = Text3D:INVALID_3DTEXT_ID;
INVALID_3DTEXT_ID?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)