hi im new on scripting but if u can help?
#1

hi i will like to know whats the code for the command to make a team chat on ma server because i was lookin ofr it and it doesnt work i will apreciate it thanks...
Reply
#2

This is what I use on my server (team chat with ! )

pawn Код:
//Add OnPlayerText
//Team Chat
    if(text[0] == '!')
  {
    text[0] = ' ';
    for(new i = 0; i <= MAX_PLAYERS; i++ )
    {
      new str[512];
      if(gTeam[playerid] == 255)
            {
            SendClientMessage(playerid,<COLOR>,"You just used \"!\" for team chat, but you are not in any team right now!");
                return 0;
            }
      if(gTeam[playerid] == gTeam[i])
      {
          format(str,512,"[Team] %s:%s",PlayerName(playerid),text); /* note that there is no space after the first "%s:" to not make the message look weird for having to much space*/
          SendClientMessage(i, <COLOR>, str);
            }
    }
    return 0;
  }
Reply
#3

thanks man you rock homie but it dont work i get this arrors cuz i have a gang gamemode


C:\Documents and Settings\GAMERS\Desktop\GAGNGWARZONE\gamemodes\SAT WUv2.pwn(1967) : warning 217: loose indentation
C:\Documents and Settings\GAMERS\Desktop\GAGNGWARZONE\gamemodes\SAT WUv2.pwn(1967) : error 017: undefined symbol "text"
C:\Documents and Settings\GAMERS\Desktop\GAGNGWARZONE\gamemodes\SAT WUv2.pwn(1967) : warning 215: expression has no effect
C:\Documents and Settings\GAMERS\Desktop\GAGNGWARZONE\gamemodes\SAT WUv2.pwn(1967) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\GAMERS\Desktop\GAGNGWARZONE\gamemodes\SAT WUv2.pwn(1967) : error 029: invalid expression, assumed zero
C:\Documents and Settings\GAMERS\Desktop\GAGNGWARZONE\gamemodes\SAT WUv2.pwn(1967) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.



i want the message to go to all the people from the same gangs thanks
Reply
#4

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '!')
    {
        if(gTeam[playerid] == 255)
        {
            SendClientMessage(playerid, 0xFFFF00FF, "You just used \"!\" for team chat, but you are not in any team right now!");
            return 0;
        }
        text[0] = ' ';
        new str[128];
        format(str, sizeof(str), "[Team] %s:%s", PlayerName(playerid), text);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && gTeam[playerid] == gTeam[i])
            {
                SendClientMessage(i, 0xFFFF00FF, str);
            }
        }
        return 0;
    }
    return 1;
}
if you don't have PlayerName function, then add this somewhere in your script:

pawn Код:
stock PlayerName(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    return pName;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)