Raised This Month: $51 Target: $400
 12% 

help with simple glow menu plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
vini2001
New Member
Join Date: Jun 2017
Old 05-21-2023 , 10:41   help with simple glow menu plugin
Reply With Quote #1

I wanted some help with the simple glow menu plugin, because on my server it looks like this in the players! like the picture below


and i would like it to stay that way, like a CSDM respawn, that protection of seconds, currently the plugin makes the brightness with the very big border and not in the model player


Code:
#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <formatin>
#include <fun>

#if AMXX_VERSION_NUM < 183
	#include <dhudmessage>
#endif

#define PLUGIN_VERSION "2.0"

enum _:Settings
{
	GLOW_TEAM,
	GLOW_FLAG,
	GLOW_TITLE[128],
	GLOW_TITLE_PAGE[64],
	GLOW_BACK_NAME[32],
	GLOW_NEXT_NAME[32],
	GLOW_EXIT_NAME[32],
	GLOW_PER_PAGE,
	GLOW_MESSAGE_TYPE,
	Float:GLOW_HUD_X,
	Float:GLOW_HUD_Y,
	GLOW_HUD_EFFECTS,
	Float:GLOW_HUD_EFFTIME,
	Float:GLOW_HUD_HOLDTIME
}

enum _:Glows
{
	NAME[32],
	COLOR[3]
}

enum
{
	SECTION_SETTINGS,
	SECTION_GLOWS
}

new Array:g_aGlows
new g_eSettings[Settings]
new g_iGlow[33]

