can someone help with /makeadmin
#1

can anyone make a regular cmd /makeadmin so it makes anyone admin, thanks
Reply
#2

Do you have "AdminLevel" or something under enum PlayerStatistics ? Or whatever your enum is.
Reply
#3

nope
Reply
#4

What file saving system are you using?
Reply
#5

If you have enum PlayerStatistics
Add something under that like.
Adminlevel,
Then you can continue on with creating your command.

EDIT:
If you've done that, heres my command, it should work if you've added the enum.
Код:
command(adminlevel, playerid, params[])
{
	new id, level, string[128];
	if(sscanf(params, "ud", id, level))
	{
	    if(Player[playerid][AdminLevel] >= 1338)
	    {
			SendClientMessage(playerid, WHITE, "SYNTAX: /adminlevel [playerid] [new level]");
		}
	}
	else
	{
	    if(Player[playerid][AdminLevel] >= 6)
	    {
	        if(Player[id][AdminLevel] == 0 && level >= 1)
	        {
                if(level >= Player[playerid][AdminLevel])
                {
                    SendClientMessage(playerid, WHITE, "You can only hire an admin to a lower level.");
                }
                else
                {
	                Player[id][AdminLevel] = level;
			        format(string, sizeof(string), "%s has been hired to admin level %d by %s.", GetName(id), level, GetName(playerid));
			        SendToAdmins(ADMINORANGE, string, 0);
			        StatLog(string);
			        
				    if(Player[id][AdminPIN] == 0)
				    {
				        TogglePlayerControllable(id, false);
				        SendClientMessage(id, WHITE, "You don't have an admin PIN set. Please now set one, it must be numeric only and 6 characters in length.");
				        ShowPlayerDialog(id, 9843, DIALOG_STYLE_INPUT, "Authentication (Admin PIN)", "Please enter your desired PIN.", "Done", "Cancel");
				    }
				    else
				    {
				        Player[id][PINUnauthedTime] = 1;
				        SendClientMessage(id, WHITE, "You have 10 seconds to login before you are auto-kicked.");
				        TogglePlayerControllable(id, false);
						ShowPlayerDialog(id, 9842, DIALOG_STYLE_INPUT, "Authentication (Admin PIN)", "Please enter your additional admin PIN to continue.", "Login", "Cancel");
					}
		        }
            }
	        else if(level >= Player[playerid][AdminLevel])
    	    {
        	    SendClientMessage(playerid, WHITE, "You're unable to execute this action.");
        	}
        	else if(level >= Player[id][AdminLevel])
	    	{
	        	format(string, sizeof(string), "%s has been promoted to admin level %d by %s.", GetName(id), level, GetName(playerid));
	        	SendToAdmins(ADMINORANGE, string, 0);
	        	Player[id][AdminLevel] = level;
		        StatLog(string);
		    }
		    else if(level < 1)
		    {
		        format(string, sizeof(string), "%s has been removed from the admin team by %s.", GetName(id), GetName(playerid));
		        SendToAdmins(ADMINORANGE, string, 0);
		        Player[id][AdminLevel] = level;
		        Player[id][AdminDuty] = 0;
		        SetPlayerName(id, Player[id][NormalName]);
		        StatLog(string);
		    }
		    else if(level < Player[id][AdminLevel])
		    {
		        format(string, sizeof(string), "%s has been demoted to admin level %d by %s.", GetName(id), level, GetName(playerid));
		        SendToAdmins(ADMINORANGE, string, 0);
		        Player[id][AdminLevel] = level;
		        StatLog(string);
		    }
		}
    }
	return 1;
}
Reply
#6

Quote:
Originally Posted by Joshswag
Посмотреть сообщение
If you have enum PlayerStatistics
Add something under that like.
Adminlevel,
Then you can continue on with creating your command.

