Forcing a door open

Btw. which Vault door do you want to open? The Union Deposity one or the one from the Pacific Standard Bank?

Sorry, I was going to warn you about the screenshot’s unrelated position. I want to focus on the pacific standard bank door in the basement, but both would be splendid

Also, changing the quotes to regular string quotes crashed my game.

local VaultDoor = GetClosestObjectOfType(255.2283, 223.976, 102.3932, 25.0, GetHashKey("v_ilev_bk_vaultdoor"), 0, 0, 0)

Both are possible, but I am working on the Pacific Standard door rn

To prevent crashes, check if you got the entity handle:

local VaultDoor = GetClosestObjectOfType(PlayerPos.x, PlayerPos.y, PlayerPos.z, 100.0, 961976194, 0, 0, 0)
if VaultDoor ~= nil and VaultDoor ~= 0 then
	-- YOUR CODE HERE
end

I come from a java background so seeing ~= instead of != is bugging the shit out of me

1 Like

It is finished!

VaultDoorSystem [1.0.0][Without Update Check].rar (1.8 KB)

VirusTotal Scan

Currently only the Pacific Standard Vault Door and not tested if it works when there are other players in the server.

Configuration: Open the config.lua and edit the values to your liking.

Usage: Go to the terminal next to the door and follow the instructions.

2 Likes

If you’re familiar with ESX, can you tell me how to get this to work?

local CodeEnteredCorrect = false
	if PlayerData.job ~= nil then 
		print(PlayerData.job.name)
		if PlayerData.job.name == 'banker' then
			local CodeEnteredCorrect = true
		elseif PlayerData.job.name ~= 'banker' then
			CodeEnteredCorrect = false
		end
	end

I am not familiar with ESX but I can take a look at it later.

Got it:

ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

Citizen.CreateThread(function()
	print(ESX.PlayerData.job == nil)
	if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'banker' then
	local CodeEnteredCorrect = false

I removed the needing to press keys in my version, as I want to play a sound automatically with the InteractSound resource.

TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 20, 'vaultopen', 1.0)

unfortunately, nothing is heard
https://plunkettscott.gitbooks.io/scott-s-script-documentation/content/scripts/interactsound.html

I stuck the vaultopen.ogg in the InteractSound\client\html\sounds directory as per the instructions

InteractSound’s __resource.lua

files({
    'client/html/index.html',
    -- Begin Sound Files Here...
    'client/html/sounds/lock.ogg',
    'client/html/sounds/unlock.ogg',
    'client/html/sounds/demo.ogg',
	'client/html/sounds/vaultopen.ogg'
})

Send me the .ogg - files please.

http://www.mediafire.com/file/h35gcprcwz1oyqy/vaultopen.ogg

the length may need to be trimmed down and maybe several files of various lengths for each selected door speed.

Tested the script with a friend and when he activated the console the door only opened/closed for him The sound plays globally as it should now

Yep, what I expected… I will take a look at it tomorrow

Okay, I kinda fixed the networking part, but in a really shitty way…

When I have more time, I am going to improve it.

Here it is:

VaultDoorSystem [1.1.0][Without Update Check].rar (2.7 KB)

VirusTotal Scan

What exactly is GetPlayerList() doing in client.lua? It seems to get a list of players but not do anything with it

It updates the Playerlist table with the currently connected and active player.

That table is used when the door is opened/closed, to know where to send the command to.

You can move VaultDoor = GetClosestObjectOfType(Terminal.x, Terminal.y, Terminal.z, 25.0, GetHashKey('V_ILEV_BK_VAULTDOOR'), 0, 0, 0) out of the loop thats called every frame and it will reduce resmon time from 0.10ms to 0.01

Like below

Citizen.CreateThread(function()
	while true do
		VaultDoor = GetClosestObjectOfType(Terminal.x, Terminal.y, Terminal.z, 25.0, GetHashKey('V_ILEV_BK_VAULTDOOR'), 0, 0, 0)
		Wait(5000)
	end
end)

1 Like

i modified a vaultdoor system to open all vault doors in the city . it worked , the only issue is it uses the player list to update the door position so sometimes if the door is already open and someone just joined the server he will see it close . message me and i ll give u what i made

I’ve already got it all sorted.

Since I am new to the forums and don’t have enough trust to post in the releases section I have merged a this resource with another to allow a player to hack open the vault door at the Pacific Standard. Msg me if you would like the script. Here is the Virus Scan

Credit goes to @zr0iq and @Flatracer

1 Like