enumeration + random in array - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: enumeration + random in array (
/showthread.php?tid=655756)
enumeration + random in array -
xMoBi - 29.06.2018
why cant we do:
Код:
enum e_Mode {
e_Mode_Spawn1[3],
e_Mode_Spawn2[3],
e_Mode_Spawn3[3],
}
static array[2][e_Mode];
array[0][e_Mode_Spawn1 + random(3)]
any valid reason
Re: enumeration + random in array -
NaS - 29.06.2018
It works, but you must keep the tags.
Код:
array[0][e_Mode:(_:e_Mode_Spawn1 + random(3))]
This will randomize between e_Mode_Spawn1, e_Mode_Spawn2 and e_Mode_Spawn3.
But if you only have 3 coords in an array there is not really any point in using an enum. Just use a regular array with Float tag.
Actually what you wrote works too, but will give a warning.
Re: enumeration + random in array -
CodeStyle175 - 29.06.2018
why do you want to make this code so hard, it just 3 dimensional array nothing special.
new array[2][3][3],rnd=random(3);
array[0][rnd][0]
array[0][rnd][1]
array[0][rnd][2]
every part of your code doesnt have to be in enumator