SA-MP Forums Archive
Help with 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 with team chat (/showthread.php?tid=523866)



Help with team chat - prooftzm - 04.07.2014

Hi all. can someone help me with team chat command? /f i mean.
i don't know how it works. i use zcmd.
have a good day


Re: Help with team chat - BroZeus - 04.07.2014

here you go
pawn Код:
CMD:f(playerid,params[])
{
new str[200],name[24];
GetPlayeName(playerid, name, 24);
format(str, sizeof(str), "{f0f000}[TEAM CHAT] {00cc00}%s : {ffffff}%s",name,params);
for(new i=0; i<=MAX_PLAYERS; i++)
{
If(!IsPlayerConnected(i))continue;
if(gteam[playerid] != gteam[i])continue;
SendClientMessage(i, -1, str);
}
return 1;
}



Re: Help with team chat - alinategh - 04.07.2014

pawn Код:
enum pInfo
{
   pTeam
}

new PlayerInfo[MAX_PLAYERS][pInfo];

CMD:f(playerid, params[])
{
    new text[128], Team, playername[32];
    Team = PlayerInfo[playerid][pTeam];
    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /f [text]");
    foreach(Player, i)
    {
        if(PlayerInfo[i][pTeam] == Team)
        {
           new string[128];
           format(string, sizeof(string), "[TEAM CHAT] %s (%d): %s", GetPlayerName(playerid,playername,sizeof(playername)), playerid, Text);
           SendClientMessage(i, COLOR_RED, string);
        }
    }
    return 1;
}



Re: Help with team chat - prooftzm - 04.07.2014

Brozeus - C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 56) : error 017: undefined symbol "sscanf"
C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 57) : error 017: undefined symbol "foreach"
C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 59) : error 017: undefined symbol "i"
C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 62) : error 017: undefined symbol "Text"
C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 63) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

alinategh - i got 7 errors with your code.


Re: Help with team chat - alinategh - 04.07.2014

1-You should #include <foreach> in your script.
2-you should #include <sscanf2> in your script.
3-change that "Text" in line 462 to "text"


Re: Help with team chat - prooftzm - 04.07.2014

C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 55) : warning 219: local variable "str" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
line 455 new str[200],name[24];


Re: Help with team chat - alinategh - 04.07.2014

That's for BroZeus's command, which command you're using? mine or his?


Re: Help with team chat - prooftzm - 04.07.2014

his command. with your code, i got these :
C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 5 : error 017: undefined symbol "foreach"
C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 60) : error 017: undefined symbol "i"
C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 63) : error 017: undefined symbol "Text"
C:\Users\Cristi\Desktop\server\gamemodes\WAR.pwn(4 64) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


Re: Help with team chat - prooftzm - 04.07.2014

i got shit i compile it but in game, when i type /f and message it's just blank.... it doesn't work


Re: Help with team chat - SHE790 - 04.07.2014

add #include <foreach> on top of ur script