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

how to make random in enum


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 02-21-2018 , 13:00   how to make random in enum
Reply With Quote #1

hi guys..

i have enum

PHP Code:
enum
{
MODE_NONE 0,    
MODE_INFECTION,
MODE_NEMESIS,
MODE_ASSASSIN,
MODE_SURVIVOR,
MODE_SNIPER,
MODE_SWARM,
MODE_MULTI,
MODE_PLAGUE,
MODE_ARMAGEDDON
MODE_APOCALYPSE,
MODE_NIGHTMARE
}; 
and the call is

PHP Code:
cmdMakeZombie (MODE_NONE0); 
how can i make random in red color
__________________

Last edited by arvEL.; 02-21-2018 at 13:04.
arvEL. is offline
Send a message via Skype™ to arvEL.
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-21-2018 , 15:48   Re: how to make random in enum
Reply With Quote #2

Make what random? And what does the red color have to do with anything you posted?
Your post is missing too much information.
__________________

Last edited by klippy; 02-21-2018 at 15:48.
klippy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-21-2018 , 20:36   Re: how to make random in enum
Reply With Quote #3

If your enum is always continuous, you can do: random_num(MODE_NONE, MODE_NIGHTMARE) as long as the second one is the last one.
__________________
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-22-2018 , 06:28   Re: how to make random in enum
Reply With Quote #4

Add this to ur enum (+=1)
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-22-2018 , 20:10   Re: how to make random in enum
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
Add this to ur enum (+=1)
uh, what?
__________________
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-23-2018 , 03:22   Re: how to make random in enum
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
uh, what?
Nvm klippy point it out for me that enum increment is +1 by default
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 02-23-2018 , 05:30   Re: how to make random in enum
Reply With Quote #7

i removed replaced strings in enum MODE_NONE... etc with numbers and used random_num
solved thanks to all
__________________
arvEL. is offline
Send a message via Skype™ to arvEL.
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-23-2018 , 07:55   Re: how to make random in enum
Reply With Quote #8

Quote:
Originally Posted by arvEL. View Post
i removed replaced strings in enum MODE_NONE... etc with numbers and used random_num
solved thanks to all
MODE_* were not strings, they were numbers...
__________________
HamletEagle is online now
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-23-2018 , 21:57   Re: how to make random in enum
Reply With Quote #9

Quote:
Originally Posted by HamletEagle View Post
MODE_* were not strings, they were numbers constants with integer values...
__________________

Last edited by fysiks; 02-23-2018 at 21:58.
fysiks is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-24-2018 , 05:57   Re: how to make random in enum
Reply With Quote #10

Yeah because the guy clearly understands what constants are. I worded it in a simple way so he gets my point.
__________________

Last edited by HamletEagle; 02-24-2018 at 05:59.
HamletEagle is online now
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 16:16.


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