Are there any team chats out there?
#1

Im looking for a code that allows players to talk to their team memebers automatically. Such as, depending on ther class/team, they can send out a message that is only seen by that players team, and he can see other messages sent by team members.
Reply
#2

Here you go.

Код:
#include <a_samp>
#include <zcmd>
#include <foreach>
#include <sscanf>

forward TeamChat(playerid,string[]);

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

CMD:t(playerid,params[])
{
    new text[128],pName[MAX_PLAYER_NAME],formatted[156];
    if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,-1,"Usage: /t [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
#3

Okay. Now how would i make it where you talk to your team by default, and you have to do something like /s to talk to the entire server?

Edit:

Also, that code did not work. It always says to enter a message when i use that command, though I did. I just set this up in an FS so it would not do anything to my gamemode script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)