22.01.2012, 04:39
can tell me how to make the team chat using gTeam please help me
public OnPlayerText(playerid, text[])
{
if(text[0] == ';')
{
new string[128];
GetPlayerName(playerid, string, sizeof(string));
format(string, sizeof(string), "[Team Chat] %s(%d): %s", string, playerid, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, GetPlayerColor(playerid), string);
}
return 0;
}
return 1;
}
C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 ![]() C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 ![]() C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 ![]() C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 ![]() C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 ![]() |
if(text[0] == ';')
if(strfind(text, ';') == 0)
C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 ![]() C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(5660) : warning 219: local variable "string" shadows a variable at a preceding level C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(5662) : error 017: undefined symbol "text" C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(5662) : warning 215: expression has no effect C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(5662) : error 001: expected token: ";", but found "]" C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(5662) : error 029: invalid expression, assumed zero C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(5662) : fatal error 107: too many error messages on one line |
public OnPlayerText(playerid, text[]) { //------------------------------------------------------------------------------ if(strfind(text, ';') == 0) { new string[128]; GetPlayerName(playerid, string, sizeof(string)); format(string, sizeof(string), "[Team Chat] %s(%d): %s", string, playerid, text[1]); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, GetPlayerColor(playerid), string); } return 0; } //------------------------------------------------------------------------------ |
C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(1322) : error 035: argument type mismatch (argument 2) C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(1329) : error 017: undefined symbol "gTeam" C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(1329) : warning 215: expression has no effect C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(1329) : error 001: expected token: ";", but found "]" C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(1329) : error 029: invalid expression, assumed zero C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(1329) : fatal error 107: too many error messages on one line |
public OnPlayerText(playerid, text[])
{
new gTeam[5];
if(strfind(text, ";") != -1)
{
new pName[MAX_PLAYER_NAME], pString[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid])
{
GetPlayerName(playerid, pName, sizeof(pName));
format(pString, sizeof(pString), "[Team Chat][%s]: %s", pName, text);
SendClientMessage(i, GetPlayerColor(playerid), pString);
}
}
}
return 0;
}