[Tutorial] Login / Register System Using Southclaw's INI System!
#6

Quote:
Originally Posted by nogh445
Посмотреть сообщение
This looks great, but i'm wondering one thing.. How can I make a command to make someone as an administrator?
This is an example command
pawn Код:
CMD:setadmin(playerid, params[])
{
    new pName[MAX_PLAYER_NAME], Str[128], tName[MAX_PLAYER_NAME], Level, targetid;
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ui", targetid, Level))
        {
            SendClientMessage(playerid, -1, "{FFFF00}Usage : {FFFFFF}/setadmin [playerid] [level]");
            SendClientMessage(playerid, -1, "{FF0000}Levels : {FFFFFF}(0 - Normal Player, 1 - VIP Member, 2 - Moderator, 3 - Admin, 4 - Server Developer, 5 - Server Owner)");
        }
        else
        {
            GetPlayerName(playerid, pName, sizeof(pName));
            GetPlayerName(targetid, tName, sizeof(tName));
            if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "{FF0000}Error : {FFFFFF}The Player Is Not Connected");
            format(Str, sizeof(Str), "You Have Made %s an admin level %i", tName, Level);
            SendClientMessage(playerid, -1, Str);
            format(Str, sizeof(Str), "%s has made you an admin level %i", pName, Level);
            SendClientMessage(targetid, -1, Str);
            GameTextForPlayer(targetid, "~g~Promoted", 5000, 5);
            PlayerInfo[targetid][Admin] = Level;
        }
    }
    else SendClientMessage(playerid, -1, "{FF0000}Error : {FFFFFF}Only Server {FF0000}Owners{FFFFFF} Can Use This Command");
    return 1;
}
to use the command you need to have sscanf, and zcmd, and be logged in to RCON change the messages though.

I am going to expand the tutorial if i have more time maybe add some admin commands.

and put some information on the direct reading functions.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)