28.12.2014, 13:17
(
Последний раз редактировалось Biess; 28.12.2014 в 14:36.
)
Hello, I got a command which sets a color of a faction in the colum "Factions" the row is called "Color".
I have this faction chat.
Is there a way to use the color that is stored in my DB in the SendFactionMessage? And I am talking about faction number 3.
I have this faction chat.
pawn Код:
CMD:f(playerid, params[]) return cmd_faction(playerid, params);
CMD:faction(playerid, params[])
{
new text[128];
new color3;
new factionid;
Factions[factionid][fColor] = color3;
if(sscanf(params,"s[128]",text)) return SyntaxMSG(playerid, "(/f)action [ooc chat]");
if(PlayerInfo[playerid][pFaction] == 0) return SCM(playerid, COLOR_LIGHTRED, "Invalid faction.");
if(Factions[PlayerInfo[playerid][pFaction]][fChatON] == 0) return SCM(playerid, COLOR_WHITE, "The OOC faction chat has been disabled by the leader.");
if(strlen(text) > MAXLEN)
{
new pos = MAXLEN;
if(pos < MAXLEN-1) pos = MAXLEN;
format(msg, sizeof(msg), "**(( %s %s: %.*s ... ))**", GetRankName(playerid), GetNameEx(playerid), pos, text);
if(PlayerInfo[playerid][pFaction] == LSPD)
SendFactionMessage(PlayerInfo[playerid][pFaction], COLOR_LSPDNEW, msg);
if(PlayerInfo[playerid][pFaction] == LSFD)
SendFactionMessage(PlayerInfo[playerid][pFaction], FACTION_OOC, msg);
format(msg, sizeof(msg), "**(( %s %s: ... %s ))**", GetRankName(playerid), GetNameEx(playerid), text[pos]);
if(PlayerInfo[playerid][pFaction] == LSPD)
SendFactionMessage(PlayerInfo[playerid][pFaction], COLOR_LSPDNEW, msg);
if(PlayerInfo[playerid][pFaction] == LSFD)
SendFactionMessage(PlayerInfo[playerid][pFaction], FACTION_OOC, msg);
}
else if(PlayerInfo[playerid][pFaction] == 3)
{
format(msg, sizeof(msg), "**(( %s %s: %s ))**", GetRankName(playerid), GetNameEx(playerid), text);
SendFactionMessage(PlayerInfo[playerid][pFaction], color3, msg);
}
else
{
format(msg, sizeof(msg), "**(( %s %s: %s ))**", GetRankName(playerid), GetNameEx(playerid), text);
if(PlayerInfo[playerid][pFaction] == LSPD)
SendFactionMessage(PlayerInfo[playerid][pFaction], COLOR_LSPDNEW, msg);
if(PlayerInfo[playerid][pFaction] == LSFD)
SendFactionMessage(PlayerInfo[playerid][pFaction], FACTION_OOC, msg);
}
return 1;
}
Is there a way to use the color that is stored in my DB in the SendFactionMessage? And I am talking about faction number 3.