Random car pos?..
#1

hello, well im created a car shop, using gui menu.. but i idk, how can i do when player buy some car, car positions will be random? Like this:
Quote:

masinike = CreateVehicle(415, RANDOM,161,161, -1);

coords for ex:
Quote:

-2432.7859,2314.7695,4.7579,324.4159
-2432.6313,2294.3455,4.7548,321.2483

thanks.
Reply
#2

Make an array
Reply
#3

Edit: Cameltoe beat me too it xD

Maybe add your random coordinates into an array?

pawn Код:
enum DataEnum {Float:x, Float:y, Float:z}
new Data[][DataEnum] = {
{-2432.7859,2314.7695,4.7579,324.4159}
{-2432.6313,2294.3455,4.7548,321.2483}
};

// And then do:

new rand = random(sizeof(Data));
masinike = CreateVehicle(415, Data[rand][x], Data[rand][y], Data[rand][z], 161, 161, -1);
Theres probably a different way that i dont know, this is probably easier anyway
Reply
#4

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Edit: Cameltoe beat me too it xD

Maybe add your random coordinates into an array?

pawn Код:
enum DataEnum {Float:x, Float:y, Float:z}
new Data[][DataEnum] = {
{-2432.7859,2314.7695,4.7579,324.4159}
{-2432.6313,2294.3455,4.7548,321.2483}
};

// And then do:

new rand = random(sizeof(Data));
masinike = CreateVehicle(415, Data[rand][x], Data[rand][y], Data[rand][z], 161, 161, -1);
Theres probably a different way that i dont know, this is probably easier anyway
Great example
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)