[Help]Team Chat
#1

Guys, can anyone help me on how to making team chat?
so when the player typed @text, it will be send to all member of teams.

please help
Reply
#2

omg, please! SEARCH!!
Reply
#3

Quote:
Originally Posted by Vanter
Посмотреть сообщение
omg, please! SEARCH!!
how do you mean?
Reply
#4

simple team chat try if works

pawn Код:
forward TeamChat(playerid,string[]);

public TeamChat(playerid,string[])
{
    foreach(Player,i)
    {
        if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
        {
            SendClientMessage(i,-1,string);
        }
    }
    return 1;
}

CMD:tc(playerid,params[])
{
    new text[128],pName[MAX_PLAYER_NAME],formatted[156];
    if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,-1,"Usage: /tc [teamchat text]");
    GetPlayerName(playerid,pName,sizeof(pName));
    format(formatted,sizeof(formatted),"[Team Chat]: %s(%d): %s",pName,playerid,text);
    TeamChat(playerid,formatted);
    return 1;
}
Reply
#5

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
simple team chat try if works

pawn Код:
forward TeamChat(playerid,string[]);

public TeamChat(playerid,string[])
{
    foreach(Player,i)
    {
        if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
        {
            SendClientMessage(i,-1,string);
        }
    }
    return 1;
}

CMD:tc(playerid,params[])
{
    new text[128],pName[MAX_PLAYER_NAME],formatted[156];
    if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,-1,"Usage: /tc [teamchat text]");
    GetPlayerName(playerid,pName,sizeof(pName));
    format(formatted,sizeof(formatted),"[Team Chat]: %s(%d): %s",pName,playerid,text);
    TeamChat(playerid,formatted);
    return 1;
}
Getting an error
This is my error:

pawn Код:
E:\Rockstar Games\GTA San Andreas\samp03x_svr_R1-2_win32_3\gamemodes\dsgm.pwn(155) : error 021: symbol already defined: "i"
E:\Rockstar Games\GTA San Andreas\samp03x_svr_R1-2_win32_3\gamemodes\dsgm.pwn(155) : warning 204: symbol is assigned a value that is never used: "i"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
And i gave a little edit on your code:

pawn Код:
public TeamChat(playerid,string[])
{
    for(new i=0, i<MAX_PLAYERS, i++)
    {
        if(GetPlayerTeam(i) == gTeam[playerid])
        {
            SendClientMessage(i, -1, string);
        }
    }
    return 1;
}
Reply
#6

Compiler is saying it is already defined symbol i so use another like d p t or whatever else u want , if you want that player type @ msg for team chat that create your code under onplayertext.
Reply
#7

I don't really understand, you don't need to pay to search you know? Why you're don't use search buttons before posting, anyways I'll give you one... for me it's more simple then use /tc texte.

pawn Код:
// gang_chat system___
    if(text[0] == '!') // !TEXT private gang.
    {
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(gTeam[playerid] == gTeam[i])
            {
                format(string,sizeof(string),"[New Gang Message] (%s) said : %s", Name,text[1]);
                SendClientMessage(i,0x7fff00FF,string);
            }
        }
        return 0;
    } // matnix help.
I don't give you all of the codes, now you have to get players name and his text. Good luck.
Reply
#8

Quote:
Originally Posted by PrinceKumar
Посмотреть сообщение
Compiler is saying it is already defined symbol i so use another like d p t or whatever else u want , if you want that player type @ msg for team chat that create your code under onplayertext.
I used "d", but still showing same error
Reply
#9

Quote:
Originally Posted by Matnix
Посмотреть сообщение
I don't really understand, you don't need to pay to search you know? Why you're don't use search buttons before posting, anyways I'll give you one... for me it's more simple then use /tc texte.

pawn Код:
// gang_chat system___
    if(text[0] == '!') // !TEXT private gang.
    {
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(gTeam[playerid] == gTeam[i])
            {
                format(string,sizeof(string),"[New Gang Message] (%s) said : %s", Name,text[1]);
                SendClientMessage(i,0x7fff00FF,string);
            }
        }
        return 0;
    } // matnix help.
I don't give you all of the codes, now you have to get players name and his text. Good luck.
Thanks, i think this one is work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)