Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
|
05-21-2023
, 15:27
Re: help with simple glow menu plugin
|
#2
|
Quote:
Originally Posted by vini2001
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
}
|
the pictures they are models not glow: https://gamebanana.com/mods/225679
and to get perfect glow maybe you need change set user rendering to this
and add the amount as default = 16 to get perfect glow.
it should look like this for tr for example: FmSetUserGlow(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 16)
it should look like this for ct for example: FmSetUserGlow(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 16)
PHP Code:
stock FmSetUserGlow(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { new Float:RenderColor[3] RenderColor[0] = float(r) RenderColor[1] = float(g) RenderColor[2] = float(b) set_pev(entity, pev_renderfx, fx) set_pev(entity, pev_rendercolor, RenderColor) set_pev(entity, pev_rendermode, render) set_pev(entity, pev_renderamt, float(amount)) return 1 }
Last edited by QuickDroLLL; 05-21-2023 at 15:35.
|
|