problem with /kick cmd
#1

Hi all,i've 2 problems.

I created /kick cmd,i need add the reason too.

Ex: /kick playerid reason

And,i've my registration system with admin levels.

and the final code is:

Код:
	if(strcmp("/kick", cmdtext, true, 5) == 0)
    {
    if(pInfo[playerid][AdminLevel] > 0)
      if(!strlen(cmdtext[6])){
        return SendClientMessage(playerid, COLOR_RED, "Correct usage: /kick [player id]");
      }
        new targetid = strval(cmdtext[6]);
        if(IsPlayerConnected(targetid)){
          new string[128], playername[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME];
          GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
          GetPlayerName(targetid, targetname, MAX_PLAYER_NAME);
          format(string, 128, "Admin %s kicked you from the server.", playername);
          SendClientMessage(targetid, COLOR_YELLOW, string);
          Kick(targetid);
          format(string, 128, "Admin %s kicked %s from the server.", playername, targetname);
          SendClientMessageToAll(0xFFAA00AA, string);
        }
        else{
        return SendClientMessage(playerid, 0xFFAA00AA, "That player is not connected.");
        }
    }
    else{
      return SendClientMessage(playerid, 0xFFAA00AA, "No.");
    }
      return 1;
    }
But i got errors:

Код:
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : warning 215: expression has no effect
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : error 029: invalid expression, assumed zero
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
The enum of my registration system is:

Код:
enum pInfo
{
     AdminLevel,
     Cash,
     Score,
}
Thanks.
Reply
#2

Umm...

I think the code is like this -
pawn Код:
enum playerInfo
{
     AdminLevel,
     Cash,
     Score,
}
new pInfo[MAX_PLAYERS][playerInfo];
Reply
#3

This:

Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
Reply
#4

Yep, like that.

EDIT:
If you used the PlayerInfo you showed, change the pInfo to PlayerInfo in your code.
Reply
#5

Edit,working.Thanks.

Now i need to add the reason.

Any help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)