Random between 4 numbers - 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 between 4 numbers (
/showthread.php?tid=573249)
Random between 4 numbers -
Zloto - 05.05.2015
Код:
RandomMatsAmount(){
new rand = random(4);
switch(rand)
{
case 0: 25000;
case 1: 50000;
case 2: 75000;
case 3: 100000;
}
return 1;
}
I tryed this but i gues case: can't use only int it has to be a variable or function or someting
Re: Random between 4 numbers -
Kyle - 05.05.2015
Not sure how you want it but the function is fixed.
Quote:
RandomMatsAmount()
{
switch(random(4))
{
case 0: { return 25000; }
case 1: { 50000; }
case 2: { 75000; }
case 3: { 100000; }
}
return 1;
}
|
Re: Random between 4 numbers -
Kar - 05.05.2015
pawn Код:
RandomMatsAmount()
{
new retVal = 0;
switch(random(4))
{
case 0: retVal = 25000;
case 1: retVal = 50000;
case 2: retVal = 75000;
case 3: retVal = 100000;
}
return retVal;
}
Re: Random between 4 numbers -
Zloto - 05.05.2015
Quote:
Originally Posted by Kar
pawn Код:
RandomMatsAmount() { new retVal = 0; switch(random(4)) { case 0: retVal = 25000; case 1: retVal = 50000; case 2: retVal = 75000; case 3: retVal = 100000; } return retVal; }
|
Thanks a lot !