Question to LADMIN
#1

Hello. I have Lethals Adminsystem and a question.

How to set a command for 1 level only?

Example: /kick for level 1 (Level 2-5 can't use this command anymore)

It was only an example.
Reply
#2

*bump*
Reply
#3

Original command of /kick is:

Код:
dcmd_kick(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
	    if(PlayerInfo[playerid][Level] >= 3) {
		    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /kick [playerid] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
				GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
				CMDMessageToAdmins(playerid,"KICK");
				if(!strlen(tmp2)) {
					format(string,sizeof(string),"%s has been kicked by Administrator %s [no reason given] ",playername,adminname); SendClientMessageToAll(grey,string);
					SaveToFile("KickLog",string); print(string); return Kick(player1);
				} else {
					format(string,sizeof(string),"%s has been kicked by Administrator %s [reason: %s] ",playername,adminname,params[2]); SendClientMessageToAll(grey,string);
					SaveToFile("KickLog",string); print(string); return Kick(player1); }
			} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
		} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
There where is:

Код:
if(PlayerInfo[playerid][Level] >= 3) {
Change to:

Код:
if(PlayerInfo[playerid][Level] = 1) {
= - only with this level (>= means this level or higher)
1 - only with level 1
Reply
#4

Hello and thanks for your answer!

I tried it with the command /setskin and could compile it, but I got a warning:

pawn Код:
warning 211: possibly unintended assignment
I edited the command as follows:

pawn Код:
dcmd_setskin(playerid,params[]) {
    if(PlayerInfo[playerid][Level] = 4) {
The problem is, that I could still use the command as level 5, although I made it for level 4 only.
Reply
#5

Try == instead of =
Reply
#6

Oh yeah, my fail. Use ==, not =.
Reply
#7

It should be:
pawn Код:
if(PlayerInfo[playerid][Level] < 1) {
Reply
#8

Ask this question in LAdmin Topic ?
They would help you.
Reply
#9

Quote:
Originally Posted by Meyer
Посмотреть сообщение
Ask this question in LAdmin Topic ?
They would help you.
Why?
Scripting Discussion Topic isn't for help?
Reply
#10

Quote:
Originally Posted by spedico
Посмотреть сообщение
Try == instead of =
Quote:
Originally Posted by Libra_PL
Посмотреть сообщение
Oh yeah, my fail. Use ==, not =.
That works! Thank you very much!

Topic can be locked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)