EDIT:
If you've done that, heres my command, it should work if you've added the enum.
Код:
command(adminlevel, playerid, params[])
{
	new id, level, string[128];
	if(sscanf(params, "ud", id, level))
	{
	    if(Player[playerid][AdminLevel] >= 1338)
	    {
			SendClientMessage(playerid, WHITE, "SYNTAX: /adminlevel [playerid] [new level]");
		}
	}
	else
	{
	    if(Player[playerid][AdminLevel] >= 6)
	    {
	        if(Player[id][AdminLevel] == 0 && level >= 1)
	        {
                if(level >= Player[playerid][AdminLevel])
                {
                    SendClientMessage(playerid, WHITE, "You can only hire an admin to a lower level.");
                }
                else
                {
	                Player[id][AdminLevel] = level;
			        format(string, sizeof(string), "%s has been hired to admin level %d by %s.", GetName(id), level, GetName(playerid));
			        SendToAdmins(ADMINORANGE, string, 0);
			        StatLog(string);
			        
				    if(Player[id][AdminPIN] == 0)
				    {
				        TogglePlayerControllable(id, false);
				        SendClientMessage(id, WHITE, "You don't have an admin PIN set. Please now set one, it must be numeric only and 6 characters in length.");
				        ShowPlayerDialog(id, 9843, DIALOG_STYLE_INPUT, "Authentication (Admin PIN)", "Please enter your desired PIN.", "Done", "Cancel");
				    }
				    else
				    {
				        Player[id][PINUnauthedTime] = 1;
				        SendClientMessage(id, WHITE, "You have 10 seconds to login before you are auto-kicked.");
				        TogglePlayerControllable(id, false);
						ShowPlayerDialog(id, 9842, DIALOG_STYLE_INPUT, "Authentication (Admin PIN)", "Please enter your additional admin PIN to continue.", "Login", "Cancel");
					}
		        }
            }
	        else if(level >= Player[playerid][AdminLevel])
    	    {
        	    SendClientMessage(playerid, WHITE, "You're unable to execute this action.");
        	}
        	else if(level >= Player[id][AdminLevel])
	    	{
	        	format(string, sizeof(string), "%s has been promoted to admin level %d by %s.", GetName(id), level, GetName(playerid));
	        	SendToAdmins(ADMINORANGE, string, 0);
	        	Player[id][AdminLevel] = level;
		        StatLog(string);
		    }
		    else if(level < 1)
		    {
		        format(string, sizeof(string), "%s has been removed from the admin team by %s.", GetName(id), GetName(playerid));
		        SendToAdmins(ADMINORANGE, string, 0);
		        Player[id][AdminLevel] = level;
		        Player[id][AdminDuty] = 0;
		        SetPlayerName(id, Player[id][NormalName]);
		        StatLog(string);
		    }
		    else if(level < Player[id][AdminLevel])
		    {
		        format(string, sizeof(string), "%s has been demoted to admin level %d by %s.", GetName(id), level, GetName(playerid));
		        SendToAdmins(ADMINORANGE, string, 0);
		        Player[id][AdminLevel] = level;
		        StatLog(string);
		    }
		}
    }
	return 1;
}
This is just a copy and paste from another script (Vortex I believe). It has other variables in it such as 'AdminPIN' and 'PINUnauthedTime', which you did not explain to him to add in there. You need to make the command yourself like he is requesting, so that it will not throw any errors upon his addition of this excerpt into his script. Also, his enum might not consist of 'Player', it could be 'PlayerInfo' or 'PlayerStats', you also failed to mention that as well.
Reply
#7

Quote:
Originally Posted by zDivine
Посмотреть сообщение
This is just a copy and paste from another script (Vortex I believe). It has other variables in it such as 'AdminPIN' and 'PINUnauthedTime', which you did not explain to him to add in there. You need to make the command yourself like he is requesting, so that it will not throw any errors upon his addition of this excerpt into his script. Also, his enum might not consist of 'Player', it could be 'PlayerInfo' or 'PlayerStats', you also failed to mention that as well.
Lol, i had notice that
Reply
#8

Quote:
Originally Posted by cluckintucker
Посмотреть сообщение
Lol, i had notice that
Yes, lol. If you would like me to script the command for you, please just PM your teamviewer ID and pass.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)