Admin Name / ADuty Problem
#1

I have no errors.. but when I use /aduty to go off duty the name is not changing to the normal name.

pawn Код:
new NormalName[MAX_PLAYERS];
enum pInfo
{
        pAdminDuty,
    pAdminName[MAX_PLAYER_NAME]
}

new PlayerInfo[MAX_PLAYERS+1][pInfo];

// public OnPlayerConnect

NormalName[playerid] = GetPlayerNameEx(playerid);

CMD:setaname(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not an admin!");
    if(PlayerInfo[playerid][pAdminDuty] != 0) return SendClientMessage(playerid, COLOR_GREY, "You must off duty to change your admin name!");
    if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "{6347AA}[Error]:{FFFFFF} /setaname [name]");
    new str[128];
    format(PlayerInfo[playerid][pAdminName], 128, params);
    format(str, sizeof(str), "%s has changed his admin name to %s.", GetPlayerNameEx(playerid), params);
    ABroadCast(COLOR_YELLOW, str, 2);
    return 1;
}

// ADMIN DUTY
CMD:aduty(playerid, params[])
{
        if(IsPlayerConnected(playerid))
        {
            new id;
            if(PlayerInfo[playerid][pAdmin] > 2 && PlayerInfo[playerid][pAdminDuty] == 0)
            {
                SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
                SendClientMessage(playerid, COLOR_WHITE, "You are now on admin duty.");
                PlayerInfo[playerid][pAdminDuty] = 1;
                //ADUTYText[playerid] = Create3DTextLabel("I'm on Admin Duty",0xCCCC00FF,30.0,40.0,50.0,40.0,0);
                //Attach3DTextLabelToPlayer(ADUTYText[playerid], playerid, 0.0, 0.0, 0.4);
                IsADUTY[id] = true;
                SetPlayerHealth(playerid, 999999);
                SetPlayerArmour(playerid, 999999);

            }
            else if(PlayerInfo[playerid][pAdmin] > 2 && PlayerInfo[playerid][pAdminDuty] != 0)
            {
                SetPlayerName(playerid, NormalName[playerid]);
                SendClientMessage(playerid, COLOR_WHITE, "You are now off admin duty.");
                //Delete3DTextLabel(ADUTYText[playerid]);
                IsADUTY[id] = false;
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 0);
                PlayerInfo[playerid][pAdminDuty] = 0;
            }
        }
        return 1;
}
Reply


Messages In This Thread
Admin Name / ADuty Problem - by Sade - 01.04.2013, 14:40
Re: Admin Name / ADuty Problem - by kamzaf - 01.04.2013, 14:45
Re: Admin Name / ADuty Problem - by iMads - 01.04.2013, 14:47
Re: Admin Name / ADuty Problem - by Sade - 01.04.2013, 14:48
Re: Admin Name / ADuty Problem - by iMads - 01.04.2013, 14:54
Re: Admin Name / ADuty Problem - by Sade - 01.04.2013, 15:02
Re: Admin Name / ADuty Problem - by zxc1 - 01.04.2013, 15:06
Re: Admin Name / ADuty Problem - by iMads - 01.04.2013, 15:10
Re: Admin Name / ADuty Problem - by Sade - 01.04.2013, 15:27
Re: Admin Name / ADuty Problem - by iMads - 01.04.2013, 15:37

Forum Jump:


Users browsing this thread: 2 Guest(s)