Job money
#1

if(randfish == 4)
{
new fish[128];
new price = 1800 + random(500);

What means that random(500) ?
I want to change the job's payment.
Reply
#2

random(500) will return a random value between 0 and 499.

1, 2, 3, 4, 5, ..., 498, 499.
Reply
#3

Oh, and if I'll use random(5000) will return something between 0 and 4999?
Reply
#4

Yes, the random function returns a random number between 0 (inclusive) and the upper bound you supplied (exclusive).

Quote:

random
[ran-duh m]

adjective
1.
proceeding, made, or occurring without definite aim, reason, or pattern:
the random selection of numbers.
Reply
#5

Quote:
Originally Posted by fireriper2
Посмотреть сообщение
Oh, and if I'll use random(5000) will return something between 0 and 4999?
yes but if you want to change the payment you have to change the 1800 in this line aswell :

Код:
new price = 1800 + random(500);
1800 is the fixed price that you will get no matter what but + random(500) is maybe a bonus? means when you done the job you will get 1800 + random amount between 0 and 500
Reply
#6

And I can do something like excluding that random like everywhere using random(0) and just editing that new price = 1800 to make it like new price = 5000 + random(0) ?
Reply
#7

Quote:
Originally Posted by fireriper2
Посмотреть сообщение
And I can do something like excluding that random like everywhere using random(0) and just editing that new price = 1800 to make it like new price = 5000 + random(0) ?
if you want to give fixed amount of money then do it without the random or the variable just GivePlayerMoney(playerid, payment);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)