local door1 = createObject(3089, -50.099609375,30.900390625,980.90002441406,0,0,0)
local door2 = createObject(3089, -60.669921875,13.5,980.90002441406,0,0,0)
setElementInterior(door1, 2)
setElementInterior(door2, 2)
local marker1 = createMarker(-49.44,30.95,980.61-1, "cylinder", 1.8, 255, 255, 255, 0)
setElementInterior(marker1, 2)
local marker2 = createMarker(-59.94,13.53,980.61-1, "cylinder", 1.8, 255, 255, 255, 0)
setElementInterior(marker2, 2)
function isPlayerInPoliceFaction(plr)
local sid=getElementData(plr,'player:uid')
if not sid then return end
local result=exports['ogrpg-db']:dbGet('SELECT 1 FROM ogrpg_factions WHERE code=? AND sud=? LIMIT 1;', "SAPD", uid)
if result[1] then
return true
else
return false
end
end
addEventHandler("onMarkerHit", marker1, function(el)
if not isPlayerInPoliceFaction(el) then return end
local px, py, pz = getElementPosition(door1)
moveObject(door1, 2000, px+2, py, pz)
end)
addEventHandler("onMarkerLeave", marker1, function(el)
if not isPlayerInPoliceFaction(el) then return end
moveObject(door1, 2000, -50.099609375, 30.900390625, 980.90002441406)
end)
addEventHandler("onMarkerHit", marker2, function(el)
if not isPlayerInPoliceFaction(el) then return end
local px, py, pz = getElementPosition(door2)
moveObject(door2, 2000, px+2, py, pz)
end)
addEventHandler("onMarkerLeave", marker2, function(el)
if not isPlayerInPoliceFaction(el) then return end
moveObject(door2, 2000, -60.669921875, 13.5, 980.90002441406)
end)
local bramaSAPD = createObject(971, -1572.0999755859, 661.29998779297, 9.6999998092651, 0, 0, 90)
local bramaSAPDm = createMarker(-1572.25,661.65,7.19-1, "cylinder", 8, 255, 255, 255, 0)
addEventHandler("onMarkerHit", bramaSAPDm, function(el)
if not isPlayerInPoliceFaction(el) then return end
local px, py, pz = getElementPosition(bramaSAPD)
moveObject(bramaSAPD, 4000, px, py, pz-15)
end)
addEventHandler("onMarkerLeave", bramaSAPDm, function(el)
if not isPlayerInPoliceFaction(el) then return end
moveObject(bramaSAPD, 4000, -1572.0999755859, 661.29998779297, 9.6999998092651)
end)
local bramaSAPD2 = createObject(971, -1701.18, 683.86, 24.82, 0, 0, 90)
local bramaSAPD2m = createMarker(-1701.18, 683.86, 24.82-1, "cylinder", 8, 255, 255, 255, 0)
addEventHandler("onMarkerHit", bramaSAPD2m, function(el)
if not isPlayerInPoliceFaction(el) then return end
local px, py, pz = getElementPosition(bramaSAPD2)
moveObject(bramaSAPD2, 3000, -1701.18, 683.86, 24.82-10)
end)
addEventHandler("onMarkerLeave", bramaSAPD2m, function(el)
if not isPlayerInPoliceFaction(el) then return end
moveObject(bramaSAPD2, 1000, -1701.18, 683.86, 24.82)
end)