10.01.2016, 23:08
I fixed the color thingy, however the label never gets deleted when you toggle aod off.
current code :
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;
}

