Jump to content

Help Interior Enter


Killer...

Recommended Posts

Hi everyone, today i need some help whit a script, the problem that's the vehicle doesn't teleport to the interior or to the outside, here i leave the script. What is the problem?

local function enterInterior( player, vehicle, key, state, colShape ) 
    local data = colspheres[ colShape ] 
    if data then 
        local interior = interiors[ data.id ] 
        if interior.type > 0 and interior.characterID == 0 then 
            -- buy the interior 
            if exports.players:takeMoney( player, interior.price ) then 
                local characterID = exports.players:getCharacterID( player ) 
                if characterID then 
                    -- update the owner if possible 
                    if exports.sql:query_free( "UPDATE interiors SET characterID = " .. characterID .. " WHERE interiorID = " .. data.id ) then 
                        interior.characterID = characterID 
                         
                        -- remove our element data that claims this as buyable 
                        removeElementData( interior.outside, "type" ) 
                        removeElementData( interior.outside, "price" ) 
                         
                        -- give him the house key 
                        exports.items:give( player, 2, data.id ) 
                         
                        -- stick a blip to it 
                        interior.blip = not interior.locked and interior.outsideDimension == 0 and createBlipEx( interior.outside, interior.inside ) 
                         
                        -- message to the player 
                        outputChatBox( "Congratulations! You've bought " .. interior.name .. " for $" .. interior.price .. "!", player, 0, 255, 0 ) 
                    else 
                        outputChatBox( "MySQL-Error.", player, 255, 0, 0 ) 
                        exports.players:giveMoney( player, interior.price ) 
                    end 
                end 
            else 
                outputChatBox( "Tu necesitas $" .. ( interior.price - exports.players:getMoney( player ) ) .. " para comprar esta propiedad.", player, 255, 0, 0 ) 
            end 
        elseif interior.type > 0 and interior.locked then 
            exports.chat:me( player, "intenta abrir la puerta pero sin suerte." ) 
        else 
            local other = data.other 
            if other then 
                triggerEvent( "onColShapeLeave", colShape, player, vehicle, true ) 
                -- teleport the player 
                setElementDimension( player, getElementDimension( other ) ) 
                setElementInterior( player, getElementInterior( other ) ) 
                setElementPosition( player, getElementPosition( other )) 
                setCameraInterior( player, getElementInterior( other ) ) 
                setElementPosition( vehicle, getElementPosition( other ) ) 
                setElementDimension( vehicle, getElementDimension( other )) 
                setElementInterior( vehicle, getElementInterior( other )) 
                setCameraTarget( player, player ) 
  
                triggerEvent( "onColShapeHit", other, player, vehicle, true ) 
            end 
        end 
    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...