Raised This Month: $102 Target: $400
 25% 

[CSGO] Tags + Custom Chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 04-17-2019 , 09:14   [CSGO] Tags + Custom Chat
Reply With Quote #1

Hello! Recently i made my own custom tags (with some help from scripters). Today i tried to unite my plugin with Custom Chat plugin , but i failed because i wanted to remove sm_settag command , i wanted only sm_colors(sm_chatcolors) and sm_namecolors tags. When i select a color for namecolors it doesn't do something because i have custom tag..

My plugin: https://forums.alliedmods.net/showth...31#post2645131
Custom Chat: https://forums.alliedmods.net/showthread.php?t=315444

Like , i wanted this commands to override my default namecolors/chatcolors.
Line 372-375
HTML Code:
  if (StrEqual(g_szSteamID[iAuthor], "STEAM_1:0:102123053")) {
    Format(szName, MAXLENGTH_NAME, "\x01★ \x06[\x10The Beast\x06] \x0D%s", szName);
    return Plugin_Changed;
  }
Surse:
PHP Code:
#include <chat-processor>
#include <cstrike>

#pragma newdecls required

#define MAX_MESSAGE_LENGTH 250

Database g_hDatabase;

Menu g_mColorsMenug_mNameMenu;

char g_szSteamID[MAXPLAYERS+1][32];

public 
Plugin myinfo = { 
  
name "[CSGO] Chat/Scoreboard Tags with change colors"
  
author "PorcusorulMagic and R3TROATTACK"
  
description ""
  
version "1.2",
  
url "" 
};

char g_sColorNames[][] =  {
    
"Default"
    
"Darkred"
    
"Green"
    
"Team Color"
    
"Olive"
    
"Lime"
    
"Red"
    
"Grey"
    
"Yellow"
    
"Gold"
    
"Silver"
    
"Blue"
    
"Darkblue"
    
"Bluegrey"
    
"Magenta"
    
"Lightred"
};
char g_sColorCodes[][] =  {
    
"\x01"
    
"\x02"
    
"\x04"
    
"\x03"
    
"\x05"
    
"\x06"
    
"\x07"
    
"\x08"
    
"\x09"
    
"\x10"
    
"\x0A"
    
"\x0B"
    
"\x0C"
    
"\x0D"
    
"\x0E"
    
"\x0F"
};

enum ChatData {
    
Chat
    
Name,
    
String:ChatHex[16],
    
String:NameHex[128],
    
String:Tag[128]
};

int g_iPlayerInfo[MAXPLAYERS 1][ChatData];
bool g_bLate false;

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errint len)
{
    
g_bLate late;
}

public 
void OnPluginStart()
{    
    
DB_Load();
    
RegAdminCmd("sm_chatcolors"Command_ColorsADMFLAG_CUSTOM6);
    
RegAdminCmd("sm_namecolors"Command_NameColorsADMFLAG_CUSTOM6);
    
    if (
g_bLate)
    {
        for (
int i 1<= MaxClientsi++)
        if (
IsClientInGame(i))
            
OnClientPostAdminCheck(i);
    }
}

public 
Action Command_Colors(int clientint args)
{
    if (
>= client MaxClients)
        return 
Plugin_Handled;
    
    if (!
IsClientInGame(client))
        return 
Plugin_Handled;
    
    
g_mColorsMenu.Display(clientMENU_TIME_FOREVER);
    return 
Plugin_Handled;
}

public 
Action Command_NameColors(int clientint args)
{
    if (
>= client MaxClients)
        return 
Plugin_Handled;
    
    if (!
IsClientInGame(client))
        return 
Plugin_Handled;
    
    
g_mNameMenu.Display(clientMENU_TIME_FOREVER);
    return 
Plugin_Handled;
}

public 
void OnClientPostAdminCheck(int client)
{
    
g_iPlayerInfo[client][Chat] = 0;
    
g_iPlayerInfo[client][Name] = 3;
    
CreateTimer(1.5Timer_LoadDelayGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
    
GetClientAuthId(clientAuthId_Steam2g_szSteamID[client], sizeof(g_szSteamID[]))
}

public 
Action Timer_LoadDelay(Handle timerany userid)
{
    
int client GetClientOfUserId(userid);
    if (
client MaxClients && !IsClientInGame(client))
        return 
Plugin_Handled;
    
    
bool n CheckCommandAccess(client"sm_namecolors"ADMFLAG_CUSTOM6);
    
bool chat CheckCommandAccess(client"sm_chatcolors"ADMFLAG_CUSTOM6);
    if (!
&& !chat )
        return 
Plugin_Handled;
    
char sQuery[256], steamid[64];
    if (!
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid)))
        return 
Plugin_Handled;
    
int count 0;
    if (
n) { count++; }
    if (
chat) { count++; }
    if (
count 1)
        
Format(sQuerysizeof(sQuery), "SELECT %s%s%s FROM customchat WHERE steamid='%s';""namecolor, " ""chat "chatcolor, " ""steamid);
    else
        
Format(sQuerysizeof(sQuery), "SELECT %s%s%s FROM customchat WHERE steamid='%s';""namecolor" ""chat "chatcolor" ""steamid);
    
