View Single Post
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 04-13-2023 , 09:09   Re: Menu to choose color for hud
Reply With Quote #15

Quote:
Originally Posted by fysiks View Post
Can you translate this to English?
It means a temporary solution to answer my question
Anyway, this is what I wrote with the help of it
PHP Code:
#include <amxmodx>

new bool:Colortype;

new 
iRediGreeniBlue;

enum _:Colors
{
    
Name[32],
    
Red,
    
Green,
    
Blue,
    
Info[3]
}

new const 
g_Colors[][Colors] =
{
    { 
"Red"25500"0" },
    { 
"Green"02550"1" },
    { 
"Blue"00255"2" },
    { 
"Random"000"*" }
}

public 
plugin_init()
{
    
register_clcmd("say /test""hudMenu")
    
set_task(1.0"Test", .flags "b")
}

public 
Test()
{
    
set_hudmessage(Colortype random(255) : iRedColortype random(255) : iGreenColortype random(255) : iBlue0.50.500.10.10.50.15,4)
    
show_hudmessage(0,"Test")
}

public 
hudMenu(id)
{
    new 
iMenu menu_create("Hud Menu""hudHandler")
    
    for(new 
isizeof(g_Colors); i++)
        
menu_additem(iMenug_Colors[i][Name], g_Colors[i][Info])
    
menu_display(idiMenu0)

    return 
PLUGIN_HANDLED
}

public 
hudHandler(idiMenuiItem){
    if(
iItem == MENU_EXIT)
    {
        
menu_destroy(iMenu);
        return 
PLUGIN_HANDLED;
    }
    static 
iAccessszInfo[2], hCallback;
    
menu_item_getinfo(iMenuiItemiAccessszInfo1__hCallback);
    
    if(
szInfo[0] == '*'
    {
        
Colortype =! Colortype;
    }
    else
    {
        
iRed g_Colors[iItem][Red];
        
iGreen g_Colors[iItem][Green];
        
iBlue g_Colors[iItem][Blue];
    }
    
hudMenu(id)
    return 
PLUGIN_HANDLED

__________________
amirwolf is offline