Problem with this cmd -
Face9000 - 16.12.2010
Hi,i've added the stock SendMessageToAdmins (thanks who helped me)
and, OnPlayerText i added this:
Код:
if(text[0] == '@'
{
if(PlayerInfo[playerid][AdminLevel] > 2)
{
if(!strlen(cmdtext[2])) return SendClientMessage(playerid, ORANGE, "USAGE: @<text>"), SendClientMessage(playerid, COLOR_ORANGE, "HELP: Example: @Hi");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Admin Chat [%i]%s: %s" ,playerid,sendername, cmdtext[2]);
SendMessageToAdmins(COLOR_GREEN, string, 1);
return 1;
}
else return SendClientMessage(playerid, RED, No.");
}
And i get this:
Код:
C:\Documents and Settings\k\Desktop\SFWAR.pwn(143) : error 029: invalid expression, assumed zero
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : error 017: undefined symbol "cmdtext"
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : warning 215: expression has no effect
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : error 029: invalid expression, assumed zero
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
Admin variable:
if(PlayerInfo[playerid][AdminLevel] > 1)
Re: Problem with this cmd -
Ash. - 16.12.2010
Try this:
pawn Код:
if(text[0] == '@')
{
if(PlayerInfo[playerid][AdminLevel] > 2)
{
if(!strlen(cmdtext[2])) return SendClientMessage(playerid, ORANGE, "USAGE: @<text>");
SendClientMessage(playerid, COLOR_ORANGE, "HELP: Example: @Hi");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Admin Chat [%i]%s: %s" ,playerid,sendername, cmdtext[2]);
SendMessageToAdmins(COLOR_GREEN, string, 1);
return 1;
}
else return SendClientMessage(playerid, RED, No.");
}
Re: Problem with this cmd -
Face9000 - 16.12.2010
This is my OnPlayerText
Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '@')
{
if(PlayerInfo[playerid][AdminLevel] > 2)
{
if(!strlen(cmdtext[2])) return SendClientMessage(playerid, ORANGE, "USAGE: @<text>");
SendClientMessage(playerid, COLOR_ORANGE, "HELP: Example: @Hi");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Admin Chat [%i]%s: %s" ,playerid,sendername, cmdtext[2]);
SendMessageToAdmins(COLOR_GREEN, string, 1);
return 1;
}
else return SendClientMessage(playerid, RED, No.");
}
SetPlayerChatBubble(playerid, text, 0xFF0000FF, 100.0, 5000);
return 1;
}
Errors:
Код:
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : error 017: undefined symbol "cmdtext"
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : warning 215: expression has no effect
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : error 029: invalid expression, assumed zero
C:\Documents and Settings\k\Desktop\SFWAR.pwn(146) : 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 line 146 is:
if(!strlen(cmdtext[2])) return SendClientMessage(playerid, ORANGE, "USAGE: @<text>");
I need to add cmdtext,but how?
Re: Problem with this cmd -
Ash. - 16.12.2010
Disregard This
Re: Problem with this cmd -
Ash. - 16.12.2010
Wait sorry, disregard that ^^ = Im really not concentrating xD - Give me a minute
Re: Problem with this cmd -
Ash. - 16.12.2010
change cmdtext to
Re: Problem with this cmd -
Face9000 - 16.12.2010
Ok,edited.I got this:
Код:
if(text[0] == '@')
{
if(PlayerInfo[playerid][AdminLevel] > 2)
{
if(!strlen(text[2])) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: @<text>");
SendClientMessage(playerid, COLOR_ORANGE, "HELP: Example: @Hi");
new sendername[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "Admin Chat [%i]%s: %s" ,playerid,sendername, text[2]);
SendMessageToAdmins(COLOR_GREEN, string, 1);
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "No.");
}
The problem is at this line:
SendMessageToAdmins(COLOR_GREEN, string, 1);
And this is the stock i use:
Код:
stock SendMessageToAdmins(COLOR_GREEN, Text[])
{
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) if(PlayerInfo[playerid][AdminLevel] >= 1) SendClientMessage(i, COLOR_GREEN, Text);
return;
}
Hope you can help me.
Re: Problem with this cmd -
veyron - 16.12.2010
SendMessageToAdmins(COLOR_GREEN, string,
1);
why do you have that 1 in there?
Re: Problem with this cmd -
Face9000 - 16.12.2010
Umh,sincerly i dont know,maybe i've added for mistake.
BTW i've removed 1 and i got same errors.
Re: Problem with this cmd -
veyron - 16.12.2010
pawn Код:
stock SendMessageToAdmins(color, Text[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerInfo[playerid][AdminLevel] >= 1) SendClientMessage(i, color, Text);
}
return 1;
}