g_hDatabase.Query(DB_LoadColorssQueryuserid);
    return 
Plugin_Handled;
}

public 
void DB_LoadColors(Database dbDBResultSet results, const char[] errorany data)
{
    if (
db == null || results == null)
    {
        
LogError("DB_LoadColors returned error: %s"error);
        return;
    }
    
    
int client GetClientOfUserId(data);
    if (
client MaxClients && !IsClientInGame(client))
        return;
    if(
results.RowCount <= 0)
        return;
    
int chatcolnamecol;
    
bool chat results.FieldNameToNum("chatcolor"chatcol);
    
bool name results.FieldNameToNum("namecolor"namecol);
    
results.FetchRow();
    
    if(
chat)
        
g_iPlayerInfo[client][Chat] = results.FetchInt(chatcol);
    if(
name)
        
g_iPlayerInfo[client][Name] = results.FetchInt(namecol);
}

void DB_Load()
{
    
Database.Connect(DB_Connect"chatcolors");
}

public 
void DB_Connect(Database db, const char[] errorany data)
{
    if (
db == null)
    {
        
LogError("DB_Connect returned invalid Database Handle");
        return;
    }
    
    
g_hDatabase db;
    
db.Query(DB_Generic"CREATE TABLE customchat (steamid varchar(64) NOT NULL, chatcolor INT DEFAULT 0, namecolor INT DEFAULT 4, tag varchar(64) DEFAULT NULL, PRIMARY KEY(steamid));");
}

public 
void DB_UpdateColors(int client)
{
    if (
g_hDatabase == null)
        return;
    
    
char sQuery[256], steamid[64];
    if (!
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid)))
        return;
    
Format(sQuerysizeof(sQuery), "INSERT INTO customchat (steamid, chatcolor, namecolor, tag) VALUES ('%s', %d, %d, '%s') ON DUPLICATE KEY UPDATE chatcolor=VALUES(chatcolor), namecolor=VALUES(namecolor), tag=VALUES(tag);"steamidg_iPlayerInfo[client][Chat], g_iPlayerInfo[client][Name], g_iPlayerInfo[client][Tag]);
    
g_hDatabase.Query(DB_GenericsQuery);
}

public 
void DB_Generic(Database dbDBResultSet results, const char[] errorany data)
{
    if (
db == null || results == null)
    {
        
LogError("DB_Generic returned error: %s"error);
        return;
    }
}

public 
void OnMapStart()
{
    
Menu menu = new Menu(MenuHandler_ChatColor);
    
menu.SetTitle("Select your chat color!");
    for (
int i 0sizeof(g_sColorNames); i++)
    {
        
char info[16];
        
IntToString(iinfosizeof(info));
        
menu.AddItem(infog_sColorNames[i]);
    }
    
menu.ExitButton true;
    
g_mColorsMenu menu;
    
    
Menu menu2 = new Menu(MenuHandler_NameColor);
    
menu2.SetTitle("Select your name color!");
    for (
int i 0sizeof(g_sColorNames); i++)
    {
        
char info[16];
        
IntToString(iinfosizeof(info));
        
menu2.AddItem(infog_sColorNames[i]);
    }
    
menu2.ExitButton true;
    
g_mNameMenu menu2;
}

public 
void OnMapEnd()
{
    
CloseMenu(g_mColorsMenu);
    
CloseMenu(g_mNameMenu);
}

stock void CloseMenu(Menumenu)
{
    if(
menu != null)
    {
        
CloseHandle(menu);
    }
    
menu null;
}

public 
int MenuHandler_ChatColor(Menu menuMenuAction actionint clientint choice)
{
    if (
action != MenuAction_Select)
        return;
    
PrintToChat(client"\x01★ \x04[EVICT] \x01Ti-ai setat culoarea la Chat in %s%s\x01."g_sColorCodes[choice], g_sColorNames[choice]);
    
g_iPlayerInfo[client][Chat] = choice;
    
DB_UpdateColors(client);
}

public 
int MenuHandler_NameColor(Menu menuMenuAction actionint clientint choice)
{
    if (
action != MenuAction_Select)
        return;
    
PrintToChat(client"\x01★ \x04[EVICT] \x01Ti-ai setat culoarea la Nume in %s%s\x01."g_sColorCodes[choice], g_sColorNames[choice]);
    
g_iPlayerInfo[client][Name] = choice;
    
DB_UpdateColors(client);
}

public 
Action OnChatMessage(int authorHandle recipientschar[] namechar[] message)
{
    
bool n CheckCommandAccess(author"sm_namecolors"ADMFLAG_CUSTOM6);
    
bool chat CheckCommandAccess(author"sm_chatcolors"ADMFLAG_CUSTOM6);
    if (!
&& !chat )
        return 
Plugin_Continue;
    
    
char ctag[32];
    
bool changed;
    
bool needspace false;
    if (
chat)
    {
        if (
g_iPlayerInfo[author][Chat] != 0)
        {
            
Format(messageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[author][Chat]], message);
            
changed true;
        }
        if (
CheckCommandAccess(author"sm_colors_parse"ADMFLAG_CUSTOM6))
            
ProcessColors(messageMAX_MESSAGE_LENGTH);
    }
    
    if (
n)
    {
        if (
g_iPlayerInfo[author][Name] != 3)
        {
            
Format(nameMAX_NAME_LENGTH" %s%s"g_sColorCodes[g_iPlayerInfo[author][Name]], name);
            
changed true;
            
needspace true;
        }
    }


    
