Teamchat
#1

Does anyone got idea how do i make teamchat?

Teams: Grove ballas homlesses chinese aztecas vagos police
Reply
#2

anyone?
Reply
#3

As a command (zcmd):
pawn Код:
CMD:t(playerid, params[])
{
    if (insull(params)) return SendClientMessage(playerid, -1, "Usage: /t [message]");
   
    new string[145], pName[24];
    GetPlayerName(playerid, pName, sizeof (pName));
    format(string, sizeof (string), "[TEAM CHAT] %s (%i): %s", pName, playerid, params);
    foreach (new i : Player) // Change to for(new i; i != MAX_PLAYERS; i++) if you don't have foreach
    {
        if (GetPlayerTeam(i) == GetPlayerTeam(playerid))
        {
            SendClientMessage(i, GetTeamColor(GetPlayerTeam(playerid)), string);
        }
    }
    return 1;
}
Using a symbol:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if (text[0] == '#') // Change # to your symbol
    {
        new string[145], pName[24];
        GetPlayerName(playerid, pName, sizeof (pName));
        format(string, sizeof (string), "[TEAM CHAT] %s (%i): %s", pName, playerid, text[1]);
        foreach (new i : Player) // Change to for(new i; i != MAX_PLAYERS; i++) if you don't have foreach
        {  
            if (GetPlayerTeam(i) == GetPlayerTeam(playerid))
            {
                SendClientMessage(i, GetTeamColor(GetPlayerTeam(playerid)), string);
            }
        }
                return 0;
    }
    return 1;
}
Note: You need GetTeamColor:
pawn Код:
GetTeamColor(teamid)
{
    switch(teamid)
    {
        case TEAM1: return TEAM1_COLOR;
        case TEAM2: return TEAM2_COLOR;
        case TEAM3: return TEAM3_COLOR;
        // ...
    }
    return 0;
}
Should work.
Reply
#4

didn't work
Reply
#5

Do you use SetPlayerTeam or do you have custom variables?
Reply
#6

I think setplayerteam not sure...
Reply
#7

Team Chat depends on how your player is assigned a Team. So for that you probably need to provide us with some code to work with.
Reply
#8

Don't work. Isn't descriptive... if you don't put in the effort we won't either!

Why didn't it work!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)