Made it for ! or if you want, you can change it to command.
pawn Код:
enum pCinfo
{
cid
};
new clan[MAX_PLAYERS][pCinfo];
public OnPlayerConnect(playerid)
{
new name[30];
GetPlayerName(playerid, name, 30);
for(new i=0;i< 30;i++)
{
if(name[i] == '[') SetPVarInt(playerid, "tagb", i);
if(name[i] == ']') SetPVarInt(playerid, "tags", i);
}
if(GetPVarInt(playerid, "tags") != 0)
{
strdel(name, GetPVarInt(playerid, "tags"), 30);
format(clan[playerid][cid], 30, "%s", name[1]);
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if(text[0] == '!') // Clan chat
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(!strfind(pname,"[",true) && !strfind(pname,"]",true))
{
SendClientMessage(playerid, -1, "ERROR: You're not in a clan, you cannot send clan message!");
return 0;
}
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"%s (ID: %d): %s",string,playerid,text[1]); SendMessageToClan(clan[playerid][cid], string);
return 0;
}
return 1;
}
stock SendMessageToClan(clanid, message[])
{
for(new x; x<MAX_PLAYERS; x++) if(clan[x][cid] == clanid) SendClientMessage(x, -1, message);
return 1;
}