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

Help with ZP Hud


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sfjdfjdfj
New Member
Join Date: Jan 2020
Old 01-12-2020 , 20:21   Help with ZP Hud
Reply With Quote #1

Hello, what I want is to change the color of the hud but change from several colors that transforms, for example, to green and then transforms to green

I don't know if it's possible? I had a zombie plague where that could be but I wanted to know how, My hud changes color but only blinks white

This is the part of the script where the hud is located


if(g_hud_type[ID_SHOWHUD] == 0) { // Default
set_hudmessage(40, 230, 76, -8.0, 0.75, 1, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync[1], "|%s|^n|%L - %s| - |%L - %s|^n|%L - %s| - |%L - %s|^n", g_playername[ID_SHOWHUD], id, "ZOMBIE_ATTRIB1", add_point(get_user_health(ID_SHOWHUD)), id, "ZOMBIE_ATTRIB5", add_point(get_user_armor(ID_SHOWHUD)), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1",
add_point(g_ammopacks[ID_SHOWHUD]))

}
sfjdfjdfj is offline
sfjdfjdfj
New Member
Join Date: Jan 2020
Old 01-12-2020 , 20:22   Re: Help with ZP Hud
Reply With Quote #2

I clarify what I want is not to change color, what I want is for the same hud to change color as time goes by and change to several colors
sfjdfjdfj is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-13-2020 , 14:19   Re: Help with ZP Hud
Reply With Quote #3

If you want to use random colors, simply replace the first 3 arguments in "set_hudmessage" with "random(256)".

If you want to use a predefined set of colors of your choioce, then things will get a little more complicated. You will need to create a 3-dimensional array that holds each set of colors, and then iterate that array and use its elements as arguments in "set_hudmessage".

Example of how the array should be created:

Code:
static const HUD_COLORS[][] = {     { 255, 0, 0 },     { 0, 255, 0 },     { 0, 0, 255 },     { 255, 255, 255 } }

* Note: I used "static" because I defined it as a local array. If you need to use it in more than one place, define it as a global variable using "new".

Add/remove as many colors as you want.

Then you will need a variable (global new or local static) that holds the current iteration, starting from 0, up to the size of the array.

Code:
static CURRENT_COLOR

Then, use the "set_hudmessage" function with the current color set:

Code:
set_hudmessage(HUD_COLORS[CURRENT_COLOR][0], HUD_COLORS[CURRENT_COLOR][1], HUD_COLORS[CURRENT_COLOR][2], /* all other arguments stay the same */)

Display the message and all other stuff related to it.

Next, add +1 to the "CURRENT_COLOR" variable. If it reached the end of the array, reset it back to 0.

Code:
if(++CURRENT_COLOR == sizeof(HUD_COLORS)) {     CURRENT_COLOR = 0 }
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 01-13-2020 , 18:05   Re: Help with ZP Hud
Reply With Quote #4

I recommend keeping red to at least 50(random_num(50, 255)) if you're gonna use fully random colors or else you will just get washed out or ugly ones.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 01-14-2020 , 09:32   Re: Help with ZP Hud
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
If you want to use random colors, simply replace the first 3 arguments in "set_hudmessage" with "random(256)".

If you want to use a predefined set of colors of your choioce, then things will get a little more complicated. You will need to create a 3-dimensional array that holds each set of colors, and then iterate that array and use its elements as arguments in "set_hudmessage".

Example of how the array should be created:

Code:
static const HUD_COLORS[][] = {     { 255, 0, 0 },     { 0, 255, 0 },     { 0, 0, 255 },     { 255, 255, 255 } }

* Note: I used "static" because I defined it as a local array. If you need to use it in more than one place, define it as a global variable using "new".

Add/remove as many colors as you want.

Then you will need a variable (global new or local static) that holds the current iteration, starting from 0, up to the size of the array.

Code:
static CURRENT_COLOR

Then, use the "set_hudmessage" function with the current color set:

Code:
set_hudmessage(HUD_COLORS[CURRENT_COLOR][0], HUD_COLORS[CURRENT_COLOR][1], HUD_COLORS[CURRENT_COLOR][2], /* all other arguments stay the same */)

Display the message and all other stuff related to it.

Next, add +1 to the "CURRENT_COLOR" variable. If it reached the end of the array, reset it back to 0.

Code:
if(++CURRENT_COLOR == sizeof(HUD_COLORS)) {     CURRENT_COLOR = 0 }
Can you make a n Admin chat @ color for me ?
Abhinash is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-14-2020 , 09:42   Re: Help with ZP Hud
Reply With Quote #6

Quote:
Originally Posted by Abhinash View Post
Can you make a n Admin chat @ color for me ?
How is this related to the thread?

https://forums.alliedmods.net/showthread.php?t=272418
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



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 23:37.


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