Team radio System.... (rep+)
#1

Guys Please i want radio (team chat) system in my script. How can i do it? Its like when u type /t <text> and than there would be message appear Like this "Team_USA Omar: Lets attack germany". And this will see only to team members of USA not others.

"OMAR" = Name

Here are my Teams:

pawn Код:
#define TEAM_PAKISTAN 1
#define TEAM_GERMNAY 2
#define TEAM_USA 3
#define TEAM_RUSSIA 4
#define TEAM_INDIA 5
Reply
#2

A simple team chat using OnPlayerText callback


pawn Код:
public OnPlayerText(playerid, text[])
{
    new strName[MAX_PLAYER_NAME], strOut[129];

    GetPlayerName(playerid, strName, sizeof(strName));
    if(text[0] == '!') // he used ' ! ' before text in chat box ( change as you wish )
    {
        new string[129];
        strmid(string, text, 1, strlen(text), 129);
        format(strOut, 129, "[TeamChat] %s: %s", strName, string);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(gTeam[i] == gTeam[playerid]) // change this if you're not using gTeam
                SendClientMessage(i, -1, strOut);
        }
        return 0; // prevent the message to be sent on global chat
    }
    return 1;
}
Reply
#3

Giving These Error:
pawn Код:
D:\Game\UDC Wars\gamemodes\Wars.pwn(834) : error 017: undefined symbol "gTeam"
D:\Game\UDC Wars\gamemodes\Wars.pwn(834) : warning 215: expression has no effect
D:\Game\UDC Wars\gamemodes\Wars.pwn(834) : error 001: expected token: ";", but found "]"
D:\Game\UDC Wars\gamemodes\Wars.pwn(834) : error 029: invalid expression, assumed zero
D:\Game\UDC Wars\gamemodes\Wars.pwn(834) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

Try to put this on the top of your script
pawn Код:
static gTeam[MAX_PLAYERS];
Reply
#5

So you're not using gTeam...


try replacing

pawn Код:
if(gTeam[i] == gTeam[playerid]) // change this if you're not using gTeam
with this

pawn Код:
if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
Reply
#6

Thnx (rep added). But how can i change colour to light green??

And one more request as friend. How i add text like " kills : 4 \ Death : 5 \ score : 5"
RANK : Rookie (1)

I'll add all ranks by myself. Only teach me how to add. And it will under the money on right top.
Reply
#7

pawn Код:
SendClientMessage(i, -1, strOut); // change ' -1 ' (White) to your color hex like : 0x00FF00FF (Green)
or
SendClientMessage(i, GetPlayerColor(playerid), strOut); // will send in the color of playerid
Reply
#8

Quote:
Originally Posted by iOmar
Посмотреть сообщение
And one more request as friend. How i add text like " kills : 4 \ Death : 5 \ score : 5"
RANK : Rookie (1)

I'll add all ranks by myself. Only teach me how to add. And it will under the money on right top.
You can try this out for ranks : https://sampforum.blast.hk/showthread.php?tid=278171
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)