SA-MP Forums Archive
[HELP] Random number - 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: [HELP] Random number (/showthread.php?tid=128740)



[HELP] Random number - addinol - 19.02.2010

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 ?


Re: [HELP] Random number - pagie1111 - 19.02.2010

Random(NUMBER); is your function.

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



Re: [HELP] Random number - Correlli - 19.02.2010

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


Re: [HELP] Random number - addinol - 19.02.2010

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


Re: [HELP] Random number - Onyx09 - 19.02.2010

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


Re: [HELP] Random number - addinol - 19.02.2010

like ? :

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


Re: [HELP] Random number - smeti - 19.02.2010

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)   ] );