Raised This Month: $32 Target: $400
 8% 

[L4D2]Glow Menu Plugin modification/re-edit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Darkwob
BANNED
Join Date: Oct 2018
Old 03-17-2021 , 11:19   [L4D2]Glow Menu Plugin modification/re-edit
Reply With Quote #1

an author edited this plugin from cs GO for left 4 dead 2, but the plugin only says "none" in the menu glow color options do not come. how do I fix this.



PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma newdecls required
#pragma semicolon 1

Handle db;

ArrayList g_GlowColor;
ArrayList g_GlowColorName;

// Server ConVars;
ConVar sv_force_transmit_players;
ConVar g_CVAR_GlowColor_Style;
ConVar g_CVAR_GlowColor_Flag;
ConVar g_CVAR_GlowColor_Prefix;

int g_GlowColor_Style;
int g_GlowColor_Flag;

char g_GlowColor_Prefix[40];

int playerModels[MAXPLAYERS 1];
int playerModelsIndex[MAXPLAYERS 1];

int force_transmit;

int GlowIndex[MAXPLAYERS 1];

char g_GlowColorPath[PLATFORM_MAX_PATH];

public 
Plugin myinfo =
{
    
name        "[L4D2 Glow Menu]",
    
author      "Hallucinogenic Troll (Glow code compatible for L4D2 by Foxhound27)",
    
description "Allow users to activate Glow to themselves",
    
version     "1.0",
    
url         "https://forums.alliedmods.net/showpost.php?p=2666309&postcount=12"
};

