Jump to content

Doherty Garage how to open [FIXED]


Recommended Posts

It should be possible to manipulate the garage doors, they are separate from the rest of the garage model, and in fact separate from each other, IDs 11360 (left door) and 11416 (right door). A DFF/COL edit shouldn't be necessary, unless you're unlucky with invisible walls or something and a COL edit is then necessary. There might be a community script to allow garage door to open, or perhaps there's a function to trigger certain default doors, someone else will know that I guess.

You could then spawn object ID 11389 - the 'interior' of the garage - and position it correctly. You ought to be able to find the detailing objects yourself using Map Editor.

Link to comment

an example from wiki:

GARAGE_ID = 25 
  
-- create a collision shape and attach event handlers to it when the resource starts 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
function (resource) 
    local garageCube = createColCube(1337, 194, 28, 6, 10, 4) 
    addEventHandler("onColShapeHit", garageCube, onGarageCubeHit) 
    addEventHandler("onColShapeLeave", garageCube, onGarageCubeLeave) 
end) 
  
-- open the door when someone enters the garage's collision shape 
function onGarageCubeHit(hitElement, matchingDimension) 
    if (getElementType(hitElement) == "player") then 
        -- check to make sure the door is closed 
        if (not isGarageOpen(GARAGE_ID)) then 
            -- open the door 
            setGarageOpen(GARAGE_ID, true) 
        end 
    end 
end 
  
-- close the door when someone leaves the garage's collision shape 
function onGarageCubeLeave(leaveElement, matchingDimension) 
    if (getElementType(leaveElement) == "player") then 
        -- check to make sure the door is open 
        if (isGarageOpen(GARAGE_ID)) then 
            -- close the door 
            setGarageOpen(GARAGE_ID, false) 
        end 
    end 
end 
  

and you can find Garage ID's: https://wiki.multitheftauto.com/wiki/Garage

Link to comment

is this right? becuase i did this and the gurage dont open.. and i found this script that opens the garage but the download link dont work viewtopic.php?f=108&t=26032&p=354601#p354601

this is the code here

GARAGE_ID = 22

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()),

function (resource)

local garageCube = createColCube(11389)

addEventHandler("onColShapeHit", garageCube, onGarageCubeHit)

addEventHandler("onColShapeLeave", garageCube, onGarageCubeLeave)

end)

-- open the door when someone enters the garage's collision shape

function onGarageCubeHit(hitElement, matchingDimension)

if (getElementType(hitElement) == "player") then

-- check to make sure the door is closed

if (not isGarageOpen(22)) then

-- open the door

setGarageOpen(22, true)

end

end

end

-- close the door when someone leaves the garage's collision shape

function onGarageCubeLeave(leaveElement, matchingDimension)

if (getElementType(leaveElement) == "player") then

-- check to make sure the door is open

if (isGarageOpen(22)) then

-- close the door

setGarageOpen(22, false)

end

end

end

Link to comment

and please use


.. so we can understand your script...



GARAGE_ID = 22 
  
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
function (resource) 
local garageCube = createColCube(11389) 
addEventHandler("onColShapeHit", garageCube, onGarageCubeHit) 
addEventHandler("onColShapeLeave", garageCube, onGarageCubeLeave) 
end) 
  
-- open the door when someone enters the garage's collision shape 
function onGarageCubeHit(hitElement, matchingDimension) 
if (getElementType(hitElement) == "player") then 
-- check to make sure the door is closed 
if (not isGarageOpen(22)) then 
-- open the door 
setGarageOpen(22, true) 
end 
end 
end 
  
-- close the door when someone leaves the garage's collision shape 
function onGarageCubeLeave(leaveElement, matchingDimension) 
if (getElementType(leaveElement) == "player") then 
-- check to make sure the door is open 
if (isGarageOpen(22)) then 
-- close the door 
setGarageOpen(22, false) 
end 
end 
end 

Link to comment

A cube is a collision cuboid you can use it with

addEventHandler('onColShapeHit', colShape, onMyColShapeHit) 

and you should use it to open the garage when a player approches it.

example: (another shape function)

local myColShape = createColTube(0, 0, 0, 10, 10) 
addEventHandler('onColShapeHit', myColShape, 
function(hitElement, dim) 
if getElementType(hitElement) == 'player' then 
outputChatBox(getElementName(hitElement)..' has entered the col shape') 
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...