Faction Color. -
Biess - 28.12.2014
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.
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.
Re: Faction Color. -
Biess - 28.12.2014
I got it to work, yet it only shows a black colour in the faction chat no matter what I change it too.
pawn Код:
CMD:factioncolor(playerid, params[])
{
if(!CheckAdmin(playerid, HIGH_ADMIN_LEVEL)) return NotAuthMSG(playerid);
new factionid, color;
if(sscanf(params,"dd", factionid, color)) return SyntaxMSG(playerid, "/factioncolor [factionid] [color]");
if(!Factions[factionid][fON]) return SCM(playerid, -1, "Invalid faction.");
Factions[factionid][fColor] = color;
format(msg, sizeof(msg), "You have changed faction %d color to %d.", factionid, color);
SCM(playerid, COLOR_GREEN, msg);
format(query, sizeof(query), "UPDATE `factions` SET `color` = %d WHERE `id` = %d", color, Factions[factionid][fID]);
mysql_function_query(dbHandle, query, false, "", "");
return 1;
}
Re: Faction Color. -
Vince - 28.12.2014
Try using x instead of d if you expect hexadecimal input.
Re: Faction Color. -
Biess - 28.12.2014
Tried it, yet no result.. It still shows a black colour in the faction chat no matter what it's changed too.
Re: Faction Color. -
Biess - 29.12.2014
Anyone?
Re: Faction Color. -
Write - 29.12.2014
How do you write the "color" part? when you use /factioncolor
Re: Faction Color. -
Biess - 29.12.2014
I am using numbers 0,1,2,3,4,5.. Also tried HEX codes.
Re: Faction Color. -
Write - 29.12.2014
Shoulden't you change your colors to SendFactionMessage(PlayerInfo[playerid][pFaction], Factions[factionid][fColor], msg); ?
Re: Faction Color. -
Biess - 29.12.2014
Still can't seem to fix this, the colour remain black. Also should I use hex colours as input or..?
Re: Faction Color. -
Write - 29.12.2014
Try with hex colors but change the intenger to h instead, so it goes if(sscanf(params,"dh", factionid, color))
And then you go like, 0xFFFFFFFF for white.