Admin CHat HELP!!
#1

pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '!' && if(PlayerInfo[playerid][AdminLevel] >= 1); // line 2482
   {
   new str[128];
       format(str, sizeof(str), "[ADMIN-CHAT]%s: %s", GetName(playerid), text[1]); // line 2485
      for(new i = 0; i < MAX_PLAYERS; i++)
      {
          if(IsPlayerConnected(i))
          {
              if(PlayerInfo[playerid][AdminLevel] >= 1)
              {
                  SendClientMessage(i, COLOR_YELLOW, str);
              }
          }
      }
       return 0;
   }
i get eror

Код:
 C:\Users\Mas O\Documents\Indonesia Drifters\gamemodes\ID.pwn(2482) : error 029: invalid expression, assumed zero
C:\Users\Mas O\Documents\Indonesia Drifters\gamemodes\ID.pwn(2482) : warning 215: expression has no effect
C:\Users\Mas O\Documents\Indonesia Drifters\gamemodes\ID.pwn(2485) : error 017: undefined symbol "GetName"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

up, help me please
Reply
#3

use this
pawn Код:
if(text[0] == '!' && PlayerInfo[playerid][AdminLevel] >= 1) {
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]); MessageToAdmins(green,string);
        return 0;
    }
and add this anywhere
pawn Код:
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1) if (PlayerInfo[playerid][AdminLevel] >= 1) SendClientMessage(i, color, string);
    }
    return 1;
}
it will be useful .
Reply
#4

Just to respond to the original problem:

pawn Код:
if(text[0] == '!' && if(PlayerInfo[playerid][AdminLevel] >= 1); // line 2482
You have a second 'if' inside an 'if' statement. Then, you have a semicolon at the end. Both are not supposed to be in here. The semi colon at the end is only for one-line statements (such as assignments - new var = 1; )

The if statement should only be instantiated once.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)