SA-MP Forums Archive
random - 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: random (/showthread.php?tid=535890)



random - iBots - 06.09.2014

i am making a system with random prize...but how is it possible to make like,it is harder to earn 100k than 1k,like prizes are :1k,2k,5k,20k,100k,how could i make like 100k is harder to get than others?


Re: random - BroZeus - 06.09.2014

Well if u think there are many ways....
the simple one is this --
pawn Код:
new prize_array[] = { 1000,1000,1000,1000,2000,2000,2000,2000,3000,3000,3000,3000,100000};
//now while taking out prize -
new r = randon(sizeof(prize_array));
//now use prize_array[r] as the random prize
Now as u can see in the above method there are many 1k's,2k's etc but there is only one 100k in array this will make it harder to get 100k
Now to make it more harder add more duplicates of 1k,2k,3k....etc but only one 100k in array


Re: random - Battlezone - 06.09.2014

Here is the idea
pawn Код:
new RandomCash[] =
{
    100,
    100,
    100,
    150,
    150,
    1000
};



//then
   new Random = random(sizeof(RandomCash));
    GivePlayerMoney(playerid, RandomCash[Random]);
100$ will have the most chance to be gotten

EDIT: Too late, BroZeus already posted the solution