public plugin_init()
{
	register_plugin("Simple Glow Menu", PLUGIN_VERSION, "Unbr3akable")
	
	register_cvar("SimpleGlowMenu", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
	
	register_dictionary("SimpleGlowMenu.txt")
}

public plugin_cfg()
{
	g_aGlows = ArrayCreate(Glows)
	
	ReadFile()
}

public plugin_end()
{
	ArrayDestroy(g_aGlows)
}
	
ReadFile()
{
	new szConfigsDir[64]
	
	get_configsdir(szConfigsDir, charsmax(szConfigsDir))
	add(szConfigsDir, charsmax(szConfigsDir), "/SimpleGlowMenu.ini")
	
	new iFilePointer = fopen(szConfigsDir, "rt")
	
	if (iFilePointer)
	{
		new szData[160], szKey[32], szValue[128], eGlows[Glows], iSection, i
		
		ArrayPushString(g_aGlows, "\rNone")
		
		while (!feof(iFilePointer))
		{
			fgets(iFilePointer, szData, charsmax(szData))
			
			trim(szData)
			
			switch (szData[0])
			{
				case EOS, ';': continue
				case '[':
				{
					if (szData[strlen(szData) -1] == ']')
					{
						if (containi(szData, "settings") != -1)
						{
							iSection = SECTION_SETTINGS
						}
						else if (containi(szData, "glows") != -1)
						{
							iSection = SECTION_GLOWS
						}
					}
					
					else continue
				}
				default:
				{	
					switch (iSection)
					{
						case SECTION_SETTINGS:
						{
							strtok(szData, szKey, charsmax(szKey), szValue, charsmax(szValue), '=')
					
							trim(szKey)
							trim(szValue)
							
							if (equal(szKey, "GLOW_COMMANDS"))
							{
								while (szValue[0] != 0 && strtok(szValue, szKey, charsmax(szKey), szValue, charsmax(szValue), ','))
								{
									trim(szKey)
									trim(szValue)
								
									register_clcmd(szKey, "cmdGlowMenu")
								}
							}
							else if (equal(szKey, "GLOW_PREFIX"))
							{
								CC_SetPrefix(szValue)
							}
							else if (equal(szKey, "GLOW_TEAM"))
							{
								g_eSettings[GLOW_TEAM] = clamp(str_to_num(szValue), 1, 3)
							}
							else if (equal(szKey, "GLOW_FLAG"))
							{
								g_eSettings[GLOW_FLAG] = szValue[0] == EOS ? ADMIN_ALL : read_flags(szValue)
							}
							else if (equal(szKey, "GLOW_TITLE"))
							{
								copy(g_eSettings[GLOW_TITLE], charsmax(g_eSettings[GLOW_TITLE]), szValue)
							}
							else if (equal(szKey, "GLOW_TITLE_PAGE"))
							{
								copy(g_eSettings[GLOW_TITLE_PAGE], charsmax(g_eSettings[GLOW_TITLE_PAGE]), szValue)
							}
							else if (equal(szKey, "GLOW_BACK_NAME"))
							{
								copy(g_eSettings[GLOW_BACK_NAME], charsmax(g_eSettings[GLOW_BACK_NAME]), szValue)
							}
							else if (equal(szKey, "GLOW_NEXT_NAME"))
							{
								copy(g_eSettings[GLOW_NEXT_NAME], charsmax(g_eSettings[GLOW_NEXT_NAME]), szValue)
							}
							else if (equal(szKey, "GLOW_EXIT_NAME"))
							{
								copy(g_eSettings[GLOW_EXIT_NAME], charsmax(g_eSettings[GLOW_EXIT_NAME]), szValue)
							}
							else if (equal(szKey, "GLOW_PER_PAGE"))
							{
								g_eSettings[GLOW_PER_PAGE] = clamp(str_to_num(szValue), 0, 7)
							}
							else if (equal(szKey, "GLOW_MESSAGE_TYPE"))
							{
								g_eSettings[GLOW_MESSAGE_TYPE] = clamp(str_to_num(szValue), 0, 2)
							}
							else if (equal(szKey, "GLOW_HUD_X"))
							{
								g_eSettings[GLOW_HUD_X] = _:floatclamp(str_to_float(szValue), -1.0, 1.0)
							}
							else if (equal(szKey, "GLOW_HUD_Y"))
							{
								g_eSettings[GLOW_HUD_Y] = _:floatclamp(str_to_float(szValue), -1.0, 1.0)
							}
							else if (equal(szKey, "GLOW_HUD_EFFECTS"))
							{
								g_eSettings[GLOW_HUD_EFFECTS] = clamp(str_to_num(szValue), 0, 2)
							}
							else if (equal(szKey, "GLOW_HUD_EFFTIME"))
							{
								g_eSettings[GLOW_HUD_EFFTIME] = _:str_to_float(szValue)
							}
							else if (equal(szKey, "GLOW_HUD_HOLDTIME"))
							{
								g_eSettings[GLOW_HUD_HOLDTIME] = _:str_to_float(szValue)
							}
						}
						case SECTION_GLOWS:
						{
							strtok(szData, eGlows[NAME], charsmax(eGlows[NAME]), szValue, charsmax(szValue), '=')
							
							trim(eGlows[NAME])
							trim(szValue)
							
							static szColor[3][4]
								
							parse(szValue, szColor[0], charsmax(szColor[]), szColor[1], charsmax(szColor[]), szColor[2], charsmax(szColor[]))
								
							for (i = 0; i < 3; i++)
							{
								eGlows[COLOR][i] = clamp(str_to_num(szColor[i]), 0, 255)
							}
							
							ArrayPushArray(g_aGlows, eGlows)
						}
					}
				}
			}
		}
		
		fclose(iFilePointer)
	}
}

public client_putinserver(id)
{
	g_iGlow[id] = 0
}
	
public cmdGlowMenu(id)
{
	if (~get_user_flags(id) & g_eSettings[GLOW_FLAG])
	{
		CC_SendMessage(id, "%L", id, "GLOW_NOACCESS")
		
		return PLUGIN_HANDLED
	}
	
	if (get_user_team(id) != g_eSettings[GLOW_TEAM] && g_eSettings[GLOW_TEAM] != EOS)
	{
		CC_SendMessage(id, "%L", id, "GLOW_NOTEAM")
		
		return PLUGIN_HANDLED
	}
	
	static szTitle[128], iMenu, i, eGlows[Glows]
	
	ArrayGetArray(g_aGlows, g_iGlow[id], eGlows)
	
	formatex(szTitle, charsmax(szTitle), g_eSettings[GLOW_TITLE], eGlows[NAME])
	
	replace_all(szTitle, charsmax(szTitle), "\n", "^n")
	replace_all(g_eSettings[GLOW_TITLE_PAGE], charsmax(g_eSettings[GLOW_TITLE_PAGE]), "\n", "^n")
	
	iMenu = menu_create(szTitle, "handlerGlowMenu")
	
	for (i = 0; i < ArraySize(g_aGlows); i++)
	{
		ArrayGetArray(g_aGlows, i, eGlows)
		
		menu_additem(iMenu, formatin("%s %s", eGlows[NAME], g_iGlow[id] == i ? formatin("%L", id, "GLOW_SELECTED") : formatin("")))
	}
	
	if (menu_pages(iMenu) > 1)
	{
		menu_setprop(iMenu, MPROP_TITLE, formatin("%s%s", szTitle, g_eSettings[GLOW_TITLE_PAGE]))
	}
		
	menu_setprop(iMenu, MPROP_BACKNAME, g_eSettings[GLOW_BACK_NAME])
	menu_setprop(iMenu, MPROP_NEXTNAME, g_eSettings[GLOW_NEXT_NAME])
	menu_setprop(iMenu, MPROP_EXITNAME, g_eSettings[GLOW_EXIT_NAME])
	menu_setprop(iMenu, MPROP_PERPAGE, g_eSettings[GLOW_PER_PAGE])
	
	menu_display(id, iMenu, 0)
	
	return PLUGIN_HANDLED
}

public handlerGlowMenu(id, iMenu, iItem)
{
	if (iItem != MENU_EXIT)
	{
		static eGlows[Glows], szHudText[128]
		
		ArrayGetArray(g_aGlows, iItem, eGlows)
	
		formatex(szHudText, charsmax(szHudText), "%L", id, "GLOW_ONSELECT_HUD", eGlows[NAME])
		
		if (iItem == 0)
		{
			g_iGlow[id] = 0
			
			set_user_rendering(id)
			
			CC_SendMessage(id, "%L", id, "GLOW_REMOVE")
			
			return PLUGIN_HANDLED
		}
		
		if (g_iGlow[id] == iItem)
		{
			CC_SendMessage(id, "%L", id, "GLOW_ALREADY")
		}
		else
		{
			g_iGlow[id] = iItem
			
			set_user_rendering(id, kRenderFxGlowShell, eGlows[COLOR][0], eGlows[COLOR][1], eGlows[COLOR][2])
			
			switch (g_eSettings[GLOW_MESSAGE_TYPE])
			{
				case 0: CC_SendMessage(id, "%L", id, "GLOW_ONSELECT_CHAT", eGlows[NAME])
				case 1:
				{
					set_hudmessage(eGlows[COLOR][0], eGlows[COLOR][1], eGlows[COLOR][2], g_eSettings[GLOW_HUD_X], g_eSettings[GLOW_HUD_Y],
					g_eSettings[GLOW_HUD_EFFECTS], g_eSettings[GLOW_HUD_EFFTIME], g_eSettings[GLOW_HUD_HOLDTIME])
					
					show_hudmessage(id, szHudText)
				}
				case 2:
				{
					set_dhudmessage(eGlows[COLOR][0], eGlows[COLOR][1], eGlows[COLOR][2], g_eSettings[GLOW_HUD_X], g_eSettings[GLOW_HUD_Y],
					g_eSettings[GLOW_HUD_EFFECTS], g_eSettings[GLOW_HUD_EFFTIME], g_eSettings[GLOW_HUD_HOLDTIME])
					
					show_dhudmessage(id, szHudText)
				}
			}
		}
	}
	
	menu_destroy(iMenu)
	
	return PLUGIN_HANDLED
}
vini2001 is offline
 



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 07:02.


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