Jump to content

question


Kenix

Recommended Posts

how to create player vehicle exit?

i have this but not work:

server:

  
root = getRootElement() 
addEventHandler("onPlayerJoin",root, 
    function ( ) 
    local thePlayer = source 
    local veh = createVehicle(470,2759.697265625,-2484.0651855469,13.822604942322)  
    warpPedIntoVehicle(source,veh) 
    setElementVelocity(veh,0,0.33,0) 
    setTimer(function() 
        if isElement (thePlayer) then 
           setCameraTarget(thePlayer,thePlayer) 
           triggerClientEvent(thePlayer,"setContrl",thePlayer) 
        end 
    end,9500,1) 
    setCameraMatrix(source,2751.2658691406,-2419.8408203125,13.6328125,2761.0546875,-2454.3334960938,13.554655075073) 
    end 
) 
  

client:

  
addEvent("setContrl",true) 
addEventHandler("setContrl",root, 
    function( ) 
    setPedControlState(source,"enter_exit",true) 
    end 
) 
  

Link to comment

Mhm..

Server:

  
root = getRootElement() 
addEventHandler("onPlayerJoin",root, 
    function ( ) 
    local veh = createVehicle(470,2759.697265625,-2484.0651855469,13.822604942322)  
    warpPedIntoVehicle(source,veh) 
    setElementVelocity(veh,0,0.33,0) 
    setTimer(function(thePlayer) 
        if isElement (thePlayer) then 
            setCameraTarget(thePlayer,thePlayer) 
            triggerClientEvent(thePlayer,"setContrl",thePlayer) 
        end 
    end,9500,1,source) 
    setCameraMatrix(source,2751.2658691406,-2419.8408203125,13.6328125,2761.0546875,-2454.3334960938,13.554655075073) 
    end 
) 
  

Client:

  
addEvent("setContrl",true) 
addEventHandler("setContrl",root, 
    function( ) 
        setPedControlState(source,"enter_exit",true) 
    end 
) 
  

Link to comment
you must use setControlState (without `source` argument), setPedControlState is ONLY for peds
addEvent("setContrl",true) 
addEventHandler( "setContrl", root, 
    function() 
        setControlState( "enter_exit", true ) 
    end 
) 

thx dude

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