Random[REP++]
#1

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 .
Reply
#2

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];
Reply
#3

You don't necessarily need to define the numbers...

pawn Код:
new ran = (random(4)+1);  // This will output 1, 2, 3 or 4.
Reply
#4

What is
PHP код:
new val = var[num]; 
??
Reply
#5

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
Reply
#6

How do you want to do so ?
Explain more so that I can tell you...
Reply
#7

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.
Reply
#8

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.
pawn Код:
new mskin = random(5);
Outputs either: 0, 1, 2, 3 or 4.
pawn Код:
new fskin = random(5);
Reply
#9

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...
Reply
#10

And i have to add them OnDialogResponse or on the top of script ??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)