public 
void OnPluginStart()
{
    
g_GlowColor = new ArrayList(256);
    
g_GlowColorName = new ArrayList(256);
    
    
SQL_TConnect(OnSQLConnect"glow_menu");
    
    
sv_force_transmit_players     =     FindConVar("sv_force_transmit_players");
    
    
g_CVAR_GlowColor_Style CreateConVar("sm_glowmenu_style""3""Type of Style that you want to the glow (3 gives WALLHACKS to everyone)"_true0.0true3.0);
    
/* types 

0 = None
1 = Use
2 = Look At
3 = Constant

*/

    
g_CVAR_GlowColor_Flag CreateConVar("sm_glowmenu_flag""""Only gives the glow to players with a certain flag");
    
g_CVAR_GlowColor_Prefix CreateConVar("sm_glowmenu_prefix""[Glow Menu]""Chat's Prefix");
    
    
    
BuildPath(Path_SMg_GlowColorPathsizeof(g_GlowColorPath), "configs/glow_menu.ini");
    
    
RegConsoleCmd("sm_glow"Command_GlowMenu"Glow Color Menu");
    
    
HookEvent("player_spawn",     Event_PlayerSpawn);
    
HookEvent("player_death",     Event_PlayerDeath);
    
    
AutoExecConfig(true"glow_menu");
    
LoadTranslations("glow_menu.phrases");
}

public 
void OnConfigsExecuted()
{
    
g_GlowColor.Clear();
    
g_GlowColorName.Clear();
    
force_transmit sv_force_transmit_players.IntValue;
    
    
g_GlowColor_Style g_CVAR_GlowColor_Style.IntValue;
    
    
g_CVAR_GlowColor_Prefix.GetString(g_GlowColor_Prefixsizeof(g_GlowColor_Prefix));
    
    
char buffer[40];
    
g_CVAR_GlowColor_Flag.GetString(buffersizeof(buffer));
    
    
g_GlowColor_Flag ReadFlagString(buffer);
    
    if(
force_transmit == 0)
    {
        
sv_force_transmit_players.SetInt(1true);
    }
    
    
KeyValues kv CreateKeyValues("glow_colors");
    
kv.ImportFromFile(g_GlowColorPath);

    if (!
kv.GotoFirstSubKey())
    {
        return;
    }
    
    
char colors[150];
    
char colors2[150][3];
    
int icolors[3];
    
char name[150];
    do
    {
        
kv.GetString("name"namesizeof(name));
        
kv.GetString("color"colorssizeof(colors));
        
        
ExplodeString(colors" "colors23sizeof(colors));
        
        for (
int i 03i++)
        {
            
icolors[0] = StringToInt(colors2[i]);
        }
        
        
g_GlowColor.PushArray(icolors);
        
g_GlowColorName.PushString(name);
        
    } while (
kv.GotoNextKey());
    
    
delete kv;
}

public 
int OnSQLConnect(Handle ownerHandle hndlchar [] errorany data)
{
    if(
hndl == INVALID_HANDLE)
    {
        
LogError("[GLOW COLOR] Error: %s"error);
        
        
SetFailState("Databases dont work");
    }
    else
    {
        
db hndl;
        
        
char buffer[3096];
        
SQL_GetDriverIdent(SQL_ReadDriver(db), buffersizeof(buffer));
        
        if(
StrEqual(buffer,"mysql"false))
        {
            
Format(buffersizeof(buffer), "CREATE TABLE IF NOT EXISTS glow(SteamID NVARCHAR(64) NOT NULL DEFAULT '', color INT NOT NULL DEFAULT 0);");
            
SQL_TQuery(dbOnSQLConnectCallbackbuffer);
        }
    }
}

public 
int OnSQLConnectCallback(Handle ownerHandle hndlchar [] errorany data)
{
    if(
hndl == INVALID_HANDLE)
    {
        
LogError("[GLOW COLOR] Error: %s"error);
        return;
    }

    
    for(
int client 1client <= MaxClientsclient++)
    {
        if(
IsClientInGame(client))
        {
            
OnClientPostAdminCheck(client);
        }
    }
}

public 
void OnClientPostAdminCheck(int client)
{
    
playerModelsIndex[client] = -1;
    
playerModels[client] = INVALID_ENT_REFERENCE;
    
    
GlowIndex[client] = -1;
    
    
char SteamID[64];
    
GetClientAuthId(clientAuthId_Steam3SteamIDsizeof(SteamID));
    
    if(
db != INVALID_HANDLE)
    {
        
char buffer[1024];
        
Format(buffersizeof(buffer), "SELECT * FROM glow WHERE SteamID = '%s';"SteamID);
        
SQL_TQuery(dbSQL_LoadPlayerCallbackbufferclient);
    }
}

public 
void SQL_LoadPlayerCallback(Handle DBHandle results, const char[] errorany client)
{
    if(!
IsClientInGame(client) || IsFakeClient(client))
    {
        return;
    }
    
    if(
results == INVALID_HANDLE)
    {
        
LogError("[GLOW COLOR] Error: %s"error);
        return;
    }

    if(
SQL_HasResultSet(results) && SQL_FetchRow(results))
    {
        
GlowIndex[client] = SQL_FetchInt(results1);
    }
    else
    {
        
char buffer[2056];
        
char SteamID[64];
        
GetClientAuthId(clientAuthId_Steam3SteamIDsizeof(SteamID));
        
Format(buffersizeof(buffer), "INSERT INTO glow(SteamID, color) VALUES ('%s', -1)"SteamID);
        
SQL_TQuery(dbSQL_NothingCallbackbuffer);
    }
    
}

public 
void OnClientDisconnect(int client)
{
    if(!
IsValidClient(client))
    {
        return;
    }
    
    if(
db != INVALID_HANDLE)
    {
        
char buffer[1024];
        
char SteamID[64];
        
GetClientAuthId(clientAuthId_Steam3SteamIDsizeof(SteamID));
        
Format(buffersizeof(buffer), "UPDATE glow SET color = %d WHERE SteamID = '%s';"GlowIndex[client], SteamID);
        
SQL_TQuery(dbSQL_NothingCallbackbuffer);
    }
}

public 
int SQL_NothingCallback(Handle ownerHandle hndl, const char[] errorany client)
{
    if (
hndl == INVALID_HANDLE)
    {
        
LogError("[GLOW COLOR] Error: %s"error);
        return;
    }
}



public 
Action Command_GlowMenu(int clientint args)
{
    if (!
IsValidClient(client))
    {
        return;
    }
    
    if(!
CheckCommandAccess(client""g_GlowColor_Flagtrue))
    {
        
CPrintToChat(client"%s %t"g_GlowColor_Prefix"NoPermission");
        return;
    }
    
    
char buffer[256];
    
Menu menu = new Menu(Menu_Glow_Handler);
    
Format(buffersizeof(buffer), "%t""MenuTitle");
    
menu.SetTitle(buffer);
    
Format(buffersizeof(buffer), "%t""MenuNone");
    
menu.AddItem("-1"buffer);
    for (
int i 0g_GlowColorName.Lengthi++)
    {
        
g_GlowColorName.GetString(ibuffersizeof(buffer));
        
menu.AddItem(bufferbuffer);
    }
    
menu.ExitButton true;
    
menu.Display(client20);
}

public 
int Menu_Glow_Handler(Menu menuMenuAction actionint clientint choice)
{
    if(
action == MenuAction_Select)
    {
        
GlowIndex[client] = choice 1;
        if(
choice == 0)
        {
            
CPrintToChat(client"%s %t"g_GlowColor_Prefix"DisabledGlow");
        }
        else
        {    
            
char info[256];
            
menu.GetItem(choiceinfosizeof(info));
            
            
CPrintToChat(client"%s %t"g_GlowColor_Prefix"ChangedGlowColor"info);
        }
    }
    else if(
action == MenuAction_End)
    {
        
delete menu;
    }
}

public 
Action Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
    if(!
IsValidClient(client) || GlowIndex[client] == -|| !CheckCommandAccess(client""g_GlowColor_Flagtrue))
    {
        return;
    }
    
    
CreateGlow(client);
}

public 
Action Event_PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
    if(!
IsValidClient(client) || GlowIndex[client] == -|| !CheckCommandAccess(client""g_GlowColor_Flagtrue))
    {
        return;
    }
    
    
SetupGlow(clientclient0);
}

public 
void CreateGlow(int client
{    
    
SetupGlow(clientclientg_GlowColor_Style);
}

public 
Action OnSetTransmit_All(int entityint client)
{
    if(
playerModelsIndex[client] != entity)
    {
        return 
Plugin_Continue;
    }
    return 
Plugin_Handled;
}

public 
void SetupGlow(int entityint clientint value)
{
    
char netclass[128];
    
GetEntityNetClass(entitynetclasssizeof netclass);
    
int offset FindSendPropInfo(netclass"m_iGlowType");
    
    if (
offset 1)
    {
        
LogError("Unable to find property offset: \"m_iGlowType\"!");
        return;
    }


    
SetEntProp(entityProp_Send"m_iGlowType"value);
    
SetEntProp(entityProp_Send"m_nGlowRange"100);
    
SetEntProp(entityProp_Send"m_nGlowRangeMin"100);

    
int colors[3];
    
g_GlowColor.GetArray(GlowIndex[client], colors);

    
SetEntProp(entityProp_Send"m_glowColorOverride"colors[0] + (colors[1] * 256) + (colors[2] * 65536));


void CPrintToChat(int clientchar[] messageany ...)
{
    static 
char buffer[256];
    
VFormat(buffersizeof(buffer), message3);

    
ReplaceString(buffersizeof(buffer), "{default}",        "\x01");
    
ReplaceString(buffersizeof(buffer), "{purple}",        "\x04");
    
ReplaceString(buffersizeof(buffer), "{blue}",            "\x05");
    
PrintToChat(clientbuffer);
}

public 
bool IsValidClient(int client)
{
    return (
<= client && client <= MaxClients && IsClientInGame(client));


Last edited by Darkwob; 03-17-2021 at 11:44.
Darkwob is offline
Darkwob
BANNED
Join Date: Oct 2018
Old 03-17-2021 , 15:35   Re: [L4D2]Glow Menu Plugin modification/re-edit
Reply With Quote #2

Quote:
L 03/17/2021 - 22:247: [SM] Exception reported: Invalid convar handle 0 (error 4)
L 03/17/2021 - 22:247: [SM] Blaming: ps_bess.smx
L 03/17/2021 - 22:247: [SM] Call stack trace:
L 03/17/2021 - 22:247: [SM] [0] ConVar.IntValue.get
L 03/17/2021 - 22:247: [SM] [1] Line 165, plugin.sp::populatePriceMap
L 03/17/2021 - 22:247: [SM] [2] Line 385, plugin.sp::OnConfigsExecuted
L 03/17/2021 - 22:247: [SM] Exception reported: Invalid convar handle 0 (error 4)
L 03/17/2021 - 22:247: [SM] Blaming: glow_menu.smx
L 03/17/2021 - 22:247: [SM] Call stack trace:
L 03/17/2021 - 22:247: [SM] [0] ConVar.IntValue.get
L 03/17/2021 - 22:247: [SM] [1] Line 80, E:\FOX SERVER\glow_menu.sp::OnConfigsExecuted
Darkwob is offline
Darkwob
BANNED
Join Date: Oct 2018
Old 06-02-2021 , 11:01   Re: [L4D2]Glow Menu Plugin modification/re-edit
Reply With Quote #3

not fix this problem guys.
Darkwob is offline
Et3rnity
Member
Join Date: Sep 2018
Location: Romania
Old 06-02-2021 , 13:51   Re: [L4D2]Glow Menu Plugin modification/re-edit
Reply With Quote #4

You have this in glow_menu.ini
Code:
"glow_colors"
{
  "0"
  {
    "name" "White"
    "color" "255 255 255"
  }
  "1"
  {
    "name" "Red"
    "color" "255 0 0"
  }
  "2"
  {
    "name" "Green"
    "color" "0 255 0"
  }
  "3"
  {
    "name" "Blue"
    "color" "0 0 255"
  }
  "4"
  {
    "name" "Yellow"
    "color" "255 255 0"
  }
  "5"
  {
    "name" "Brown"
    "color" "165 42 42"
  }
  "6"
  {
    "name" "Pink"
    "color" "255 192 203"
  }
  "7"
  {
    "name" "Purple"
    "color" "128 0 128"
  }
  "8"
  {
    "name" "Grey"
    "color" "128 128 128"
  }

}
__________________
Et3rnity is offline
Darkwob
BANNED
Join Date: Oct 2018
Old 06-02-2021 , 18:45   Re: [L4D2]Glow Menu Plugin modification/re-edit
Reply With Quote #5

Quote:
Originally Posted by Et3rnity View Post
You have this in glow_menu.ini
Code:
"glow_colors"
{
  "0"
  {
    "name" "White"
    "color" "255 255 255"
  }
  "1"
  {
    "name" "Red"
    "color" "255 0 0"
  }
  "2"
  {
    "name" "Green"
    "color" "0 255 0"
  }
  "3"
  {
    "name" "Blue"
    "color" "0 0 255"
  }
  "4"
  {
    "name" "Yellow"
    "color" "255 255 0"
  }
  "5"
  {
    "name" "Brown"
    "color" "165 42 42"
  }
  "6"
  {
    "name" "Pink"
    "color" "255 192 203"
  }
  "7"
  {
    "name" "Purple"
    "color" "128 0 128"
  }
  "8"
  {
    "name" "Grey"
    "color" "128 128 128"
  }

}
yes i have this. but it never gets better.
Darkwob is offline
King_OXO
Senior Member
Join Date: Dec 2020
Location: Brazil
Old 06-13-2021 , 14:21   Re: [L4D2]Glow Menu Plugin modification/re-edit
Reply With Quote #6

Quote:
Originally Posted by Darkwob View Post
yes i have this. but it never gets better.
try my plugin man

commands: !aura for aura menu
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_aura.sp - 72 views - 6.1 KB)

Last edited by King_OXO; 06-13-2021 at 14:27.
King_OXO is offline
Reply



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 03:08.


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