Random
#1

Greetings,

I have this code:
PHP код:
enum Vehicles
{
    
v00,
    
v01
};
new 
Vehicle[Vehicles];
Vehicle[v00] = CreateVehicle(411, 88.4730, -80.3254, 0.9328, 73.9473, 0, 0, -1);
Vehicle[v01] = CreateVehicle(411, 133.0589, -85.0311, 1.4297, 239.0755, 0, 0, -1);
new 
v = random(sizeof(Vehicle));
if(!
IsVehicleOccupied(v)) PutPlayerInVehicle(i, v, 0); 
Most time I spawn in one of the cars, however, sometimes I don't. Am I doing something wrong?
Reply
#2

yes , you are doing it wrongly, you didn't put a value for your enum list, I suggest you to:
pawn Код:
new Vehicles[2];

Vehicle[0] = ....
Vehicle[1] = ....

new v = random(2); // the size of them both
// Continue..
Reply
#3

It is working now, had to edit some things tho. Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)