Random Money
#1

I am creating cops and robbers server.

And I want players to rob random money between 0 - 6000 from a store, how would I use the random function to do this?
Reply
#2

Code:
new jCash = random(6000);
GivePlayerMoney(playerid, jCash);
Reply
#3

Random returns a value between 0, and it parвmeter, called max.

For example, to get a value between 0 and 6000, just use

pawn Code:
random(6000);
Read more here:

https://sampwiki.blast.hk/wiki/Random
Reply
#4

6001 is 0-6000
6000 is 0-5999

Therebefore:
pawn Code:
GivePlayerMoney(playerid, random(6001));
Reply
#5

Use this site.
https://sampwiki.blast.hk/wiki/Random
Reply
#6

Thanks for your help guys
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)