how do i create a random vehicle? please help...
#1

Quote:

new RandomVehicle = random(400,401,402,404,410,412,413,418,419);

AddStaticVehicle(RandomVehicle,2205.2,-1177.0,25.7,270.8,-1,-1); // a car

please help me ... thanks..

Reply
#2

pawn Код:
new randomcar [9][1] = {
{400},
{401},
{402},
{404},
{410},
{412},
{413},
{418},
{419}
}

new rand = random(sizeof(randomcar));
AddStaticVehicle(randomcar[rand][0],2205.2,-1177.0,25.7,270.8,-1,-1);
Not sure but should work
Reply
#3

works but i've got an error:

Quote:

(8461) : error 001: expected token: ";", but found "new"

thanks for your help.
Reply
#4

forgot to add a ; sorry should be here

{419}
}; <----
Reply
#5

yeap thanks bro!
Reply
#6

problem..... there are no vehicles at the spots i've created..

Quote:

new randomcar [51][1] = {
{400},{401},{402},
{404},{410},{412},{413},{418},{419},{422},{426},{4 39},{440},{458},{461},
{462},{463},{466},{467},{468},{471},{474},{475},{4 78},{479},{489},{492},
{496},{507},{509},{510},{516},{517},{521},{526},{5 27},{529},{533},{542},
{543},{549},{554},{562},{566},{567},{575},{581},{5 86},{600},{604},{605}
};

new rand = random(sizeof(randomcar));

//PART 1
AddStaticVehicle(randomcar[rand][0],645.8277,-1772.6516,12.0704,346.0127,0,0); //



please help dude...
Reply
#7

its adding 1 car.

if you are dynamically adding during gameplay use CreateVehicle
Reply
#8

it's still on AddStaticVehicle and i see all the cars but! they are all not randmly selected all the cars are ID: 400

how do i change this?.... thank you....
Reply
#9

try this

Код:
new randomcar[51] = {

400,401,402,404.....

};
without the:
{} on each one

then change this from:

AddStaticVehicle(randomcar[rand][0]

to

AddStaticVehicle(rand,

if you are planning a new car after an event i would recommend changing addstaticvehcile to createvehicle
Reply
#10

Quote:

(8532) : warning 204: symbol is assigned a value that is never used: "randomcar"

........... what now....?
Reply
#11

please help.........
Reply
#12

There is a
pawn Код:
new randomcar;
that is never used, just delete it.
Reply
#13

Quote:
Originally Posted by FujiNNN
Quote:

new RandomVehicle = random(400,401,402,404,410,412,413,418,419);

AddStaticVehicle(RandomVehicle,2205.2,-1177.0,25.7,270.8,-1,-1); // a car

please help me ... thanks..

pawn Код:
new
        RandomVehicle[] = { 400, 401, 402, 404, 410, 412, 413, 418, 419 };
    AddStaticVehicle(RandomVehicle[random(sizeof RandomVehicle)], 2205.2, -1177.0, 25.7, 270.8, -1, -1); // car
   
    AddStaticVehicle(RandomVehicle[random(sizeof RandomVehicle)], 2215.2, -1177.0, 25.7, 270.8, -1, -1); // car
    AddStaticVehicle(RandomVehicle[random(sizeof RandomVehicle)], 2225.2, -1177.0, 25.7, 270.8, -1, -1); // car
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)