PDA

View Full Version : Makeadmin


ThaCrypte
11/08/2013, 09:51 PM
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:

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;
}
}

EmpireSk
11/08/2013, 09:54 PM
Did you do through the RCON

ThaCrypte
11/08/2013, 09:58 PM
nope, and i see the error already, i forgot to place a return @ if(sscanf(params, "ui", playerb, admin)) SendClientMessage(playerid, COLOR_LGREEN, "Usage: /makeadmin [playerid/partname] [level]");
It should be:

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

EmpireSk
11/08/2013, 10:10 PM
if(sscanf(params, "ui", playerb, admin)) return SendClientMessage(playerid, COLOR_LGREEN, "Usage: /makeadmin [playerid/partname] [level]");

RedJohn
11/08/2013, 10:29 PM
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;
}