AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   help with simple glow menu plugin (https://forums.alliedmods.net/showthread.php?t=342845)

vini2001 05-21-2023 10:41

help with simple glow menu plugin
 
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
https://cdn.discordapp.com/attachmen...3504/image.png

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
https://cdn.discordapp.com/attachmen...6386/image.png

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
}


QuickDroLLL 05-21-2023 15:27

Re: help with simple glow menu plugin
 
Quote:

Originally Posted by vini2001 (Post 2804757)
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
https://cdn.discordapp.com/attachmen...3504/image.png

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
https://cdn.discordapp.com/attachmen...6386/image.png

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(entityfx kRenderFxNone255255255render kRenderNormalamount 16) {
    new 
Float:RenderColor[3]
    
RenderColor[0] = float(r)
    
RenderColor[1] = float(g)
    
RenderColor[2] = float(b)
    
set_pev(entitypev_renderfxfx)
    
set_pev(entitypev_rendercolorRenderColor)
    
set_pev(entitypev_rendermoderender)
    
set_pev(entitypev_renderamtfloat(amount))
    return 
1



vini2001 05-21-2023 17:17

Re: help with simple glow menu plugin
 
Can you show me how it would look in the plugin above? would you still be able to select the colors?

QuickDroLLL 05-22-2023 06:09

Re: help with simple glow menu plugin
 
Quote:

Originally Posted by vini2001 (Post 2804783)
Can you show me how it would look in the plugin above? would you still be able to select the colors?

Try this:
PHP 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_VERSIONFCVAR_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(szConfigsDircharsmax(szConfigsDir))
    
add(szConfigsDircharsmax(szConfigsDir), "/SimpleGlowMenu.ini")
    
    new 
iFilePointer fopen(szConfigsDir"rt")
    
    if (
iFilePointer)
    {
        new 
szData[160], szKey[32], szValue[128], eGlows[Glows], iSectioni
        
        ArrayPushString
(g_aGlows"\rNone")
        
        while (!
feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(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(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '=')
                    
                            
trim(szKey)
                            
trim(szValue)
                            
                            if (
equal(szKey"GLOW_COMMANDS"))
                            {
                                while (
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(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), 13)
                            }
                            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), 07)
                            }
                            else if (
equal(szKey"GLOW_MESSAGE_TYPE"))
                            {
                                
g_eSettings[GLOW_MESSAGE_TYPE] = clamp(str_to_num(szValue), 02)
                            }
                            else if (
equal(szKey"GLOW_HUD_X"))
                            {
                                
g_eSettings[GLOW_HUD_X] = _:floatclamp(str_to_float(szValue), -1.01.0)
                            }
                            else if (
equal(szKey"GLOW_HUD_Y"))
                            {
                                
g_eSettings[GLOW_HUD_Y] = _:floatclamp(str_to_float(szValue), -1.01.0)
                            }
                            else if (
equal(szKey"GLOW_HUD_EFFECTS"))
                            {
                                
g_eSettings[GLOW_HUD_EFFECTS] = clamp(str_to_num(szValue), 02)
                            }
                            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(szDataeGlows[NAME], charsmax(eGlows[NAME]), szValuecharsmax(szValue), '=')
                            
                            
trim(eGlows[NAME])
                            
trim(szValue)
                            
                            static 
szColor[3][4]
                                
                            
parse(szValueszColor[0], charsmax(szColor[]), szColor[1], charsmax(szColor[]), szColor[2], charsmax(szColor[]))
                                
                            for (
03i++)
                            {
                                
eGlows[COLOR][i] = clamp(str_to_num(szColor[i]), 0255)
                            }
                            
                            
ArrayPushArray(g_aGlowseGlows)
                        }
                    }
                }
            }
        }
        
        
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], iMenuieGlows[Glows]
    
    
ArrayGetArray(g_aGlowsg_iGlow[id], eGlows)
    
    
formatex(szTitlecharsmax(szTitle), g_eSettings[GLOW_TITLE], eGlows[NAME])
    
    
replace_all(szTitlecharsmax(szTitle), "\n""^n")
    
replace_all(g_eSettings[GLOW_TITLE_PAGE], charsmax(g_eSettings[GLOW_TITLE_PAGE]), "\n""^n")
    
    
iMenu menu_create(szTitle"handlerGlowMenu")
    
    for (
0ArraySize(g_aGlows); i++)
    {
        
ArrayGetArray(g_aGlowsieGlows)
        
        
menu_additem(iMenuformatin("%s %s"eGlows[NAME], g_iGlow[id] == formatin("%L"id"GLOW_SELECTED") : formatin("")))
    }
    
    if (
menu_pages(iMenu) > 1)
    {
        
menu_setprop(iMenuMPROP_TITLEformatin("%s%s"szTitleg_eSettings[GLOW_TITLE_PAGE]))
    }
        
    
menu_setprop(iMenuMPROP_BACKNAMEg_eSettings[GLOW_BACK_NAME])
    
menu_setprop(iMenuMPROP_NEXTNAMEg_eSettings[GLOW_NEXT_NAME])
    
menu_setprop(iMenuMPROP_EXITNAMEg_eSettings[GLOW_EXIT_NAME])
    
menu_setprop(iMenuMPROP_PERPAGEg_eSettings[GLOW_PER_PAGE])
    
    
menu_display(idiMenu0)
    
    return 
PLUGIN_HANDLED
}

public 
handlerGlowMenu(idiMenuiItem)
{
    if (
iItem != MENU_EXIT)
    {
        static 
eGlows[Glows], szHudText[128]
        
        
ArrayGetArray(g_aGlowsiItemeGlows)
    
        
formatex(szHudTextcharsmax(szHudText), "%L"id"GLOW_ONSELECT_HUD"eGlows[NAME])
        
        if (
iItem == 0)
        {
            
g_iGlow[id] = 0
            
            FmSetUserGlow
(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
            
            FmSetUserGlow
(idkRenderFxGlowShelleGlows[COLOR][0], eGlows[COLOR][1], eGlows[COLOR][2], kRenderNormal16)
            
            switch (
g_eSettings[GLOW_MESSAGE_TYPE])
            {
                case 
0CC_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(idszHudText)
                }
                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(idszHudText)
                }
            }
        }
    }
    
    
menu_destroy(iMenu)
    
    return 
PLUGIN_HANDLED
}

stock FmSetUserGlow(entityfx kRenderFxNone255255255render kRenderNormalamount 16) {
    new 
Float:RenderColor[3]
    
RenderColor[0] = float(r)
    
RenderColor[1] = float(g)
    
RenderColor[2] = float(b)
    
set_pev(entitypev_renderfxfx)
    
set_pev(entitypev_rendercolorRenderColor)
    
set_pev(entitypev_rendermoderender)
    
set_pev(entitypev_renderamtfloat(amount))
    return 
1




All times are GMT -4. The time now is 09:46.

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