[Help] Random
#1

I have already opened a topic but i open a new one coz it is hard to understand something in the last one

If i do to something random how can i know what selected?
..

Old topic : http://forum.sa-mp.com/index.php?topic=102517.0
Reply
#2

"how can i know what selected?"
what do you mean?
Reply
#3

you can store last random number into any global variable or array cell and every time you need you can see what number it was
Reply
#4

I mean like this:

example
random of 1 and 2

if it will choose 1
then : Do something

if it will choose 2
then : Do something else...


Reply
#5

pawn Код:
new rand;
rand = random(100); //0 - 100
if(rand <= 49) //50% chance there will be under 49
{
  //do something
}
else if(rand >= 50) //50 and up - 50% chance there will be higher
{
  //do something else
}
That will basically random a number from 0 to 100.

Leopard
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)