26.06.2014, 12:33
Hi SA-MP Community! I'm working on a gang system and i want to add Name Tag For Gang Members.
Can Somone Help me Plzz !?
Can Somone Help me Plzz !?
new pName[MAX_PLAYERS][MAX_PLAYER_NAME+1];
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, pName[playerid], MAX_PLAYER_NAME+1);
}
public OnPlayerClassSelection(playerid, classid)
{
if(classid == 0) // Or whatever class grovestreet is..
{
new name[MAX_PLAYER_NAME+1];
format(name, sizeof(name), "[GS]%s", pName[playerid]);
SetPlayerName(playerid, name);
}
}
#define TEAM_GROVE 0 //We define Grove Street team
new pTeam[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
pTeam[playerid] =TEAM_GROVE;
return 1;
}
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;
}
stock PlayerName(playerid)
{
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}