TEAM RADIO COMMAND
#9

pawn Код:
CMD:r(playerid,params[])
{
new teamstring[129];
format(teamstring, sizeof teamstring, "[Team %d]:%s", gTeam[playerid],params);
SendTeamMessage(gTeam[playerid], 0x00FF00AA, teamstring);
return 1;
}
top of your script/gamemode:

pawn Код:
stock SendTeamMessage(team, color, message[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
          if(gTeam[i] == team)
          {
               SendClientMessage(i, color, message);
          }
    }
}
using zcmd

strcmp:

pawn Код:
if (strcmp("/team", cmdtext, true, 10) == 0)
{
     new idx;
     if(!strlen(strtok(cmdtext, idx)))
     {
           SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /team [text]");
           return 1;
     }
     else
     {
           new teamstring[128];
           new pName[MAX_PLAYER_NAME];
           GetPlayerName(playerid, pName, sizeof(pName));
           format(teamstring, 128, "(T): %s: %s", pName, idx);
           SendTeamMessage(gTeam[playerid], 0x00FF00AA, teamstring);
           return 1;
      }
      return true;
}
top of your script/gamemode:

pawn Код:
stock SendTeamMessage(team, color, message[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
          if(gTeam[i] == team)
          {
               SendClientMessage(i, color, message);
          }
    }
}
strok:

pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
put it at the top
Reply


Messages In This Thread
TEAM RADIO COMMAND - by GGW - 16.08.2013, 15:47
Re: TEAM RADIO COMMAND - by DeathFire - 16.08.2013, 16:38
Re: TEAM RADIO COMMAND - by GGW - 16.08.2013, 17:20
Re: TEAM RADIO COMMAND - by Vanter - 16.08.2013, 17:45
Re: TEAM RADIO COMMAND - by GGW - 16.08.2013, 17:48
Re: TEAM RADIO COMMAND - by Vanter - 16.08.2013, 17:50
Re: TEAM RADIO COMMAND - by GGW - 16.08.2013, 17:59
Re: TEAM RADIO COMMAND - by Vanter - 16.08.2013, 18:13
Re: TEAM RADIO COMMAND - by ethhackerman - 16.08.2013, 19:55
Re: TEAM RADIO COMMAND - by cray1100 - 16.08.2013, 20:22

Forum Jump:


Users browsing this thread: 1 Guest(s)