[Release] Doors Control (vrp)

Is there a possibility to remove a key given to a player in case he is no longer a part of the police?

you don`t need key if you have permission . :slight_smile:

how do i unlock and lock doors

Will not you do database support? Due to the fact that the server locally checks all the doors, the FPS falls very much. Unlike the original, where the doors were checked through a database and this saved up to 15 fps

New version of resource


improve performance and stability, 1 config for client and server

1 Like

No working for Server vRP

Thx for this geat fix @XanderWP ! it’s working for me :wink:

You have these in __resource.lua “client/Tunnel.lua” “client/Proxy.lua” I do not think you need them :+1:

i got this error ?

Error loading script server.lua in resource vRP_doorsControl: @vrp/lib/utils.lua:13: bad argument #1 to ‘load’ (function expected, got nil)
stack traceback:
[C]: in function ‘load’
@vrp/lib/utils.lua:13: in function ‘module’
server.lua:6: in main chunk

@The_Beast rename resource folder to

doors

1 Like

At first i try to use tunnel and proxy, but after i think that Event is quite enough

Oh thanks now it works :slight_smile:

can you tell me what this is “swarka = true” i can’t find out what it is ?

will this work ?

[1] = { offset = -1.2, hash = 2608952911, x = -816.1068, y = 177.5109, z = 72.82738, locked = true, key = "back_door", pair = 2},
  [2] = { offset = -1.2, hash = 159994461, x = -816.716, y = 179.098, z = 72.82738, locked = true, key = "back_door", pair = 1},

instead of

[1] = { offset = -1.2, mystatus = false, hash = 1557126584, x = 449.69815063477, y = -986.46911621094, z = 30.689594268799, locked = true, key = "key_lspd", permission="police.pc", name = "LSPD"},
  [2] = { offset = -1.2, mystatus = false, hash = 749848321, x = 452.61877441406, y = -982.7021484375, z = 30.689598083496, locked = true, key = "key_lspd", permission="police.pc", name = "LSPD"},

oh yas! (2020202)2020

I use this param for my other script (hack door) and forget remove it

you also have an offset and a mystatus that you never use :wink:

I’ll try found time for update resource and use this param. I use param offset for draw lockstatus text near door handle (it’s better than static parametr for my think) in my other resource where player can interract with world by mouse cursor

So this does not work with the most recent version of vRP… Which has been out for months and months!!!
Get with the program ppl! :joy:

for updated vRP
server.lua

–[[-----------------
Doors Control By XanderWP from Ukraine with <3
------------------------]]–

local Tunnel = module(“vrp”, “lib/Tunnel”)
local Proxy = module(“vrp”, “lib/Proxy”)
vRP = Proxy.getInterface(“vRP”)
vRPclient = Tunnel.getInterface(“vRP”, “doors”)

local cfg = module(“doors”, “config”)

AddEventHandler(“vRP:playerSpawn”,function(user_id,source,first_spawn)
if first_spawn then
TriggerClientEvent(‘vrpdoorsystem:load’, source, cfg.list)
end
end)

Citizen.CreateThread(function()
Citizen.Wait(500)
TriggerClientEvent(‘vrpdoorsystem:load’, -1, cfg.list)
end)

RegisterServerEvent(‘vrpdoorsystem:open’)
AddEventHandler(‘vrpdoorsystem:open’, function(id)
local user_id = vRP.getUserId(source)
local player = vRP.getUserSource(user_id)
if vRP.hasPermission(user_id, “#”…cfg.list[id].key…".>0") or vRP.hasPermission(user_id,cfg.list[id].permission) then
vRPclient.playAnim(player, false,{{“misscommon@locked_door”, “lockeddoor_tryopen”}}, false)
SetTimeout(4000, function()
cfg.list[id].locked = not cfg.list[id].locked
TriggerClientEvent(‘vrpdoorsystem:statusSend’, (-1), id,cfg.list[id].locked)
if cfg.list[id].pair ~= nil then
local idsecond = cfg.list[id].pair
cfg.list[idsecond].locked = cfg.list[id].locked
TriggerClientEvent(‘vrpdoorsystem:statusSend’, (-1), idsecond,cfg.list[id].locked)
end
if cfg.list[id].locked then
vRPclient.notifyPicture(player, “CHAR_FACEBOOK”, 1, “Building Key System”, “”, “Door Locked with " …cfg.list[id].name… " key.”)
else
vRPclient.notifyPicture(player, “CHAR_FACEBOOK”, 1, “Building Key System”, “”, “Door Unlocked with " …cfg.list[id].name… " key.”)
end
end)
else
vRPclient.notifyPicture(player, “CHAR_FACEBOOK”, 1, “Building Key System”, “”, “You need the " …cfg.list[id].name… " key to lock/unlock the door”)
end
end)

how can I close doors again