View Single Post
thecount
Veteran Member
Join Date: Jul 2013
Old 10-11-2016 , 15:48   Re: Pick random value from enum
Reply With Quote #3

For enums of varying or long lengths, you may also add an element at the end of the list to represent the amount of elements before it to help with looping and such. Like:
PHP Code:
enum type{
enum1//0
enum2//1
enum3//2
TOTAL_ENUM 3

For your situation, I think you would just want something like
PHP Code:
view_as<Days>:GetRandomInt(MondaySunday); 
or whatever the syntax is for that. I don't cast variables to different types very often in SourcePawn.

Last edited by thecount; 10-11-2016 at 15:51.
thecount is offline