Jump to content

Need help with "warpPedIntoVehicle"


Gtagasje

Recommended Posts

I made a vehicle spawn script, which will create a vehicle when you enter a marker.

The only thing is, I don't know how to warp the player into the vehicle..

I couldn't find it on the internet, and wiki also couldn't (My script isn't the same) so that's why I post it here.

This is what I currently have:

  
local vehicleMarker = createMarker(1552.33, -1605.37, 13, 'cylinder', 2.0, 255, 0, 0, 150 ) 
  
function vehicleMarkerHit ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" and not isPedInVehicle (hitElement) then 
        createVehicle ( 468, 1552.33, -1605.37, 13 ) 
    end 
end 
  
addEventHandler( "onMarkerHit", vehicleMarker , vehicleMarkerHit ) 
  

Btw, if it's a failing script, say it.. this is one of my first scripts :P

Greetz, Gtagasje

Link to comment
--server sided 
  
local vehicleMarker = createMarker(1552.33, -1605.37, 13, 'cylinder', 2.0, 255, 0, 0, 150 ) 
  
function vehicleMarkerHit ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" and not isPedInVehicle (hitElement) then 
        local vehicle = createVehicle ( 468, 1552.33, -1605.37, 13 ) 
        warpPedIntoVehicle(hitElement, vehicle) 
    end 
end 
  
addEventHandler( "onMarkerHit", vehicleMarker , vehicleMarkerHit ) 

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...