SA-MP Forums Archive
Makeadmin - 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: Makeadmin (/showthread.php?tid=457506)



Makeadmin - ThaCrypte - 11.08.2013

So, i've been scripting my /makeadmin cmds, and other cmds, but i know i am missing a line or two.
Currently everything works, so if you do /makeadmin Dobby 8, his admin level will be set to 8. but once i do /makeadmin, without anything behind, it sets dobby's adminlevel to 0.

CMD:
pawn Код:
CMD:makeadmin(playerid, params[])
{
            new admin, playerb;
            if(PlayerInfo[playerid][pAdmin] < 8) return SendClientMessage(playerid, COLOR_REDD, "[ERROR] You do not have the right's to use this command!");
            if(sscanf(params, "ui", playerb, admin)) SendClientMessage(playerid, COLOR_LGREEN, "Usage: /makeadmin [playerid/partname] [level]");
            {
              PlayerInfo[playerb][pAdmin] = admin;
              SendClientMessage(playerb, -1, "Your admin level has been changed!"); // i know these 2 lines look's gay, but i cba to change them xD
              SendClientMessage(playerid, -1, "You changed their admin level!");
              return 1;
            }
}



Re: Makeadmin - EmpireSk - 11.08.2013

Did you do through the RCON


Re: Makeadmin - ThaCrypte - 11.08.2013

nope, and i see the error already, i forgot to place a return @
pawn Код:
if(sscanf(params, "ui", playerb, admin)) SendClientMessage(playerid, COLOR_LGREEN, "Usage: /makeadmin [playerid/partname] [level]");
It should be:
pawn Код:
if(sscanf(params, "ui", playerb, admin)) return SendClientMessage(playerid, COLOR_LGREEN, "Usage: /makeadmin [playerid/partname] [level]");
Thanks anyways :P


Re: Makeadmin - EmpireSk - 11.08.2013

if(sscanf(params, "ui", playerb, admin)) return SendClientMessage(playerid, COLOR_LGREEN, "Usage: /makeadmin [playerid/partname] [level]");


Re: Makeadmin - RedJohn - 11.08.2013

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new admin, playerb;
    if(PlayerInfo[playerid][pAdmin] < 8) return SendClientMessage(playerid, COLOR_REDD, "[ERROR] You do not have the right's to use this command!");
    if(sscanf(params, "ui", playerb, admin)) return SendClientMessage(playerid, COLOR_LGREEN, "Usage: /makeadmin [playerid/partname] [level]");
    SendClientMessage(playerb, -1, "Your admin level has been changed!");
    SendClientMessage(playerid, -1, "You changed their admin level!");
    PlayerInfo[playerb][pAdmin] = admin;
    return 1;
}