[HELP] Random number
#1

Hey, can someone tell me how could i make that this:

SetPlayerSkin(playerid, NUM_FROM_LIST);

i want that the NUM_FROM_LIST WILL BE CHOSEN RANDOMLY. how could i make this ?
Reply
#2

Random(NUMBER); is your function.

pawn Код:
Random(1000);
will give you a result of 0 - 1000
Reply
#3

Quote:
Originally Posted by {Awaran};
Random(NUMBER); is your function.

pawn Код:
Random(1000);
will give you a result of 0 - 1000
It will return a value from 0 - 999
Reply
#4

hmm, but i want the number from list. because the playerSkins is Male and Female :]
Reply
#5

then use the number from list dude? its all about logic and beign smart

just like doing your homework but having fun while doing it
Reply
#6

like ? :

Код:
new MaleSkins[][] = {
  "174",
  "175",
  "109",
  "122",
  "240",
};
Код:
SetPlayerSkin(playerid, random(MaleSkins[][]));
?
Reply
#7

Quote:
Originally Posted by addinol
like ? :

Код:
new MaleSkins[][] = {
  "174",
  "175",
  "109",
  "122",
  "240",
};
Код:
SetPlayerSkin(playerid, random(MaleSkins[][]));
?
pawn Код:
new     // [] one dimension + value [0] = 174, [1] = 175, [2] = 109, .... size automatice compilied pawn
    MaleSkins[] = { 174, 175, 109, 122, 240 };

                    // random size or random(4)
SetPlayerSkin(playerid, MaleSkins[   random(sizeof MaleSkin)   ] );
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)