SA-MP Forums Archive
Team radio System.... (rep+) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Team radio System.... (rep+) (/showthread.php?tid=339940)



Team radio System.... (rep+) - iOmar - 05.05.2012

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



AW: Team radio System.... (rep+) - vyper - 05.05.2012

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;
}



Re: Team radio System.... (rep+) - iOmar - 05.05.2012

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.



Re: Team radio System.... (rep+) - ToiletDuck - 05.05.2012

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



AW: Team radio System.... (rep+) - vyper - 05.05.2012

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))



Re: Team radio System.... (rep+) - iOmar - 05.05.2012

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.


AW: Team radio System.... (rep+) - vyper - 05.05.2012

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



AW: Re: Team radio System.... (rep+) - vyper - 05.05.2012

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