OpenDoor La Fuente Blanca

Weird question but is there a way you could make a mod that actually makes certain doors unopenable?

For example Franklin’s house or Michael’s house. I want them blocked off so I can use them as apartments.

by rights if you know the names and positions of the door props, this script is easily alterable for that. yes.

Ahh the prop name might be a problem but yeah I see your point. Thanks!

Actually I need the door to be locker permanently. I’m sure I could use the script to do it but I’m not good enough at coding just yet. haha

in the client file, there is a section at the top that kinda looks like this


lockState = {    
    [1] = { ["objName"] = "v_ilev_ra_door4l", ["x"]= 1395.920, ["y"]= 1142.904, ["z"]= 114.700, ["locked"]= true }, -- ranch front left
    [2] = { ["objName"] = "v_ilev_ra_door4r", ["x"]= 1395.919, ["y"]= 1140.704, ["z"]= 114.790, ["locked"]= true }, -- ranch front right
    [3] = { ["objName"] = "v_ilev_tort_door", ["x"]= 134.395, ["y"]= -2204.097, ["z"]= 7.514, ["locked"]= true }, -- torture door
    [3] = { ["objName"] = "v_ilev_fh_frontdoor", ["x"]= 7.518, ["y"]= 539.527, ["z"]= 176.178, ["locked"]= true }, -- torture door
}

if you can find the name of the door prop and the coordinates of the door, simple set the name and x,y,z and locked = true. it’ll ALWAYS be locked, i don’t have much time off atm, but once i do i can script something to help identify the door id’s and positions.

Nice! Thank you. I’ll give this a go.

Does it need to be the ‘exact’ co-ordinates of the door or will it be okay if the co-ordinates are in the general area/inside the door’s mesh?

i assume within the mesh, i’m usually not precise to the digit. :smiley:

1 Like

@ToxicSnip3r Can I message you somehow?

he is banned

@barrwhite if this is related to the mod itself in any way, i can assist… i wrote it.
if not… this thread is meant for troubleshooting and comments related to this mod.

How can I do so that only a job like “El Cartel” can open and close it?

Do you use ESX? In that case you can use this script: https://github.com/ESX-PUBLIC/esx_doorlock

It allows you to set doorlocks for jobs.

ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
lockState = {}
--
RegisterServerEvent('iam:frupdateState')
AddEventHandler('iam:frupdateState', function(doorID, state)
    --
            local canuse = false
       
            local xPlayer = ESX.GetPlayerFromId(source)
            
            if xPlayer.job.name == 'mafia' then
                    -- make each door a table, and clean it when toggled
                        canuse = true              
            end

            if canuse then
                -- make each door a table, and clean it when toggled
                lockState[doorID] = {}
                -- assign information
                lockState[doorID].state = state
                lockState[doorID].doorID = doorID
                TriggerClientEvent('iam:frstate', -1, doorID, state)
            end

end)

^^^^ replace the server file contents with this. and change the esxc job role as needed

and client file with this

--
lockState = {    
    [1] = { ["objName"] = "v_ilev_ra_door4l", ["x"]= 1395.920, ["y"]= 1142.904, ["z"]= 114.700, ["locked"]= true }, -- ranch front left
    [2] = { ["objName"] = "v_ilev_ra_door4r", ["x"]= 1395.919, ["y"]= 1140.704, ["z"]= 114.790, ["locked"]= true }, -- ranch front right
    [3] = { ["objName"] = "v_ilev_tort_door", ["x"]= 134.395, ["y"]= -2204.097, ["z"]= 7.514, ["locked"]= true }, -- torture door
    [3] = { ["objName"] = "v_ilev_fh_frontdoor", ["x"]= 7.518, ["y"]= 539.527, ["z"]= 176.178, ["locked"]= true }, -- torture door
}
--
drawOnScreen3D = function(dx,dy,dz, text, size)

    local onScreen, x, y = World3dToScreen2d(dx,dy,dz)
    local camCoords      = GetGameplayCamCoords()
    local dist           = GetDistanceBetweenCoords(camCoords.x, camCoords.y, camCoords.z, dx, dy, dz, 1)
    local size           = size
  
    if size == nil then
      size = 1
    end
  
    local scale = (size / dist) * 2
    local fov   = (1 / GetGameplayCamFov()) * 100
    local scale = scale * fov
  
    if onScreen then
  
      SetTextScale(0.0 * scale, 0.55 * scale)
      SetTextFont(0)
      SetTextProportional(1)
      SetTextColour(255, 255, 255, 255)
      SetTextDropshadow(0, 0, 0, 0, 255)
      SetTextEdge(2, 0, 0, 0, 150)
      SetTextDropShadow()
      SetTextOutline()
      SetTextEntry('STRING')
      SetTextCentre(1)
  
      AddTextComponentString(text)
  
      DrawText(x, y)
    end
  
  end
--
RegisterNetEvent('iam:frstate')
AddEventHandler('iam:frstate', function(id, isLocked)
    if type(lockState[id]) ~= nil then -- Check if door exists
        lockState[id]["locked"] = isLocked -- Change state of door
    end
end)

--
Citizen.CreateThread(function()
    while true do
        for i=1, #lockState do
                local playerCoords = GetEntityCoords(GetPlayerPed(-1))
                local closeDoor = GetClosestObjectOfType(lockState[i]["x"], lockState[i]["y"], lockState[i]["z"], 1.0, GetHashKey(lockState[i]["objName"]), false, false, false)       
                local distance = GetDistanceBetweenCoords(playerCoords.x,playerCoords.y,playerCoords.z, lockState[i]["x"], lockState[i]["y"], lockState[i]["z"], true)
                if(distance < 1.25) then
                    if lockState[i]["locked"] == true then
                        drawOnScreen3D(lockState[i]["x"], lockState[i]["y"], lockState[i]["z"],"[E] ~r~Locked", 0.3)
                    else
                       drawOnScreen3D(lockState[i]["x"], lockState[i]["y"], lockState[i]["z"],"[E] ~g~Unlocked", 0.3)
                    end
                    if IsControlJustPressed(1,51) then
                        if lockState[i]["locked"] == true then
                            TriggerServerEvent('iam:frupdateState', i, false) -- ask the server to update states... dont just DO it.
                        else
                            TriggerServerEvent('iam:frupdateState', i, true)
                        end                        
                    end
                    FreezeEntityPosition(closeDoor, lockState[i]["locked"])
                else               
                    FreezeEntityPosition(closeDoor, lockState[i]["locked"])
                end
        end 
        Citizen.Wait(0)
    end
end)

Hi, I would like to know if you had the same option to open and close those doors for the entire police station

a script already exists for the police station. if you use ESX, it’s called esx_celldoors

where do I put the ids for players in this? I just want to make sure I am putting it in the right spot. Thanks

can anyone help?

hi,

Hi, I tried to put this animation (lib = “missheistfbisetup1”, anim = “hassle_intro_loop_f”) but I have not had success. Can someone help me? I’m starting to learn .lua

how do i add a different id to the id im using now? i tried defiding it bij , or something but soent work. im not home in writing scripts so im a total noob in this.

does it work like this

lockState = {}
allowedtouse = {
“steam:110000104b88dd8,steam:110000104b88dd8,steam:110000104b88dd8”
}

1 Like