10.01.2016, 20:04
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;
}