Format(nameMAX_NAME_LENGTH"%s%s%s"needspace " " ""ctagname);
    
    if (
changed)
        return 
Plugin_Changed;
    return 
Plugin_Continue;
}

void ProcessColors(char[] bufferint maxlen)
{
    for (
int i 1sizeof(g_sColorNames); i++)
    {
        
char tmp[32];
        
Format(tmpsizeof(tmp), "{%s}"g_sColorNames[i]);
        
ReplaceString(buffermaxlentmpg_sColorCodes[i]);
    }


public 
Action GiveTag(Handle timerany userid

    
int client GetClientOfUserId(userid
     
    if(
client && IsClientInGame(client)) 
    { 
        
char szSteamID[32
        
GetClientAuthId(clientAuthId_Steam2szSteamIDsizeof(szSteamID)) 
         
        if(
GetUserFlagBits(client) & ADMFLAG_ROOT
        { 
            
CS_SetClientClanTag(client"★ Founder ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_UNBAN)  
        { 
            
CS_SetClientClanTag(client"★ Owner ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM4
        { 
            
CS_SetClientClanTag(client"★ Mod+VIP ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM3
        { 
            
CS_SetClientClanTag(client"★ Mod ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM2
        { 
            
CS_SetClientClanTag(client"★ Admin+VIP ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_BAN
        { 
            
CS_SetClientClanTag(client"★ Admin ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM1
        { 
            
CS_SetClientClanTag(client"★ Helper+VIP ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_GENERIC
        { 
            
CS_SetClientClanTag(client"★ Helper ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM6
        { 
            
CS_SetClientClanTag(client"★ VIP ★ "
        } 
         
        if(
StrEqual(szSteamID"STEAM_1:0:1234")) 
        { 
            
CS_SetClientClanTag(client"CLAN TAG"
        } 
    } 
}  

public 
void OnClientDisconnect(int iClient) {
  
g_szSteamID[iClient][0] = '\0';
}

public 
Action CP_OnChatMessage(intiAuthorArrayList hRecipientschar[] szFlagStringchar[] szNamechar[] szMessageboolbProcessColorsboolbRemoveColors) {
  if (
StrEqual(g_szSteamID[iAuthor], "STEAM_1:0:102123053")) {
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x10The Beast\x06] \x0D%s"szName);
    return 
Plugin_Changed;
  }

  if (
StrEqual(g_szSteamID[iAuthor], "STEAM_1:0:186515754")) {
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x0BThe Pimp\x06] \x0E%s"szName);
    return 
Plugin_Changed;
  }
  
  if (
StrEqual(g_szSteamID[iAuthor], "STEAM_1:1:448538146")) {
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x05Nasu Mare\x06] \x08%s"szName);
    return 
Plugin_Changed;
  }

  
int iFlagBits GetUserFlagBits(iAuthor);

  if (
iFlagBits ADMFLAG_ROOT)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Founder\x06] \x0E%s"szName);
  else if (
iFlagBits ADMFLAG_CUSTOM5)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x02You\x01Tuber\x06] \x0E%s"szName);
  else if (
iFlagBits ADMFLAG_UNBAN)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Owner\x06] \x07%s"szName);
  else if (
iFlagBits ADMFLAG_CUSTOM4)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Mod+VIP\x06] \x02%s"szName);
  else if (
iFlagBits ADMFLAG_CUSTOM3)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Mod\x06] \x07%s"szName);
  else if (
iFlagBits ADMFLAG_CUSTOM2)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Admin+VIP\x06] \x02%s"szName);
  else if (
iFlagBits ADMFLAG_BAN)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Admin\x06] \x07%s"szName);
  else if (
iFlagBits ADMFLAG_CUSTOM1)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Helper+VIP\x06] \x02%s"szName);
  else if (
iFlagBits ADMFLAG_GENERIC)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Helper\x06] \x07%s"szName);
  else if (
iFlagBits ADMFLAG_CUSTOM6)
    
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x02V\x03I\x04P\x06] \x0E%s"szName);

  return 
Plugin_Changed

__________________
Steam - https://steamcommunity.com/id/porcusorulmagic2
Discord - PorcusorulMagic#4908

Last edited by PorcusorulMagic; 04-17-2019 at 09:32. Reason: override
PorcusorulMagic is offline
cristian20042
AlliedModders Donor
Join Date: Jun 2016
Location: Romania
Old 04-18-2019 , 17:27   Re: [CSGO] Tags + Custom Chat
Reply With Quote #2

This SHOULD work

PHP Code:
#include <chat-processor>
#include <cstrike>

#pragma newdecls required

#define MAX_MESSAGE_LENGTH 250

Database g_hDatabase;

Menu g_mColorsMenug_mNameMenu;

char g_szSteamID[MAXPLAYERS+1][32];

public 
Plugin myinfo = { 
  
name "[CSGO] Chat/Scoreboard Tags with change colors"
  
author "PorcusorulMagic and R3TROATTACK"
  
description ""
  
version "1.2",
  
url "" 
};

char g_sColorNames[][] =  {
    
"Default"
    
"Darkred"
    
"Green"
    
"Team Color"
    
"Olive"
    
"Lime"
    
"Red"
    
"Grey"
    
"Yellow"
    
"Gold"
    
"Silver"
    
"Blue"
    
"Darkblue"
    
"Bluegrey"
    
"Magenta"
    
"Lightred"
};
char g_sColorCodes[][] =  {
    
"\x01"
    
"\x02"
    
"\x04"
    
"\x03"
    
"\x05"
    
"\x06"
    
"\x07"
    
"\x08"
    
"\x09"
    
"\x10"
    
"\x0A"
    
"\x0B"
    
"\x0C"
    
"\x0D"
    
"\x0E"
    
"\x0F"
};

enum ChatData {
    
Chat
    
Name,
    
String:ChatHex[16],
    
String:NameHex[128],
    
String:Tag[128]
};

int g_iPlayerInfo[MAXPLAYERS 1][ChatData];
bool g_bLate false;

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errint len)
{
    
g_bLate late;
}

public 
void OnPluginStart()
{    
    
DB_Load();
    
RegAdminCmd("sm_chatcolors"Command_ColorsADMFLAG_CUSTOM6);
    
RegAdminCmd("sm_namecolors"Command_NameColorsADMFLAG_CUSTOM6);
    
    if (
g_bLate)
    {
        for (
int i 1<= MaxClientsi++)
        if (
IsClientInGame(i))
            
OnClientPostAdminCheck(i);
    }
}

public 
Action Command_Colors(int clientint args)
{
    if (
>= client MaxClients)
        return 
Plugin_Handled;
    
    if (!
IsClientInGame(client))
        return 
Plugin_Handled;
    
    
g_mColorsMenu.Display(clientMENU_TIME_FOREVER);
    return 
Plugin_Handled;
}

public 
Action Command_NameColors(int clientint args)
{
    if (
>= client MaxClients)
        return 
Plugin_Handled;
    
    if (!
IsClientInGame(client))
        return 
Plugin_Handled;
    
    
g_mNameMenu.Display(clientMENU_TIME_FOREVER);
    return 
Plugin_Handled;
}

public 
void OnClientPostAdminCheck(int client)
{
    
g_iPlayerInfo[client][Chat] = 0;
    
g_iPlayerInfo[client][Name] = 3;
    
CreateTimer(1.5Timer_LoadDelayGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
    
GetClientAuthId(clientAuthId_Steam2g_szSteamID[client], sizeof(g_szSteamID[]))
}

public 
Action Timer_LoadDelay(Handle timerany userid)
{
    
int client GetClientOfUserId(userid);
    if (
client MaxClients && !IsClientInGame(client))
        return 
Plugin_Handled;
    
    
bool n CheckCommandAccess(client"sm_namecolors"ADMFLAG_CUSTOM6);
    
bool chat CheckCommandAccess(client"sm_chatcolors"ADMFLAG_CUSTOM6);
    if (!
&& !chat )
        return 
Plugin_Handled;
    
char sQuery[256], steamid[64];
    if (!
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid)))
        return 
Plugin_Handled;
    
int count 0;
    if (
n) { count++; }
    if (
chat) { count++; }
    if (
count 1)
        
Format(sQuerysizeof(sQuery), "SELECT %s%s%s FROM customchat WHERE steamid='%s';""namecolor, " ""chat "chatcolor, " ""steamid);
    else
        
Format(sQuerysizeof(sQuery), "SELECT %s%s%s FROM customchat WHERE steamid='%s';""namecolor" ""chat "chatcolor" ""steamid);
    
g_hDatabase.Query(DB_LoadColorssQueryuserid);
    return 
Plugin_Handled;
}

public 
void DB_LoadColors(Database dbDBResultSet results, const char[] errorany data)
{
    if (
db == null || results == null)
    {
        
LogError("DB_LoadColors returned error: %s"error);
        return;
    }
    
    
int client GetClientOfUserId(data);
    if (
client MaxClients && !IsClientInGame(client))
        return;
    if(
results.RowCount <= 0)
        return;
    
int chatcolnamecol;
    
bool chat results.FieldNameToNum("chatcolor"chatcol);
    
bool name results.FieldNameToNum("namecolor"namecol);
    
results.FetchRow();
    
    if(
chat)
        
g_iPlayerInfo[client][Chat] = results.FetchInt(chatcol);
    if(
name)
        
g_iPlayerInfo[client][Name] = results.FetchInt(namecol);
}

void DB_Load()
{
    
Database.Connect(DB_Connect"chatcolors");
}

public 
void DB_Connect(Database db, const char[] errorany data)
{
    if (
db == null)
    {
        
LogError("DB_Connect returned invalid Database Handle");
        return;
    }
    
    
g_hDatabase db;
    
db.Query(DB_Generic"CREATE TABLE customchat (steamid varchar(64) NOT NULL, chatcolor INT DEFAULT 0, namecolor INT DEFAULT 4, tag varchar(64) DEFAULT NULL, PRIMARY KEY(steamid));");
}

public 
void DB_UpdateColors(int client)
{
    if (
g_hDatabase == null)
        return;
    
    
char sQuery[256], steamid[64];
    if (!
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid)))
        return;
    
Format(sQuerysizeof(sQuery), "INSERT INTO customchat (steamid, chatcolor, namecolor, tag) VALUES ('%s', %d, %d, '%s') ON DUPLICATE KEY UPDATE chatcolor=VALUES(chatcolor), namecolor=VALUES(namecolor), tag=VALUES(tag);"steamidg_iPlayerInfo[client][Chat], g_iPlayerInfo[client][Name], g_iPlayerInfo[client][Tag]);
    
g_hDatabase.Query(DB_GenericsQuery);
}

public 
void DB_Generic(Database dbDBResultSet results, const char[] errorany data)
{
    if (
db == null || results == null)
    {
        
LogError("DB_Generic returned error: %s"error);
        return;
    }
}

public 
void OnMapStart()
{
    
Menu menu = new Menu(MenuHandler_ChatColor);
    
menu.SetTitle("Select your chat color!");
    for (
int i 0sizeof(g_sColorNames); i++)
    {
        
char info[16];
        
IntToString(iinfosizeof(info));
        
menu.AddItem(infog_sColorNames[i]);
    }
    
menu.ExitButton true;
    
g_mColorsMenu menu;
    
    
Menu menu2 = new Menu(MenuHandler_NameColor);
    
menu2.SetTitle("Select your name color!");
    for (
int i 0sizeof(g_sColorNames); i++)
    {
        
char info[16];
        
IntToString(iinfosizeof(info));
        
menu2.AddItem(infog_sColorNames[i]);
    }
    
menu2.ExitButton true;
    
g_mNameMenu menu2;
}

public 
void OnMapEnd()
{
    
CloseMenu(g_mColorsMenu);
    
CloseMenu(g_mNameMenu);
}

stock void CloseMenu(Menumenu)
{
    if(
menu != null)
    {
        
CloseHandle(menu);
    }
    
menu null;
}

public 
int MenuHandler_ChatColor(Menu menuMenuAction actionint clientint choice)
{
    if (
action != MenuAction_Select)
        return;
    
PrintToChat(client"\x01★ \x04[EVICT] \x01Ti-ai setat culoarea la Chat in %s%s\x01."g_sColorCodes[choice], g_sColorNames[choice]);
    
g_iPlayerInfo[client][Chat] = choice;
    
DB_UpdateColors(client);
}

public 
int MenuHandler_NameColor(Menu menuMenuAction actionint clientint choice)
{
    if (
action != MenuAction_Select)
        return;
    
PrintToChat(client"\x01★ \x04[EVICT] \x01Ti-ai setat culoarea la Nume in %s%s\x01."g_sColorCodes[choice], g_sColorNames[choice]);
    
g_iPlayerInfo[client][Name] = choice;
    
DB_UpdateColors(client);
}

public 
Action OnChatMessage(int authorHandle recipientschar[] namechar[] message)
{
    
bool n CheckCommandAccess(author"sm_namecolors"ADMFLAG_CUSTOM6);
    
bool chat CheckCommandAccess(author"sm_chatcolors"ADMFLAG_CUSTOM6);
    if (!
&& !chat )
        return 
Plugin_Continue;
    
    
char ctag[32];
    
bool changed;
    
bool needspace false;
    if (
chat)
    {
        if (
g_iPlayerInfo[author][Chat] != 0)
        {
            
Format(messageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[author][Chat]], message);
            
changed true;
        }
        if (
CheckCommandAccess(author"sm_colors_parse"ADMFLAG_CUSTOM6))
            
ProcessColors(messageMAX_MESSAGE_LENGTH);
    }
    
    if (
n)
    {
        if (
g_iPlayerInfo[author][Name] != 3)
        {
            
Format(nameMAX_NAME_LENGTH" %s%s"g_sColorCodes[g_iPlayerInfo[author][Name]], name);
            
changed true;
            
needspace true;
        }
    }


    
Format(nameMAX_NAME_LENGTH"%s%s%s"needspace " " ""ctagname);
    
    if (
changed)
        return 
Plugin_Changed;
    return 
Plugin_Continue;
}

void ProcessColors(char[] bufferint maxlen)
{
    for (
int i 1sizeof(g_sColorNames); i++)
    {
        
char tmp[32];
        
Format(tmpsizeof(tmp), "{%s}"g_sColorNames[i]);
        
ReplaceString(buffermaxlentmpg_sColorCodes[i]);
    }


public 
Action GiveTag(Handle timerany userid

    
int client GetClientOfUserId(userid
     
    if(
client && IsClientInGame(client)) 
    { 
        
char szSteamID[32
        
GetClientAuthId(clientAuthId_Steam2szSteamIDsizeof(szSteamID)) 
         
        if(
GetUserFlagBits(client) & ADMFLAG_ROOT
        { 
            
CS_SetClientClanTag(client"★ Founder ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_UNBAN)  
        { 
            
CS_SetClientClanTag(client"★ Owner ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM4
        { 
            
CS_SetClientClanTag(client"★ Mod+VIP ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM3
        { 
            
CS_SetClientClanTag(client"★ Mod ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM2
        { 
            
CS_SetClientClanTag(client"★ Admin+VIP ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_BAN
        { 
            
CS_SetClientClanTag(client"★ Admin ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM1
        { 
            
CS_SetClientClanTag(client"★ Helper+VIP ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_GENERIC
        { 
            
CS_SetClientClanTag(client"★ Helper ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM6
        { 
            
CS_SetClientClanTag(client"★ VIP ★ "
        } 
         
        if(
StrEqual(szSteamID"STEAM_1:0:1234")) 
        { 
            
CS_SetClientClanTag(client"CLAN TAG"
        } 
    } 
}  

public 
void OnClientDisconnect(int iClient) {
  
g_szSteamID[iClient][0] = '\0';
}

public 
Action CP_OnChatMessage(intiAuthorArrayList hRecipientschar[] szFlagStringchar[] szNamechar[] szMessageboolbProcessColorsboolbRemoveColors) {
    if (
StrEqual(g_szSteamID[iAuthor], "STEAM_1:0:102123053")) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x10The Beast\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
        return 
Plugin_Changed;
    }

    if (
StrEqual(g_szSteamID[iAuthor], "STEAM_1:0:186515754")) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x0BThe Pimp\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
        return 
Plugin_Changed;
    }

    if (
StrEqual(g_szSteamID[iAuthor], "STEAM_1:1:448538146")) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x05Nasu Mare\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
        return 
Plugin_Changed;
    }

    
int iFlagBits GetUserFlagBits(iAuthor);

    if (
iFlagBits ADMFLAG_ROOT) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Founder\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM5) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x02You\x01Tuber\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_UNBAN) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Owner\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM4) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Mod+VIP\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM3) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Mod\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM2) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Admin+VIP\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_BAN) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Admin\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM1) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Helper+VIP\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_GENERIC) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Helper\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM6) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x02V\x03I\x04P\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }

    return 
Plugin_Changed

__________________
Steam - https://steamcommunity.com/id/sniperheroofficialu/
Discord - SniperHero#8545
cristian20042 is offline
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 04-19-2019 , 00:28   Re: [CSGO] Tags + Custom Chat
Reply With Quote #3

Quote:
Originally Posted by cristian20042 View Post
This SHOULD work

PHP Code:
#include <chat-processor>
#include <cstrike>

#pragma newdecls required

#define MAX_MESSAGE_LENGTH 250

Database g_hDatabase;

Menu g_mColorsMenug_mNameMenu;

char g_szSteamID[MAXPLAYERS+1][32];

public 
Plugin myinfo = { 
  
name "[CSGO] Chat/Scoreboard Tags with change colors"
  
author "PorcusorulMagic and R3TROATTACK"
  
description ""
  
version "1.2",
  
url "" 
};

char g_sColorNames[][] =  {
    
"Default"
    
"Darkred"
    
"Green"
    
"Team Color"
    
"Olive"
    
"Lime"
    
"Red"
    
"Grey"
    
"Yellow"
    
"Gold"
    
"Silver"
    
"Blue"
    
"Darkblue"
    
"Bluegrey"
    
"Magenta"
    
"Lightred"
};
char g_sColorCodes[][] =  {
    
"\x01"
    
"\x02"
    
"\x04"
    
"\x03"
    
"\x05"
    
"\x06"
    
"\x07"
    
"\x08"
    
"\x09"
    
"\x10"
    
"\x0A"
    
"\x0B"
    
"\x0C"
    
"\x0D"
    
"\x0E"
    
"\x0F"
};

enum ChatData {
    
Chat
    
Name,
    
String:ChatHex[16],
    
String:NameHex[128],
    
String:Tag[128]
};

int g_iPlayerInfo[MAXPLAYERS 1][ChatData];
bool g_bLate false;

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errint len)
{
    
g_bLate late;
}

public 
void OnPluginStart()
{    
    
DB_Load();
    
RegAdminCmd("sm_chatcolors"Command_ColorsADMFLAG_CUSTOM6);
    
RegAdminCmd("sm_namecolors"Command_NameColorsADMFLAG_CUSTOM6);
    
    if (
g_bLate)
    {
        for (
int i 1<= MaxClientsi++)
        if (
IsClientInGame(i))
            
OnClientPostAdminCheck(i);
    }
}

public 
Action Command_Colors(int clientint args)
{
    if (
>= client MaxClients)
        return 
Plugin_Handled;
    
    if (!
IsClientInGame(client))
        return 
Plugin_Handled;
    
    
g_mColorsMenu.Display(clientMENU_TIME_FOREVER);
    return 
Plugin_Handled;
}

public 
Action Command_NameColors(int clientint args)
{
    if (
>= client MaxClients)
        return 
Plugin_Handled;
    
    if (!
IsClientInGame(client))
        return 
Plugin_Handled;
    
    
g_mNameMenu.Display(clientMENU_TIME_FOREVER);
    return 
Plugin_Handled;
}

public 
void OnClientPostAdminCheck(int client)
{
    
g_iPlayerInfo[client][Chat] = 0;
    
g_iPlayerInfo[client][Name] = 3;
    
CreateTimer(1.5Timer_LoadDelayGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
    
GetClientAuthId(clientAuthId_Steam2g_szSteamID[client], sizeof(g_szSteamID[]))
}

public 
Action Timer_LoadDelay(Handle timerany userid)
{
    
int client GetClientOfUserId(userid);
    if (
client MaxClients && !IsClientInGame(client))
        return 
Plugin_Handled;
    
    
bool n CheckCommandAccess(client"sm_namecolors"ADMFLAG_CUSTOM6);
    
bool chat CheckCommandAccess(client"sm_chatcolors"ADMFLAG_CUSTOM6);
    if (!
&& !chat )
        return 
Plugin_Handled;
    
char sQuery[256], steamid[64];
    if (!
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid)))
        return 
Plugin_Handled;
    
int count 0;
    if (
n) { count++; }
    if (
chat) { count++; }
    if (
count 1)
        
Format(sQuerysizeof(sQuery), "SELECT %s%s%s FROM customchat WHERE steamid='%s';""namecolor, " ""chat "chatcolor, " ""steamid);
    else
        
Format(sQuerysizeof(sQuery), "SELECT %s%s%s FROM customchat WHERE steamid='%s';""namecolor" ""chat "chatcolor" ""steamid);
    
g_hDatabase.Query(DB_LoadColorssQueryuserid);
    return 
Plugin_Handled;
}

public 
void DB_LoadColors(Database dbDBResultSet results, const char[] errorany data)
{
    if (
db == null || results == null)
    {
        
LogError("DB_LoadColors returned error: %s"error);
        return;
    }
    
    
int client GetClientOfUserId(data);
    if (
client MaxClients && !IsClientInGame(client))
        return;
    if(
results.RowCount <= 0)
        return;
    
int chatcolnamecol;
    
bool chat results.FieldNameToNum("chatcolor"chatcol);
    
bool name results.FieldNameToNum("namecolor"namecol);
    
results.FetchRow();
    
    if(
chat)
        
g_iPlayerInfo[client][Chat] = results.FetchInt(chatcol);
    if(
name)
        
g_iPlayerInfo[client][Name] = results.FetchInt(namecol);
}

void DB_Load()
{
    
Database.Connect(DB_Connect"chatcolors");
}

public 
void DB_Connect(Database db, const char[] errorany data)
{
    if (
db == null)
    {
        
LogError("DB_Connect returned invalid Database Handle");
        return;
    }
    
    
g_hDatabase db;
    
db.Query(DB_Generic"CREATE TABLE customchat (steamid varchar(64) NOT NULL, chatcolor INT DEFAULT 0, namecolor INT DEFAULT 4, tag varchar(64) DEFAULT NULL, PRIMARY KEY(steamid));");
}

public 
void DB_UpdateColors(int client)
{
    if (
g_hDatabase == null)
        return;
    
    
char sQuery[256], steamid[64];
    if (!
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid)))
        return;
    
Format(sQuerysizeof(sQuery), "INSERT INTO customchat (steamid, chatcolor, namecolor, tag) VALUES ('%s', %d, %d, '%s') ON DUPLICATE KEY UPDATE chatcolor=VALUES(chatcolor), namecolor=VALUES(namecolor), tag=VALUES(tag);"steamidg_iPlayerInfo[client][Chat], g_iPlayerInfo[client][Name], g_iPlayerInfo[client][Tag]);
    
g_hDatabase.Query(DB_GenericsQuery);
}

public 
void DB_Generic(Database dbDBResultSet results, const char[] errorany data)
{
    if (
db == null || results == null)
    {
        
LogError("DB_Generic returned error: %s"error);
        return;
    }
}

public 
void OnMapStart()
{
    
Menu menu = new Menu(MenuHandler_ChatColor);
    
menu.SetTitle("Select your chat color!");
    for (
int i 0sizeof(g_sColorNames); i++)
    {
        
char info[16];
        
IntToString(iinfosizeof(info));
        
menu.AddItem(infog_sColorNames[i]);
    }
    
menu.ExitButton true;
    
g_mColorsMenu menu;
    
    
Menu menu2 = new Menu(MenuHandler_NameColor);
    
menu2.SetTitle("Select your name color!");
    for (
int i 0sizeof(g_sColorNames); i++)
    {
        
char info[16];
        
IntToString(iinfosizeof(info));
        
menu2.AddItem(infog_sColorNames[i]);
    }
    
menu2.ExitButton true;
    
g_mNameMenu menu2;
}

public 
void OnMapEnd()
{
    
CloseMenu(g_mColorsMenu);
    
CloseMenu(g_mNameMenu);
}

stock void CloseMenu(Menumenu)
{
    if(
menu != null)
    {
        
CloseHandle(menu);
    }
    
menu null;
}

public 
int MenuHandler_ChatColor(Menu menuMenuAction actionint clientint choice)
{
    if (
action != MenuAction_Select)
        return;
    
PrintToChat(client"\x01★ \x04[EVICT] \x01Ti-ai setat culoarea la Chat in %s%s\x01."g_sColorCodes[choice], g_sColorNames[choice]);
    
g_iPlayerInfo[client][Chat] = choice;
    
DB_UpdateColors(client);
}

public 
int MenuHandler_NameColor(Menu menuMenuAction actionint clientint choice)
{
    if (
action != MenuAction_Select)
        return;
    
PrintToChat(client"\x01★ \x04[EVICT] \x01Ti-ai setat culoarea la Nume in %s%s\x01."g_sColorCodes[choice], g_sColorNames[choice]);
    
g_iPlayerInfo[client][Name] = choice;
    
DB_UpdateColors(client);
}

public 
Action OnChatMessage(int authorHandle recipientschar[] namechar[] message)
{
    
bool n CheckCommandAccess(author"sm_namecolors"ADMFLAG_CUSTOM6);
    
bool chat CheckCommandAccess(author"sm_chatcolors"ADMFLAG_CUSTOM6);
    if (!
&& !chat )
        return 
Plugin_Continue;
    
    
char ctag[32];
    
bool changed;
    
bool needspace false;
    if (
chat)
    {
        if (
g_iPlayerInfo[author][Chat] != 0)
        {
            
Format(messageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[author][Chat]], message);
            
changed true;
        }
        if (
CheckCommandAccess(author"sm_colors_parse"ADMFLAG_CUSTOM6))
            
ProcessColors(messageMAX_MESSAGE_LENGTH);
    }
    
    if (
n)
    {
        if (
g_iPlayerInfo[author][Name] != 3)
        {
            
Format(nameMAX_NAME_LENGTH" %s%s"g_sColorCodes[g_iPlayerInfo[author][Name]], name);
            
changed true;
            
needspace true;
        }
    }


    
Format(nameMAX_NAME_LENGTH"%s%s%s"needspace " " ""ctagname);
    
    if (
changed)
        return 
Plugin_Changed;
    return 
Plugin_Continue;
}

void ProcessColors(char[] bufferint maxlen)
{
    for (
int i 1sizeof(g_sColorNames); i++)
    {
        
char tmp[32];
        
Format(tmpsizeof(tmp), "{%s}"g_sColorNames[i]);
        
ReplaceString(buffermaxlentmpg_sColorCodes[i]);
    }


public 
Action GiveTag(Handle timerany userid

    
int client GetClientOfUserId(userid
     
    if(
client && IsClientInGame(client)) 
    { 
        
char szSteamID[32
        
GetClientAuthId(clientAuthId_Steam2szSteamIDsizeof(szSteamID)) 
         
        if(
GetUserFlagBits(client) & ADMFLAG_ROOT
        { 
            
CS_SetClientClanTag(client"★ Founder ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_UNBAN)  
        { 
            
CS_SetClientClanTag(client"★ Owner ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM4
        { 
            
CS_SetClientClanTag(client"★ Mod+VIP ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM3
        { 
            
CS_SetClientClanTag(client"★ Mod ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM2
        { 
            
CS_SetClientClanTag(client"★ Admin+VIP ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_BAN
        { 
            
CS_SetClientClanTag(client"★ Admin ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM1
        { 
            
CS_SetClientClanTag(client"★ Helper+VIP ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_GENERIC
        { 
            
CS_SetClientClanTag(client"★ Helper ★ "
        } 
        else if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM6
        { 
            
CS_SetClientClanTag(client"★ VIP ★ "
        } 
         
        if(
StrEqual(szSteamID"STEAM_1:0:1234")) 
        { 
            
CS_SetClientClanTag(client"CLAN TAG"
        } 
    } 
}  

public 
void OnClientDisconnect(int iClient) {
  
g_szSteamID[iClient][0] = '\0';
}

public 
Action CP_OnChatMessage(intiAuthorArrayList hRecipientschar[] szFlagStringchar[] szNamechar[] szMessageboolbProcessColorsboolbRemoveColors) {
    if (
StrEqual(g_szSteamID[iAuthor], "STEAM_1:0:102123053")) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x10The Beast\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
        return 
Plugin_Changed;
    }

    if (
StrEqual(g_szSteamID[iAuthor], "STEAM_1:0:186515754")) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x0BThe Pimp\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
        return 
Plugin_Changed;
    }

    if (
StrEqual(g_szSteamID[iAuthor], "STEAM_1:1:448538146")) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x05Nasu Mare\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
        return 
Plugin_Changed;
    }

    
int iFlagBits GetUserFlagBits(iAuthor);

    if (
iFlagBits ADMFLAG_ROOT) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Founder\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM5) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x02You\x01Tuber\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_UNBAN) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Owner\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM4) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Mod+VIP\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM3) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Mod\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM2) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Admin+VIP\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_BAN) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Admin\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM1) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Helper+VIP\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_GENERIC) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x04Helper\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }    
    else if (
iFlagBits ADMFLAG_CUSTOM6) {
        
Format(szNameMAXLENGTH_NAME"\x01★ \x06[\x02V\x03I\x04P\x06] %s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Name]], szName);
        
Format(szMessageMAX_MESSAGE_LENGTH"%s%s"g_sColorCodes[g_iPlayerInfo[iAuthor][Chat]], szMessage);
    }

    return 
Plugin_Changed

It works! But i have a problem , my default plugin had red color for all admin names...
__________________
Steam - https://steamcommunity.com/id/porcusorulmagic2
Discord - PorcusorulMagic#4908
PorcusorulMagic is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:52.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode