TEAMRADIO
#1

Ok, i wanna TEAM RADIO! I have gotten this far, correct me if im wrong, but i think i have a good start! How do i finish this?

COMMANDS
pawn Код:
CMD:sr(playerid, cmdtext[])
{
    string[256];
    format(string, sizeof string, "[SITH-RADIO] %s: {FFFFFF}%s", playerid, cmdtext[]);
    SendMessageToTeam(2,0xFF000000,string);
    return 1;
}
CMD:jr(playerid, cmdtext[])
{
    string[256];
    format(string, sizeof string, "[JEDI-RADIO] %s: {FFFFFF}%s", playerid, cmdtext[]);
    SendMessageToTeam(1,0xFF000000,string);
    return 1;
}
STOCK
pawn Код:
stock SendMessageToTeam(team,color,mess[])
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(gTeam[i] == team)
            {
                SendClientMessage(i,color,mess);
            }
        }
    }
    return 1;
}
Reply
#2

wrong..
pawn Код:
forward SendTeam1Message(color, string[]);
public SendTeam1Message(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(gTeam[i] == TEAM1)
            {
                SendClientMessage(i, COLOR_BLUE, string);
            }
        }
    }
}

//Under the command

          new pname[MAX_PLAYER_NAME];
          new string[126];
      GetPlayerName(playerid,pname,sizeof(pname));
      format(string,sizeof(string),"[TEAM1] %s(%d): %s",pname,playerid,params);
      SendTeam1Message(COLOR_BLUE,string);
Reply
#3

I had to tweak it a little, it didnt work... But after that, i combined them into this, and set it to my servers teams!

pawn Код:
CMD:r(playerid, params[])
{
    if(GetPlayerTeam(playerid) == 2)
    {
    new pname[MAX_PLAYER_NAME];
    new string[126];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"[Sith-Radio] %s(%d): %s",pname,playerid,params);
    SendTeam2Message(0xFF0000FF,string);
    }
    else if(GetPlayerTeam(playerid) == 1)
    {
    new pname[MAX_PLAYER_NAME];
    new string[126];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"[Jedi-Radio] %s(%d): %s",pname,playerid,params);
    SendTeam1Message(0xFF0000FF,string);
    }
    return 1;
}
pawn Код:
forward SendTeam1Message(color, string[]);
public SendTeam1Message(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerTeam(i) == 1)
            {
                SendClientMessage(i, 0x0000FFFF, string);
            }
        }
    }
}
forward SendTeam2Message(color, string[]);
public SendTeam2Message(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerTeam(i) == 2)
            {
                SendClientMessage(i, 0xFF0000FF, string);
            }
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)