SA-MP Forums Archive
[HELP] How to create team 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: [HELP] How to create team chat (/showthread.php?tid=312617)



[HELP] How to create team chat - dickyodie - 22.01.2012

can tell me how to make the team chat using gTeam please help me


Re: [HELP] How to create team chat - Min - 22.01.2012

pawn Код:
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;
}



Re: [HELP] How to create team chat - dickyodie - 22.01.2012

i got some error

Quote:

C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 : error 017: undefined symbol "text"
C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 : warning 215: expression has no effect
C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 : error 001: expected token: ";", but found "]"
C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 : error 029: invalid expression, assumed zero
C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 : fatal error 107: too many error messages on one line

how to fix this?


Re: [HELP] How to create team chat - Min - 22.01.2012

Which line?


Re: [HELP] How to create team chat - dickyodie - 22.01.2012

in here:
if(text[0] == ';')


Re: [HELP] How to create team chat - Universal - 22.01.2012

Try replacing the
pawn Код:
if(text[0] == ';')
part with this:
pawn Код:
if(strfind(text, ';') == 0)



Re: [HELP] How to create team chat - dickyodie - 22.01.2012

i got some error again

Quote:

C:\Documents and Settings\xp\Desktop\LZGS Mission\filterscripts\ladmin.pwn(565 : error 017: undefined symbol "text"
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




Re: [HELP] How to create team chat - Universal - 22.01.2012

Are you placing this under the OnPlayerText callback?


Re: [HELP] How to create team chat - dickyodie - 22.01.2012

whether this

Quote:

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;
}
//------------------------------------------------------------------------------

if true I keep getting this error

Quote:

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




Re: [HELP] How to create team chat - eDz0r - 22.01.2012

pawn Код:
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;
}