19.10.2013, 00:07
I need help with my clan chat. Everyone who's not in a clan can see it, while it should show only for clan members.
PlayerInfo[i][pClan] = cid;
if(PlayerInfo[i][pClan] == cid)
Should detect if the player is in a clan and send the message to his clan members. (I'm not that good with foreach, so sorry if I'm making a major failure :$.
PlayerInfo[i][pClan] = cid;
if(PlayerInfo[i][pClan] == cid)
Should detect if the player is in a clan and send the message to his clan members. (I'm not that good with foreach, so sorry if I'm making a major failure :$.
pawn Код:
stock SendClanMessage(color, string[])
{
foreach(Player, i)
{
new cid;
PlayerInfo[i][pClan] = cid;
if(PlayerInfo[i][pClan] == cid)
{
SendClientMessage(i, color, string);
}
}
return 1;
}
pawn Код:
CMD:c(playerid,params[])
{
new string[128];
if(PlayerInfo[playerid][pClan] < 1) return SendClientMessage(playerid, COLOR_REDD, "[ERROR] You are not in a clan!");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_LGREEN, "Usage: /c [text]");
format(string, sizeof(string), "[CLAN] %s: {FFFFFF}%s", PLAYERNAME(playerid), params);
SendClanMessage(COLOR_AMERICA, string);
return 1;
}