SA-MP Forums Archive
/setadmin CMD (Dini) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /setadmin CMD (Dini) (/showthread.php?tid=502772)



/setadmin CMD (Dini) - MikeMike1997 - 26.03.2014

(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];



Re: /setadmin CMD (Dini) - RenovanZ - 26.03.2014

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!");
}



Re: /setadmin CMD (Dini) - MikeMike1997 - 26.03.2014

Код:
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.


Re: /setadmin CMD (Dini) - RenovanZ - 26.03.2014

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


Re: /setadmin CMD (Dini) - MikeMike1997 - 26.03.2014

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

But thanks