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

Menu to choose color for hud


Post New Thread Reply   
 
Thread Tools Display Modes
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 04-12-2023 , 15:44   Re: Menu to choose color for hud
Reply With Quote #11

Sorry to update this post again
I used this method to reach Rahel
https://forums.alliedmods.net/showpo...1&postcount=17
But isn't there another way for it?
__________________
amirwolf is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-12-2023 , 18:57   Re: Menu to choose color for hud
Reply With Quote #12

Does it work? If it works, why do you need to do it any other way? It it doesn't work, what more questions do you have?
__________________
fysiks is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 04-12-2023 , 19:41   Re: Menu to choose color for hud
Reply With Quote #13

Because I want to use another structure
Is there a problem?
that you are against its expression
__________________
amirwolf is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-13-2023 , 00:57   Re: Menu to choose color for hud
Reply With Quote #14

You're certainly welcome to request something else but how do we know what you want if you don't explain what about the working option isn't what you want.

As far as I can tell, your original code looked just fine. All you need to do to add a "random" option is to add a "Random" option to the menu and if that option is chosen then use random values for RGB instead of the values from the array. The easiest would be to add the "Random" option as the last menu option (after your for loop). Then in the menu handler check if iItem is equal to sizeof(g_Colors) then use random values otherwise, index g_Colors like you already do.

Quote:
Originally Posted by amirwolf View Post
I used this method to reach Rahel
What does this mean? Can you translate this to English?
__________________
fysiks is offline
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
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-13-2023 , 22:42   Re: Menu to choose color for hud
Reply With Quote #16

Quote:
Originally Posted by amirwolf View Post
It means a temporary solution to answer my question
Thanks. I wasn't having luck just putting it into a translator hoping that it would detect the language.

Quote:
Originally Posted by amirwolf View Post
Anyway, this is what I wrote with the help of it
PHP Code:
... 
That looks good. I'm glad you were able to get something working.
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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 20:25.


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