SA-MP Forums Archive
Tell me how to do that. Please. - 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: Tell me how to do that. Please. (/showthread.php?tid=208546)



Tell me how to do that. Please. - blackwave - 08.01.2011

I already know how to make random of cars, colors, names, messages, etc. But my question is: How do I do a random number? I want to define them for each gang on my server. The number must be between 0 and 250, since I defined 250 for max gang amount. Thx regards.


Re: Tell me how to do that. Please. - legodude - 08.01.2011

what do you want to do with it?
if it is a id, let it auto increment.
else you can do just a normal random


Re: Tell me how to do that. Please. - blackwave - 08.01.2011

I want to put a random ID between 0 and 250, defined for my gang ID's. Since I defined MAX_GANGS 250:
pawn Код:
#define MAX_GANGS 250
I'm a gang system. But also this about ID could be gettin' the actual gang ID and increase +1 for the actual one :P


Re: Tell me how to do that. Please. - blackwave - 08.01.2011

Help me... that's simply easy. And I really need it for my system X_X ..'


Re: Tell me how to do that. Please. - admantis - 08.01.2011

Do you mean this?
pawn Код:
new random_number = random(250);



AW: Tell me how to do that. Please. - Extremo - 08.01.2011

You can't define something at runtime as its only a macro being replaced with what you want it to replace. So you would have to save them to a variable.


Re: Tell me how to do that. Please. - blackwave - 08.01.2011

Quote:
Originally Posted by admantis
Посмотреть сообщение
Do you mean this?
pawn Код:
new random_number = random(250);
thx. I'll try to use it with what I really want. It was what I needed