/setadmin CMD (Dini)
#1

(Dini)
I have looked everywhere for a /setadmin cmd they just will not work... I am using ZCMD and it will not set the level. Can someone please make me one to go with

Код:
enum pInfo
{
    AdminLevel,
    pCash,
    pScore,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
Reply
#2

pawn Код:
CMD:setadmin(playerid, params[])
{
    new id, level;
    if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "USAGE: /setadmin [id] [level]");

    if(PlayerInfo[playerid][AdminLevel] == 10) // only example
    {
        if(IsPlayerConnected(id))
        {
            if(1 <= level < 10) // only example
            {
                new string[128];
                PlayerInfo[id][AdminLevel] = level;
                format(string, sizeof(string), "* %s have promoted you to admin level %d.", level);
                SendClientMessage(id, -1, string);
                format(string, sizeof(string), "* You have promoted %s to admin level %d.", level);
                SendClientMessage(playerid, -1, string);
            }
            else SendClientMessage(playerid, -1, "ERROR: Invalid level (valid level: 1 - 10.");
        }  
        else SendClientMessage(playerid, -1, "ERROR: Player not connected!");
    }
    else SendClientMessage(playerid, -1, "ERROR: You are not admin!");
}
Reply
#3

Код:
C:\Users\Mike\Desktop\SA-MP\gamemodes\Test.pwn(460) : warning 209: function "cmd_setadmin" should return a value
I got this error, I went into the game and tried to set someone and nothing happened? No error message or anything.
Reply
#4

add
pawn Код:
return 1;
Before the last "}"
Reply
#5

The command didn't say who was promoted or what level?

But thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)