Random[REP++] - 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[REP++] (
/showthread.php?tid=552976)
Random[REP++] -
nezo2001 - 27.12.2014
i want to make random between variable like :
PHP код:
new first = 1;
new second = 2;
new third = 3;
new fourth = 4;
PHP код:
new ran = random(????)
What i should write in new ran
Please help .
Re: Random[REP++] -
Ahmad45123 - 27.12.2014
you can't pick a random 'variable'... but you can do so :
pawn Код:
new var[4] =
{
10,
20,
30,
40
};
new num = random(sizeof(var));
new val = var[num];
Re: Random[REP++] -
Schneider - 27.12.2014
You don't necessarily need to define the numbers...
pawn Код:
new ran = (random(4)+1); // This will output 1, 2, 3 or 4.
Re: Random[REP++] -
nezo2001 - 27.12.2014
What is
PHP код:
new val = var[num];
??
Re: Random[REP++] -
nezo2001 - 27.12.2014
Quote:
Originally Posted by Schneider
You don't necessarily need to define the numbers...
pawn Код:
new ran = (random(4)+1); // This will output 1, 2, 3 or 4.
|
I am making a random spawn so i want to seperate between males and females
Re: Random[REP++] -
Ahmad45123 - 27.12.2014
How do you want to do so ?
Explain more so that I can tell you...
Re: Random[REP++] -
nezo2001 - 27.12.2014
I am making a dialog if player choose "male" so i have make a variable with all male skins' id to get a random skin for it and if the player choose female i also have to make a variable with all female skins' id to get a random skin for it.
Re: Random[REP++] -
jackx3rx - 27.12.2014
You'll need two random variables then, so if they click male it would give a list of random male skins:
Outputs either: 0, 1, 2, 3 or 4.
Outputs either: 0, 1, 2, 3 or 4.
Re: Random[REP++] -
Ahmad45123 - 27.12.2014
Here.
pawn Код:
new maleSkins[] =
{
1,
2,
3
// and all the ids here...
};
new randomskin = maleSkins[random(sizeof(maleSkins))]; //Will bring a random skin
I didn't test it... So I don't know if it will work...
Re: Random[REP++] -
nezo2001 - 27.12.2014
And i have to add them OnDialogResponse or on the top of script ??