PDA

View Full Version : Help Random


Dark Crow
29/04/2012, 07:41 AM
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 pTulip pRose he gets a random either is pRose or a pTulip and a random ammount of Roses or Tulips?

Burridge
29/04/2012, 07:56 AM
Use the random (http://wiki.sa-mp.com/wiki/Random) function. Doing something like:


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!");
}
}

Dark Crow
29/04/2012, 08:48 AM
Fixed

Jaxson
29/04/2012, 09:00 AM
There is no case 3, 2 is the maximum value RandRuda can assume.