random vehicle spawn
#1

Hi,

I make random vehicle spawns but all vehicles size is different height and some of them is in air.. How to right put any vehicle on ground?
Reply
#2

Quote:
Originally Posted by MerryDeer
Посмотреть сообщение
Hi,

I make random vehicle spawns but all vehicles size is different height and some of them is in air.. How to right put any vehicle on ground?
Please show code, and i'll try to help you..
Reply
#3

What code? i take a read here:

https://sampwiki.blast.hk/wiki/SetVehiclePos

Код:
An empty vehicle will not fall after being teleported into the air.
So i need how to calculate right z to put on ground vehicle?
Reply
#4

You can do a simple command to teleport vehicle to player.. like this:
Код:
new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z);
SetVehiclePos(vehicleid, x, y, z);
Reply
#5

No you don't understand.. I write /save with one vehicle to get coordinates where i want to teleport. Then i teleport random vehicles to that coordinates, but some of them is in air, and some of them in ground.. That because if there is no driver this function where teleport there vehicle and stands.. I need something that could correct z coordinate on ground using X,Y
Reply
#6

Here you go :-
PHP код:
new Float:VehSpawn[][] =
{
    {
x,y,z}, //add your coordinates
    
{x,y,z},//add your coordinates
    
{x,y,z}//add your coordinates
}; 
PHP код:
//Under your command.
new rand random(sizeof(VehSpawn));
SetVehiclePos(vehicleidVehSpawn[rand][0], VehSpawn[rand][1], VehSpawn[rand][2]); 
Reply
#7

I'am already doing that, but some vehicles are in air, i repeating i need function that give my right Z, for any vehicle for x,y
Reply
#8

You want vehicles to teleport to those locations or spawn at them?
Because CreateVehicle works, if you want a vehicle spawn
Reply
#9

I teleport them using setvehiclepos in game, but some of them is in air.. I need smth that i can correct that vehicle reach ground
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)