Posts: 449
Threads: 125
Joined: Apr 2013
Reputation:
0
How to make random function by percentage ( i mean chance)
if i have a command like: /random , the change to show up the message "Winner" is 1%
Posts: 263
Threads: 11
Joined: Nov 2014
Pretty basic.
pawn Код:
new rand = random(3);
switch(rand)
{
case 0:
{
SendClientMessage(playerid, -1, "You are a winner!");
}
case 1:
{
SendClientMessage(playerid, -1, "You are a loser!");
}
case 2:
{
SendClientMessage(playerid, -1, "You are a loser!");
}
You can change the value of random times that you desire by changing "new rand = random(3);" to maybe 4 or 5 and then put new cases at the bottom.
Posts: 449
Threads: 125
Joined: Apr 2013
Reputation:
0
I asked how to add percentage to random function.
I have a cmd named /getprize and i want to make the cases with percentage cuz i put some really really big prizes and for example the nrg can be won at a percentage of 1%.
That is what i am needing.
Posts: 263
Threads: 11
Joined: Nov 2014
And that's exactly what I showed you up there, unless you want me to make a '/getprize' command for you entirely, in which I won't do.
You can however seek for such a request here;
https://sampforum.blast.hk/showthread.php?tid=447813.
Posts: 449
Threads: 125
Joined: Apr 2013
Reputation:
0
For example:
New randprize = random(3);
Switch(random)
{
Case: 0
{
SCM..."You won a NRG"
}
Case 1:
{
SCM..."You won 500$"
}
Case 2:
{
SCM..."You won 300$"
}
How to make case 0 to be hard to win.
Posts: 449
Threads: 125
Joined: Apr 2013
Reputation:
0
And how to do if i have 2 prizes rare to win?