[help]Random Car
#1

Hey, I've got the funktion CreateVehicle(v,x,y,z,r,c1,c2,rd); in my script. For v(vehicletype) I want to add a random car out of six.
The ID's to use are 558, 559, 560, 561, 562 and 565.
Does somebody know how to do a random car?
Reply
#2

https://sampwiki.blast.hk/wiki/Random rly simple
Reply
#3

new
randVec[] =
{558, 559, 560, 561, 562, 565};

CreateVehicle (randVec[random(sizeof( randVec))],x,y,z,r,c1,c2,rd);
Reply
#4

removed Sorry
Reply
#5

I've already tried this exacly like Wiki, but it had some mistakes:
Quote:
pawn Код:
#include <a_samp>

//new iRandomNumber = random(25); //you can create a variable global but you cant use a funtion global
new Float:RandomSpawn[][4] =
{
  {-2796.9854, 1224.8180, 20.5429, 192.0335},
  {-2454.2170, 503.8759, 30.0790, 267.2932},
  {-2669.7322, -6.0874, 6.1328, 89.8853}
}; //you forgot here a semicolon

//rest of the code is ok
Quote:

new
randVec[] =
{558, 559, 560, 561, 562, 565};

CreateVehicle (randVec[random(sizeof( randVec))],x,y,z,r,c1,c2,rd);

Thanks, works well.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)