SA-MP Forums Archive
Admin Chat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Admin Chat (/showthread.php?tid=408951)



Admin Chat - DerickClark - 19.01.2013

Код:
COMMAND:a(playerid, params[])
{
      if (APlayerData[playerid][PlayerLevel] >= 3)
      new result[128];
      if(sscanf(params,"s[128]",result)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /a [message]");
      {
       new string[128],Name[MAX_PLAYER_NAME];
       GetPlayerName(playerid,Name,sizeof(Name);
       format(string,sizeof(string),"[ADMIN-CHAT] %s (%d): %s",Name,playerid,result);
       foreach(Player,i) if (APlayerData[playerid][PlayerLevel] >= 3) SendClientMessage(i,0x00FF00FF,string);
       return 1;
}

I get dis error
Код:
C:\Users\pawno\include\PPC_PlayerCommands.inc(4943) : error 003: declaration of a local variable must appear in a compound block
C:\Users\pawno\include\PPC_PlayerCommands.inc(4943) : error 017: undefined symbol "result"
C:\Users\pawno\include\PPC_PlayerCommands.inc(4943) : warning 215: expression has no effect
C:\Users\pawno\include\PPC_PlayerCommands.inc(4943) : error 001: expected token: ";", but found "]"
C:\Users\pawno\include\PPC_PlayerCommands.inc(4943) : fatal error 107: too many error messages on one line

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


4 Errors.



Re: Admin Chat - InfiniTy. - 19.01.2013

pawn Код:
COMMAND:a(playerid, params[])
{
      if (APlayerData[playerid][PlayerLevel] >= 3) {
          new result[128];
          if(sscanf(params,"s[128]",result)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /a [message]");
          new string[128],Name[MAX_PLAYER_NAME];
          GetPlayerName(playerid,Name,sizeof(Name);
          format(string,sizeof(string),"[ADMIN-CHAT] %s (%d): %s",Name,playerid,result);
          foreach(Player,i) if (APlayerData[i][PlayerLevel] >= 3) SendClientMessage(i,0x00FF00FF,string);
    }
    return 1;  
}



Re: Admin Chat - DerickClark - 19.01.2013

Код:
C:\Users\pawno\include\PPC_PlayerCommands.inc(4946) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Admin Chat - InfiniTy. - 19.01.2013

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
Код:
C:\Users\pawno\include\PPC_PlayerCommands.inc(4946) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
pawn Код:
COMMAND:a(playerid, params[])
{
      if (APlayerData[playerid][PlayerLevel] >= 3) {
          new result[128];
          if(sscanf(params,"s[128]",result)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /a [message]");
          new string[128],Name[MAX_PLAYER_NAME];
          GetPlayerName(playerid,Name,sizeof(Name));
          format(string,sizeof(string),"[ADMIN-CHAT] %s (%d): %s",Name,playerid,result);
          foreach(Player,i) if (APlayerData[i][PlayerLevel] >= 3) SendClientMessage(i,0x00FF00FF,string);
    }
    return 1;  
}



Re: Admin Chat - Goldino - 19.01.2013

What is line 4946?


Re: Admin Chat - DerickClark - 19.01.2013

nothing. on line 4946.

Maybe on line 4994

if (APlayerData[playerid][PlayerLevel] >= 1) {


Re: Admin Chat - InfiniTy. - 19.01.2013

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
nothing. on line 4946.

Maybe on line 4994

if (APlayerData[playerid][PlayerLevel] >= 1) {
Did you try what i gave you ?

pawn Код:
COMMAND:a(playerid, params[])
{
      if(APlayerData[playerid][PlayerLevel] >= 3) {
          new result[128];
          if(sscanf(params,"s[128]",result)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /a [message]");
          new string[128],Name[MAX_PLAYER_NAME];
          GetPlayerName(playerid,Name,sizeof(Name));
          format(string,sizeof(string),"[ADMIN-CHAT] %s (%d): %s",Name,playerid,result);
          foreach(Player,i) if(APlayerData[i][PlayerLevel] >= 3) SendClientMessage(i,0x00FF00FF,string);
    }
    return 1;  
}



Re: Admin Chat - DerickClark - 19.01.2013

Quote:
Originally Posted by Adytza.
Посмотреть сообщение
Did you try what i gave you ?

pawn Код:
COMMAND:a(playerid, params[])
{
      if(APlayerData[playerid][PlayerLevel] >= 3) {
          new result[128];
          if(sscanf(params,"s[128]",result)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /a [message]");
          new string[128],Name[MAX_PLAYER_NAME];
          GetPlayerName(playerid,Name,sizeof(Name));
          format(string,sizeof(string),"[ADMIN-CHAT] %s (%d): %s",Name,playerid,result);
          foreach(Player,i) if(APlayerData[i][PlayerLevel] >= 3) SendClientMessage(i,0x00FF00FF,string);
    }
    return 1;  
}
yes you see dis? if (APlayerData[playerid][PlayerLevel] >= 1) { "That { "

Код:
COMMAND:a(playerid, params[])
{
if (APlayerData[playerid][PlayerLevel] >= 1) {
new result[128];
if(sscanf(params,"s[128]",result)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /a [message]");
new string[128],Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name);
format(string,sizeof(string),"[ADMIN-CHAT] %s (%d): %s",Name,playerid,result);
foreach(Player,i) if (APlayerData[i][PlayerLevel] >= 3) SendClientMessage(i,0x00FF00FF,string);
}
return 1;
}



Re: Admin Chat - InfiniTy. - 19.01.2013

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
yes you see dis? if (APlayerData[playerid][PlayerLevel] >= 1) { "That { "

Код:
COMMAND:a(playerid, params[])
{
if (APlayerData[playerid][PlayerLevel] >= 1) {
new result[128];
if(sscanf(params,"s[128]",result)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /a [message]");
new string[128],Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name);
format(string,sizeof(string),"[ADMIN-CHAT] %s (%d): %s",Name,playerid,result);
foreach(Player,i) if (APlayerData[i][PlayerLevel] >= 3) SendClientMessage(i,0x00FF00FF,string);
}
return 1;
}
What's the thing with "that {" ?
It checks if the player has admin equal or bigger then 3.. if yes then execute the code below(that is to send message to other admins) else do nothing..(You could send a message saying that he needs level 3 admin or something tho)


Re: Admin Chat - DerickClark - 19.01.2013

i did try that but get me one error.