Gang Tag .
#8

Here's my code:

First, we define the Grove Street team:
pawn Код:
#define TEAM_GROVE 0 //We define Grove Street team
Second, we create a function like "pTeam" so we can use it later to set the teams:
pawn Код:
new pTeam[MAX_PLAYERS];
Third, we use pTeam in some callback to set the player as Grove member. (For example: OnPlayerSpawn)
pawn Код:
public OnPlayerSpawn(playerid)
{
    pTeam[playerid] =TEAM_GROVE;
    return 1;
}
Then, we use OnPlayerText to detect if the player who types a Grove Street member:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
    if(pTeam[playerid] == TEAM_GROVE)
    {
        format(string,sizeof(string),"[GS] %s(%d): %s",PlayerName(playerid),playerid,text);
        SendClientMessageToAll(-1,string);
        /*NOTE:
        1. %s - The player's name
        2. (%d) - The player's ID
        3. %s - The player's text (What the player types)*/

        //If the player's a Grove Street member then it will send a message to all players with the tag [GS]
        return 0;
    }
    return 1;
}
Use this stock for PlayerName: (In the bottom of your script)
pawn Код:
stock PlayerName(playerid)
{
  new name[255];
  GetPlayerName(playerid, name, 255);
  return name;
}
Reply


Messages In This Thread
Gang Tag . - by GeekSiMo - 26.06.2014, 12:33
Re: Gang Tag . - by Dziugsas - 26.06.2014, 12:49
Re: Gang Tag . - by Clad - 26.06.2014, 12:51
Re: Gang Tag . - by GeekSiMo - 26.06.2014, 12:52
Re: Gang Tag . - by Laurey - 26.06.2014, 12:58
Re: Gang Tag . - by GeekSiMo - 26.06.2014, 13:14
Re: Gang Tag . - by RedFusion - 26.06.2014, 14:39
Re: Gang Tag . - by iFiras - 26.06.2014, 15:20
Re: Gang Tag . - by RedFusion - 26.06.2014, 16:44
Re: Gang Tag . - by NaClchemistryK - 26.06.2014, 17:25

Forum Jump:


Users browsing this thread: 1 Guest(s)