Help Random - 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: Help Random (
/showthread.php?tid=338197)
Help Random -
Dark Crow - 29.04.2012
I wanted to make a player to be given a random ammount of something i know how to make the random but how can i make for example when a player is gardening and he is picking flowers example
he gets a random either is pRose or a pTulip and a random ammount of Roses or Tulips?
Re: Help Random -
Burridge - 29.04.2012
Use the
random function. Doing something like:
pawn Код:
new RandFlower = random(2);
switch(RandFlower) {
case 0: {
pTulip[playerid]++;
SendClientMessage(playerid, colour, "You picked a Tulip!");
}
case 1: {
pRose[playerid]++;
SendClientMessage(playerid, colour, "You picked a Rose!");
}
}
Re: Help Random -
Dark Crow - 29.04.2012
Fixed
Re: Help Random -
Jaxson - 29.04.2012
There is no case 3, 2 is the maximum value RandRuda can assume.