Feeling confusion while making myself admin.
#1

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.
Reply
#2

*Cough*

Would anyone fix my script?
Reply
#3

You probably aren't logged into rcon.
Reply
#4

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?
Reply
#5

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;
}
Reply
#6

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.
Reply
#7

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;
}
Reply
#8

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?
Reply
#9

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)