Quote:
Originally Posted by Babul
lets assume i got my number set to 100:
..so check will be 100 aswell:
pawn Code:
new check = Player[i][Number];
..taking the random out of (this variable set to) 100, is like
...which returns a number ranging up from 0 to the maximim (100) minus 1.
0 upto 99 ARE 100 numbers, basically the "hit chance" is 1% when the playervariable is set to 100 and a random from 0-99 is taken. to achieve that, you can do this:
pawn Code:
new check = random(Player[i][Number]); if(check == 0)
or, much simpler, in 1 line (checking for 0 with a max 100 = 1% chance) as before:
pawn Code:
if(random(Player[i][Number] == 0)
..also have a look @ https://sampwiki.blast.hk/wiki/Random
|
Very good explaining but im still kind of confused its a lottery and i need ti so it chooses a raffle ticket that someone has already got.
It cant choose a number that a player has not got.
Please help
Thanks