/*
 ====================================
|[FS]Label Admin  by [OmegaKai]Games |
|Colors by OKStyle                   |
 ====================================
*/
#include <a_samp>

forward ColorUpdate(playerid);

new Colors[25] = {
0xFF0000FF, 0xFF2C00FF, 0xFF5000FF, 0xFF8700FF, 0xFFA700FF,
0xFFDC00FF, 0xFFFB00FF, 0xC4FF00FF, 0x7BFF00FF, 0x00FF00FF,
0x00FF1EFF, 0x00FF3BFF, 0x00FF7CFF, 0x00FFAEFF, 0x00FFD5FF,
0x00FFFFFF, 0x00CCFFFF, 0x00ACFFFF, 0x0083FFFF, 0x0054FFFF,
0x0000FFFF, 0x2C00FFFF, 0x5F00FFFF, 0x9B00FFFF, 0xCB00FFFF
};

new Text3D:Label[MAX_PLAYERS];
new Hentum[MAX_PLAYERS];
new number[MAX_PLAYERS];
new count[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    number[playerid] = 0;
    Hentum[playerid] = 0;
    Label[playerid] = Create3DTextLabel("",0,30.0,40.0,50.0,70.0,0,1);
    Attach3DTextLabelToPlayer(Label[playerid], playerid, 0.0, 0.0, 0.4);
    return 1;
}

public ColorUpdate(playerid)
{
    count[playerid] = SetTimerEx("ColorUpdate",200,0,"i",playerid);
    Update3DTextLabelText(Label[playerid], Colors[number[playerid]], ".:Админ:.");
    SetPlayerColor(playerid,Colors[number[playerid]]);
    number[playerid]++;
    if(number[playerid] == 25)
    {
        number[playerid] = 1;
    }
    if(Hentum[playerid] == 0)
    {
        KillTimer(count[playerid]);
        Update3DTextLabelText(Label[playerid], Colors[number[playerid]], "");
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext,"/adminlabel",true))
    {
        if (!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, 0x33CCFFAA, "* Вы не админ!");
            return 1;
        }
        if(Hentum[playerid] == 0)
        {
            Hentum[playerid] = 1;
            ColorUpdate(playerid);
            SendClientMessage(playerid, 0x33CCFFAA, "* Вы включили статус админа!");

        }
        else
        {
            KillTimer(count[playerid]);
            Update3DTextLabelText(Label[playerid], Colors[number[playerid]], "");
            Hentum[playerid] = 0;
            SendClientMessage(playerid, 0x33CCFFAA, "* Вы выключили статус админа!");
        }
        return 1;
    }
    return 0;
}
