Vehicles
#1

How can I retrive all vehicles ID? Pelase help me guys (:
Reply
#2

I don't know what you're talking about exactly. Give us more information what exactly do you want with this.
Reply
#3

I wanna retrive all vehicles ID's, then, make a random of them and put player in the random vehicle.
Reply
#4

Neither do I, but by any chance do you mean this?
https://sampwiki.blast.hk/wiki/Category:Vehicle
Reply
#5

Quote:
Originally Posted by Hot
I wanna retrive all vehicles ID's, then, make a random of them and put player in the random vehicle.
pawn Код:
for(new v = 1; v <= MAX_VEHICLES; v++) // use your own value for MAX_VEHICLES.
{
  // your code.
}
https://sampwiki.blast.hk/wiki/Random

https://sampwiki.blast.hk/wiki/PutPlayerInVehicle
Reply
#6

I have this piece of code, but it doesn't works.

Код:
public OnPlayerSpawn(playerid)
{
    new Cars[93] =
    {
	    400,401,402,404,405,410,411,412,415,418,419,420,421,422,424,426,429,434,436,
	    438,439,442,445,451,458,466,467,470,474,475,477,478,480,480,480,480,489,490,
	    491,492,494,496,500,501,502,503,504,505,506,507,516,517,518,526,527,529,533,
	    534,535,536,540,541,542,543,545,546,547,549,550,551,555,558,559,560,561,562,
	    565,566,567,575,576,580,585,587,589,596,597,598,600,602,603,604,605,
    };

	new vehicle = random(sizeof(Cars));
	new Float:X, Float:Y, Float:Z, Float:A;
	GetPlayerPos(playerid, X, Y, Z);
	GetPlayerFacingAngle(playerid, A);
	CreateVehicle(vehicle, X, Y, Z, A, -1, -1, 10);
	PutPlayerInVehicle(playerid, vehicle, 0);
	return 1;
}
Reply
#7

Because those are the model-IDs, not vehicle-IDs.
Reply
#8

But CreateVehicle says to use model id, https://sampwiki.blast.hk/wiki/CreateVehicle
Reply
#9

CreateVehicle, yes, but PutPlayerInVehicle doesn't.

You could do this:
pawn Код:
/* your code */
new
    myVehicle;
myVehicle = CreateVehicle(vehicle, X, Y, Z, A, -1, -1, 10);
PutPlayerInVehicle(playerid, myVehicle, 0);
/* your code */
Reply
#10

Now my code is like this:

Код:
public OnPlayerSpawn(playerid)
{
	new vehicle = random(sizeof(Cars));
	new Float:X, Float:Y, Float:Z, Float:A;
	GetPlayerPos(playerid, X, Y, Z);
	GetPlayerFacingAngle(playerid, A);
	new myVehicle = CreateVehicle(vehicle, X, Y, Z, A, -1, -1, 10);
	PutPlayerInVehicle(playerid, myVehicle, 0);
	return 1;
}
But I still not spawning with a car, what's happening?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)