Raised This Month: $32 Target: $400
 8% 

Solved Generate a random RGB color


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
farawayf
Senior Member
Join Date: Jan 2019
Old 03-23-2019 , 14:07   Generate a random RGB color
Reply With Quote #1

Hello. How to generate a random RGB color on function call and set to char for
PHP Code:

DispatchKeyValue
(entity"m_Color"rgb ); //here need to set a random rgb on every call. example of random rgb - 255 255 255 

Last edited by farawayf; 03-23-2019 at 15:45.
farawayf is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 03-23-2019 , 14:19   Re: Genrate random RGB color
Reply With Quote #2

PHP Code:
int rgb[3];
rgb[0] = GetRandomInt(0255);
rgb[1] = GetRandomInt(0255);
rgb[2] = GetRandomInt(0255);

char sColor[16];
Format(sColorsizeof(sColor), "%i %i %i"rgb[0], rgb[1], rgb[2]);

DispatchKeyValue(entity"m_Color"sColor); 
CliptonHeist is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 03-23-2019 , 15:42   Re: Genrate random RGB color
Reply With Quote #3

a lot of thanks, CliptonHeist.
I broke my brain looking for it all day lol.

Last edited by farawayf; 03-23-2019 at 15:43.
farawayf 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 12:18.


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