SA-MP Forums Archive
floats with 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: floats with random (/showthread.php?tid=163739)



floats with random - Kar - 28.07.2010

(1449) : warning 213: tag mismatch
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSAR~1.pwn(1449) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.


new randfuel = minrand(25.00,100.00);
CarFuel[v] = randfuel; // This sets the fuel

i need it to be a float for the random fuelor it will crash my server help?


Re: floats with random - Jonni8 - 28.07.2010

You cant generate float with "minrand()" because it's only for integer


Re: floats with random - Kar - 28.07.2010

argh ok no way to make a random for floats?


Re: floats with random - ikey07 - 28.07.2010

Now I know new thing, what I will also say for you

new Float:rand = float(random(Your Random));


Re: floats with random - Jefff - 28.07.2010

pawn Код:
new randfuel = minrand(25,100);
CarFuel[v] = float(randfuel); // This sets the fuel
or

pawn Код:
stock Float:minrand(min, max)
{
    return float(random(max-min))+float(min);
}
CarFuel[v] = minrand(25,100);