Raised This Month: $ Target: $400
 0% 

Help with ZP Hud


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 03:01.


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