26.06.2014, 15:20
Here's my code:
First, we define the Grove Street team:
Second, we create a function like "pTeam" so we can use it later to set the teams:
Third, we use pTeam in some callback to set the player as Grove member. (For example: OnPlayerSpawn)
Then, we use OnPlayerText to detect if the player who types a Grove Street member:
Use this stock for PlayerName: (In the bottom of your script)
First, we define the Grove Street team:
pawn Код:
#define TEAM_GROVE 0 //We define Grove Street team
pawn Код:
new pTeam[MAX_PLAYERS];
pawn Код:
public OnPlayerSpawn(playerid)
{
pTeam[playerid] =TEAM_GROVE;
return 1;
}
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;
}
pawn Код:
stock PlayerName(playerid)
{
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}