Admin CHat HELP!! - 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 HELP!! (
/showthread.php?tid=509057)
Admin CHat HELP!! -
kloning1 - 25.04.2014
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.
Re: Command Admin OnPlayerText(playerid, text[]) -
kloning1 - 25.04.2014
up, help me please
Re: Admin CHat HELP!! -
Loveno - 25.04.2014
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 .
Re: Admin CHat HELP!! -
mamorunl - 25.04.2014
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.