Jump to content

MTA:SA Bug WarpPedIntoVehicle


3B00DG4MER

Recommended Posts

Hi guys, today I was working on Vehicle and Peds

I tried to warp a ped into a Vehicle

than I tried to enter the vehicle, I was unable to do it

here's a code

it's basic, I think it's MTA:SA Bug

  
x,y,z = getElementPosition(getRandomPlayer()) -- i'm alone at the server , so it's should get me 
veh = createVehicle(411,x,y,z) -- creating the vehicle 
ped = createPed(211,x,y,z) -- creating the ped 
warpPedIntoVehicle(ped,veh) -- Warping Ped into the Vehicle 
addEventHandler("onVehicleStartEnter",root,function() outputChatBox("You are trying to enter a vehicle !") end) -- This event won't get called ! 
  

Note : when I kill the Ped I can enter to the vehicle and the event called

Link to comment

Its your bug you should use seat (thirs function argument)

  
 x,y,z = getElementPosition(getRandomPlayer()) -- i'm alone at the server , so it's should get me 
veh = createVehicle(411,x,y,z) -- creating the vehicle 
ped = createPed(211,x,y,z) -- creating the ped 
warpPedIntoVehicle(ped,veh, 1) -- Warping Ped into the Vehicle 
addEventHandler("onVehicleStartEnter",root,function() outputChatBox("You are trying to enter a vehicle !") end) -- This event won't get called ! 
  
  
  

Link to comment

Note: Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only.

You have to read all of the function page

And be sure that you can't mix server and client functions in one file

Link to comment

The only think I could think of is this this,

setElementPosition:

Attention: Do not use this function to spawn a ped/player. It will cause problems with other functions like warpPedIntoVehicle. Use spawnPlayer and createPed instead.
Now, I know it sounds farfetched but it actually makes sense, you said it worked again after killing the player. (Something that probably will spawn the player the correct way). You may have a look at the function setElementPosition and ho that one is used in your resources.
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...