Feeling confusion while making myself admin. -
Goldilox - 19.09.2012
Hello,
I just started editing a gamemode with all of my thoughts, but I am trapped at making myself admin. In the script it says
Code:
CMD:setstaff(playerid, params[])
for making someone admin, but as I type it
/setstaff 0 5 it doesn't say anything. I've attached the whole script too including the specific command codes. If someone volunteers by helping will get a +rep. In scriptfiles > Users > Goldilox is my account, if someone adds this account to the head admin level please.
The command script:
Code:
CMD:setstaff(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new Player, Level;
if (sscanf(params, "ui", Player, Level))
{
if(Level < 1)
{
SendClientMessage(playerid, COLOR_GREY, "Invalid staff level!");
}
else if(PlayerInfo[Player][pAdminLevel] >= 1)
{
SendClientMessage(playerid, COLOR_GREY, "Player is already an Admin or Mod!");
}
else if (Player == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GREY, "Invalid player name or id entered!");
}
else
{
new string[256], file[256];
PlayerInfo[Player][pAdminLevel] = Level;
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
format(string, sizeof(string), "You have been promoted to administration team by %s", GetPlayerNameEx(playerid));
SendClientMessage(Player, COLOR_GREEN, string);
format(string, sizeof(string), "You have promoted %s to level: %i", GetPlayerNameEx(Player), Level);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
return 1;
}
Thanks for reading.
Re: Feeling confusion while making myself admin. -
Goldilox - 19.09.2012
*Cough*
Would anyone fix my script?
Re: Feeling confusion while making myself admin. -
Backwardsman97 - 19.09.2012
You probably aren't logged into rcon.
Re: Feeling confusion while making myself admin. -
Goldilox - 19.09.2012
OK, so..
When I tried without rcon logged in it said SERVER: Unknown Command.
When I tried with rcon logged in it doesn't say anything, neither SERVER: Unknown Command.
Did you saw the attachment, tried doing it by your self?
Re: Feeling confusion while making myself admin. -
romas3110 - 19.09.2012
Ok try this.
pawn Code:
CMD:setstaff(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
{
new Player, Level;
if (sscanf(params, "ui", Player, Level))
{
if(Level < 1)
{
SendClientMessage(playerid, COLOR_GREY, "Invalid staff level!");
}
else if(PlayerInfo[Player][pAdminLevel] >= 1)
{
SendClientMessage(playerid, COLOR_GREY, "Player is already an Admin or Mod!");
}
else if (Player == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GREY, "Invalid player name or id entered!");
}
else
{
new string[256], file[256];
PlayerInfo[Player][pAdminLevel] = Level;
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
format(string, sizeof(string), "You have been promoted to administration team by %s", GetPlayerNameEx(playerid));
SendClientMessage(Player, COLOR_GREEN, string);
format(string, sizeof(string), "You have promoted %s to level: %i", GetPlayerNameEx(Player), Level);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
return 1;
}
Re: Feeling confusion while making myself admin. -
James101 - 19.09.2012
What admin system do you use? Go to the server directory > scriptfiles > admin system or accounts(forgot which) > Carry onto your account files, there should be a bunch of config, there should be "AdminLevel" or something, edit that with your desired level.
P.S - May not work, if you do not have a script with an acc/admin system, just tryin to help.
Re: Feeling confusion while making myself admin. -
clarencecuzz - 19.09.2012
pawn Code:
CMD:setstaff(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You Cannot Use This Command!");
new Player, Level;
if (sscanf(params, "ui", Player, Level))
{
if(Level < 1) return SendClientMessage(playerid, COLOR_GREY, "Invalid staff level!");
if(!IsPlayerConnected(Player) || Player == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "This Player Is Not Connected!");
if(PlayerInfo[Player][pAdminLevel] > 0) return SendClientMessage(playerid, COLOR_GREY, "This Player is already an Admin or Mod!");
new string[80], file[256];
//I have a feeling you will receive a error for not using 'file'. Otherwise uncomment the next line.
//format(file,sizeof(file),"/Users/%s.sav",GetPlayerNameEx(playerid)); //Your file extension might not be .sav, just change accordingly.
PlayerInfo[Player][pAdminLevel] = Level;
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
format(string, sizeof(string), "You have been promoted to administration level %i by %s",Level, GetPlayerNameEx(playerid));
SendClientMessage(Player, COLOR_GREEN, string);
format(string, sizeof(string), "You have promoted %s to level: %i", GetPlayerNameEx(Player), Level);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
Re: Feeling confusion while making myself admin. -
Goldilox - 19.09.2012
I tried the both but still doesn't say anything. :\ Seeming the admin system has an error. I don't know what system I use because it's not my script, how do I see it btw?
Re: Feeling confusion while making myself admin. -
Goldilox - 19.09.2012
Guys, I still do need help, would someone bother extract the gamemode and edit it? It'd be very appreciated.
Btw, who ever tried to help got a reputation. Thanks.
Re: Feeling confusion while making myself admin. -
ToiletDuck - 19.09.2012
Try this mate
pawn Code:
CMD:setstaff(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] >= ?) // define what level admin can use this command
{
new Player, Level;
if (sscanf(params, "ud", Player, Level))
{
if(Level < 1)
{
SendClientMessage(playerid, COLOR_GREY, "Invalid staff level!");
}
else if(PlayerInfo[Player][pAdminLevel] >= 1)
{
SendClientMessage(playerid, COLOR_GREY, "Player is already an Admin or Mod!");
}
else if (Player == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GREY, "Invalid player name or id entered!");
}
else
{
new string[256], file[256];
PlayerInfo[Player][pAdminLevel] = Level;
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
format(string, sizeof(string), "You have been promoted to administration team by %s", GetPlayerNameEx(playerid));
SendClientMessage(Player, COLOR_GREEN, string);
format(string, sizeof(string), "You have promoted %s to level: %d", GetPlayerNameEx(Player), Level);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, " You're not Authorized to use that command!");
}
return 1;
}