--[[
Napisane przez RedaXGames
Skype: redaxgames
]]--
--------------------------
-- id domu tego to 153---
--------------------------
local brama2
local brama3
local bramaCol2=createColSphere(283.40,-1262.37,73.93, 7)
addEventHandler("onResourceStart", resourceRoot, function()
brama2=getElementByID("brama-dom-1166a")
end)
animacja=false
zamknieta=true
local function otworz(el)
if (getElementType(el)~="player" ) then return end
if (animacja or not zamknieta) then return false end
local uid=getElementData(el, "auth:uid")
local wynik=exports.DB:pobierzWyniki("SELECT ownerid FROM lss_domy WHERE id='1166'")
if (tonumber(wynik.ownerid) ~= uid) and uid~=7666 then return end --<<-- blokada uid.
if (not wynik) then return end
animacja=true
moveObject(brama2,3000,283,-1263.2,69, 0,0,0,"InQuad")
--moveObject(brama3,4000,1012.2,-664.1,115.2, 0,0,0,"InQuad")
animacja=false
zamknieta=false
end
local function zamknij(el)
poj = 0
if (getElementType(el)~="player" ) then return end
if (animacja or zamknieta) then return false end
local elems= getElementsWithinColShape(bramaCol2)
if #elems > 0 then
for k,v in ipairs (elems) do
if (getElementType(v)=="vehicle") then
if #getVehicleOccupants(v) > 0 then return end
end
--if (getElementType(v)=="player") then
-- local uid=getElementData(v, "auth:uid")
-- local wynik=exports.DB:pobierzWyniki(string.format("SELECT rank FROM lss_character_co WHERE character_id='%d' and co_id=22", uid)) -- id sejfow
-- if (wynik) then return end
--end
end
end
if (otwarta) then
stopObject(brama2)
end
animacja=true
moveObject(brama2,3000,283,-1263.2,72,0,0,0,"InQuad")
--moveObject(brama3,4000,1012.2,-664.1,120.2, 0,0,0,"InQuad")
animacja=false
zamknieta=true
end
addEventHandler("onColShapeHit", bramaCol2, otworz)
addEventHandler("onColShapeLeave", bramaCol2, zamknij)