Help with team chat
#1

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
Reply
#2

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;
}
Reply
#3

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;
}
Reply
#4

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.
Reply
#5

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"
Reply
#6

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];
Reply
#7

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

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.
Reply
#9

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

add #include <foreach> on top of ur script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)