Confused with command.
#1

Hi,


For every user in my game in the it user file it has a line saying' Council_Staff 0/1 with 0 bieng not staff and 1 being staff, I've also made a command which is called /makeadmin and it changes the user who is using that command from 'Council_Staff 0' to 'Council_Staff 1'. That command works fine but I've now created a command for kick and it has to check in the file for the Council_Staff 1 otherwise it wont let them do it. And i don't have a clue how i can make it check their file for that line and let them use the command otherwise show them my error message.

Below is my command & I'd be grateful if anyone could help me with this code.

pawn Код:
dcmd_kick(playerid, params[])
{
    if(Council_Staff[playerid] ==1)
        {
        new id,reason[256];
        if (!sscanf(params, "ds", id,reason)) SendClientMessage(playerid, 0xFF0000FF, "[BMDC] Usage: /kick [ID] [REASON]");
        else if (IsPlayerConnected(playerid))
            {
            new tmp[256];
            format(tmp,256,"[KICK] %s(%d) got kicked from the server: %s",PlayerName(id),id,reason);
            SendClientMessageToAll(COLOR_ORANGE,tmp);
            Kick(id);
            dini_IntSet("banlog",tmp,1);
            print(tmp);
            }
        else
            {
            SendClientMessage(playerid, 0xFF0000FF, "[BMDC] Invalid ID");
            }
        }
    return 1;
}
Then i get the following messages
Код:
C:\Users\Ashley\Desktop\samp02Xserver.win32[1]\gamemodes\RP.pwn(4620) : error 017: undefined symbol "Council_Staff"
C:\Users\Ashley\Desktop\samp02Xserver.win32[1]\gamemodes\RP.pwn(4620) : warning 215: expression has no effect
C:\Users\Ashley\Desktop\samp02Xserver.win32[1]\gamemodes\RP.pwn(4620) : error 001: expected token: ";", but found "]"
C:\Users\Ashley\Desktop\samp02Xserver.win32[1]\gamemodes\RP.pwn(4620) : error 029: invalid expression, assumed zero
C:\Users\Ashley\Desktop\samp02Xserver.win32[1]\gamemodes\RP.pwn(4620) : fatal error 107: too many error messages on one line

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


4 Errors.
Line 4620 is:
pawn Код:
if(Council_Staff[playerid] ==1)

Any ideas on how i can sort this command out?


Ashley
Reply
#2

First error says that you havenґt defined Council_Staff[MAX_PLAYERS]. Or perhaps you have it defined in some public? It must be a global variable.
Reply
#3

I've done the define...the command just doesn't work....it doesn't show any messages or do anything.
Reply
#4

How have you defined it? Please, give a line with variable define here.
Reply
#5

pawn Код:
new Council_Staff[MAX_PLAYERS];
Reply
#6

Give the variable a other name=
Reply
#7

Quote:
Originally Posted by Rk_
Give the variable a other name=
Can you give me an example of what to put? Because I'm kinda a newbie still.
Reply
#8

try CouncilStaff(remove the _)
Reply
#9

Hi,

I changed it to council


And it still doesn't work:/
Reply
#10

Try:
pawn Код:
dcmd_kick(playerid, params[]) {
#pragma undefined params
  new tmp[256],id,reason[256];
  if(Council_Staff[playerid] ==1)
  {
    if (!sscanf(params, "ds", id,reason))
    {
      SendClientMessage(playerid, 0xFF0000FF, "[BMDC] Usage: /kick [ID] [REASON]");
      return 1;
    }
    if (!IsPlayerConnected(id))
    {
      SendClientMessage(playerid, 0xFF0000FF, "[BMDC] Invalid ID");
      return 1;
    }
    format(tmp,256,"[KICK] %s(%d) got kicked from the server: %s",PlayerName(id),id,reason);
    SendClientMessageToAll(COLOR_ORANGE,tmp);
    Kick(id);
    dini_IntSet("banlog",tmp,1);
    print(tmp);
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)