Jump to content

Problem with vehicle interiors


Recommended Posts

Hello, I am trying to script a vehicle interior but it doesn't work and debugscript doesn't report any trouble, here it is the script:

addEventHandler("OnVehicleStartEnter", getRootElement(), function( player, seat, jacked, door ) 
local a1 = createVehicle( 416, 10, 0, 0 ) 
local a2 = createVehicle( 416, 20, 0, 0 ) 
local a3 = createVehicle( 416, 30, 0, 0 ) 
    if door == 2 or 3 and source == a1 or a2 or a3 then 
        cancelEvent() 
        if source == a1 then 
        setElementPosition(player, 2003.3, 2284.2, 1011.1) 
        setElementDimension( player, 103 ) 
        setElementData( player, "ambulance", 1 ) 
        bindKey("num_5", "down", bajar) 
        outputChatBox("Pulsa num_5 para bajar", player) -- "Use num_5 to get off the car" 
        elseif source == a2 then 
        setElementPosition(player, 2003.3, 2284.2, 1011.1) 
        setElementDimension( player, 104 ) 
        setElementData( player, "ambulance", 2 ) 
        bindKey("num_5", "down", bajar) 
        outputChatBox("Pulsa num_5 para bajar", player) -- "Use num_5 to get off the car" 
        elseif source == a3 then 
        setElementPosition(player, 2003.3, 2284.2, 1011.1) 
        setElementDimension( player, 105 ) 
        setElementData( player, "ambulance", 3 ) 
        bindKey("num_5", "down", bajar) 
        outputChatBox("Pulsa num_5 para bajar", player) -- "Use num_5 to get off the car" 
        end 
    end 
end 
) 
  
function bajar( player ) 
ambulance = getElementData( player, "ambulance" ) 
    if ambulance == 1 then  
    ax, ay, az = getElementPosition( a1 ) 
    setElementDimension( player, 0 ) 
    setElementPosition( player, ax, ay, az ) 
     
    elseif ambulance == 2 then 
    ax, ay, az = getElementPosition( a2 ) 
    setElementDimension( player, 0 ) 
    setElementPosition( player, ax, ay, az ) 
     
    elseif ambulance == 3 then 
    ax, ay, az = getElementPosition( a3 ) 
    setElementDimension( player, 0 ) 
    setElementPosition( player, ax, ay, az ) 
    end 
end 
  

thanks!

Link to comment

Try this

                    a1 = createVehicle( 416, 10, 0, 0 ) 
a2 = createVehicle( 416, 20, 0, 0 ) 
a3 = createVehicle( 416, 30, 0, 0 )                                     addEventHandler("onVehicleStartEnter", getRootElement(), function( player, seat, jacked, door ) 
    if door == 2 or 3 and source == a1 or a2 or a3 then 
        cancelEvent() 
        if source == a1 then 
        setElementPosition(player, 2003.3, 2284.2, 1011.1) 
        setElementDimension( player, 103 ) 
        setElementData( player, "ambulance", 1 ) 
        bindKey(player,"num_5", "down", bajar) 
        outputChatBox("Pulsa num_5 para bajar", player) -- "Use num_5 to get off the car" 
        elseif source == a2 then 
        setElementPosition(player, 2003.3, 2284.2, 1011.1) 
        setElementDimension( player, 104 ) 
        setElementData( player, "ambulance", 2 ) 
        bindKey(player,"num_5", "down", bajar) 
        outputChatBox("Pulsa num_5 para bajar", player) -- "Use num_5 to get off the car" 
        elseif source == a3 then 
        setElementPosition(player, 2003.3, 2284.2, 1011.1) 
        setElementDimension( player, 105 ) 
        setElementData( player, "ambulance", 3 ) 
        bindKey(player,"num_5", "down", bajar) 
        outputChatBox("Pulsa num_5 para bajar", player) -- "Use num_5 to get off the car" 
        end 
    end 
end 
) 
  
function bajar( player ) 
ambulance = getElementData( player, "ambulance" ) 
    if ambulance == 1 then  
    ax, ay, az = getElementPosition( a1 ) 
    setElementDimension( player, 0 ) 
    setElementPosition( player, ax, ay, az ) 
     
    elseif ambulance == 2 then 
    ax, ay, az = getElementPosition( a2 ) 
    setElementDimension( player, 0 ) 
    setElementPosition( player, ax, ay, az ) 
     
    elseif ambulance == 3 then 
    ax, ay, az = getElementPosition( a3 ) 
    setElementDimension( player, 0 ) 
    setElementPosition( player, ax, ay, az ) 
    end 
end 
  

Edited by Guest
Link to comment

Post the errors or the warnings.

and maybe try this:

                   a1 = createVehicle( 416, 10, 0, 0 ) 
a2 = createVehicle( 416, 20, 0, 0 ) 
a3 = createVehicle( 416, 30, 0, 0 )                                     addEventHandler("onVehicleStartEnter", getRootElement(), function( player, seat, jacked, door ) 
    if door == 2 or 3 and source == a1 or source == a2 or source == a3 then 
        cancelEvent() 
        if source == a1 then 
        setElementPosition(player, 2003.3, 2284.2, 1011.1) 
        setElementDimension( player, 103 ) 
        setElementData( player, "ambulance", 1 ) 
        bindKey(player,"num_5", "down", bajar) 
        outputChatBox("Pulsa num_5 para bajar", player) -- "Use num_5 to get off the car" 
        elseif source == a2 then 
        setElementPosition(player, 2003.3, 2284.2, 1011.1) 
        setElementDimension( player, 104 ) 
        setElementData( player, "ambulance", 2 ) 
        bindKey(player,"num_5", "down", bajar) 
        outputChatBox("Pulsa num_5 para bajar", player) -- "Use num_5 to get off the car" 
        elseif source == a3 then 
        setElementPosition(player, 2003.3, 2284.2, 1011.1) 
        setElementDimension( player, 105 ) 
        setElementData( player, "ambulance", 3 ) 
        bindKey(player,"num_5", "down", bajar) 
        outputChatBox("Pulsa num_5 para bajar", player) -- "Use num_5 to get off the car" 
        end 
    end 
end 
) 
  
function bajar( player ) 
ambulance = getElementData( player, "ambulance" ) 
    if ambulance == 1 then 
    ax, ay, az = getElementPosition( a1 ) 
    setElementDimension( player, 0 ) 
    setElementPosition( player, ax, ay, az ) 
    
    elseif ambulance == 2 then 
    ax, ay, az = getElementPosition( a2 ) 
    setElementDimension( player, 0 ) 
    setElementPosition( player, ax, ay, az ) 
    
    elseif ambulance == 3 then 
    ax, ay, az = getElementPosition( a3 ) 
    setElementDimension( player, 0 ) 
    setElementPosition( player, ax, ay, az ) 
    end 
end 

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