Admin duty and Admin name duty
#1

I was just wandering and it took a hour to make this. Is there something wrong with my command? Its about Admin name duty and Admin Duty command.

pawn Код:
enum pInfo
{
    AdminName[24],
    PlayerName[24],
    bool:HasSetAdminName,
    OnDuty
};

new PlayerInfo[MAX_PLAYERS+1][pInfo];
And here are the commands to do so.

pawn Код:
CMD:setadminname(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1)
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "You are not an admin.");
    }

    new
        adminname[24],
        a_string[65]
    ;

    if(sscanf(params, "s[24]", adminname))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadminanme [name]");
    }
    PlayerInfo[playerid][AdminName] = adminname;
    format(a_string, 65, "Your admin name is %s.", PlayerInfo[playerid][AdminName]);
    SendClientMessage(playerid, -1, a_string);
    PlayerInfo[playerid][HasSetAdminName] = true;

    return 1;
}

CMD:aduty(playerid)
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        PlayerInfo[playerid][PlayerName] = name;
       
        if(AdminDuty[playerid] == 0 && PlayerInfo[playerid][HasSetAdminName] = true)
        {
            new string[128];
            SetPlayerHealth(playerid,999999);
            SetPlayerColor(playerid,COLOR_RED);
            SetPlayerName(playerid, PlayerInfo[playerid][AdminName]);
            format(string,sizeof(string), "%s is now on duty admin.",GetPlayerNameEx(playerid));
            SendClientMessageToAll(COLOR_WHITE,string);
            SendClientMessage(playerid,COLOR_RED,"You are now on duty!");
            AdminDuty[playerid] = 1;
        }
        else if(AdminDuty[playerid] == 1 && PlayerInfo[playerid][HasSetAdminName] = true)
        {
            new string[128];
            SetPlayerHealth(playerid,100);
            format(string,sizeof(string)," %s is now off Duty!",GetPlayerNameEx(playerid));
            SendClientMessageToAll(COLOR_WHITE,string);
            SetPlayerColor(playerid, COLOR_WHITE);
            SendClientMessage(playerid, COLOR_WHITE,"You are now off duty admin");
            AdminDuty[playerid] = 0;
        }
        else if(!PlayerInfo[playerid][HasSetAdminName])
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "ERROR: You haven't set any admin name yet.");
        }
    }
    else
        SendClientMessage(playerid,COLOR_WHITE,"You are not an admin.");
    return 1;
}
Reply
#2

Have you actually tested it? From a quick glance it looks as though it should work. However the best way to see if it works is to test it yourself in game.
Reply
#3

How Y_INI can save name ?It saves only numbers
Reply
#4

Quote:
Originally Posted by barts
Посмотреть сообщение
How Y_INI can save name ?It saves only numbers
No it doesn't. Maybe you should read this(click me)!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)