In layman's terms:Plugin developers are not supposed to use actual colors, but variables which can be easily set by server masters.
How does it work?
- Create a plugin with ColorVariables
- Use color variables in chat messages and not actual colors
- Optional: If you need some new variables, create them with CAddVariable
- Optional: If you want, you can create a forwarded variable for other plugins to use (like {@isRebel CLIENT_INDEX}, {@rank CLIENT_INDEX}, {@rainbow} etc.)
- Optional: If you want to use variables from other plugins, load them with CLoadPluginConfig or CLoadPluginVariables (If server master renamed plugin binary, this won't work!)
Quick example:
Normal: PrintToChatAll("\x02[prefix]\x01 %N gave you \x03AK-47\x01!", client)
ColorVariables: CPrintToChatAll("%N gave you {highlight}AK-47{default}!", client)
ColorVariables plugin example:
PHP Code:
#include <colorvariables>
public OnPluginStart()
{
CSetPrefix("KillInfo"); // Set plugin chat prefix to "KillInfo" (will be used in every print function)
HookEvent("player_death", Event_PlayerDeath);
}
public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new victim = GetClientOfUserId(GetEventInt(event, "userid"));
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
CPrintToChatAll("{player %d}%N {default} killed {player %d}%N", attacker, attacker, victim, victim);
// {prefix}[KillInfo] {teamcolor}Will {default}killed {teamcolor}Mark
CPrintToChat(victim, "{highlight}Player {player %d}%N {highlight}killed you!", attacker, attacker);
// {prefix}[KillInfo] {highlight}Player {teamcolor}Will {highlight}killed you!
return Plugin_Continue;
}
More info, full feature list and
download in
GitHub repository.