job_weapon_enter = createPickup(-49.899,-269.363,7,3,1318,10) -- маркер входа
blip_enter = createBlipAttachedTo(job_weapon_enter, 34)
setBlipVisibleDistance(blip_enter, 200)

function onPlayerLeave(source)
	if (source == localPlayer and getElementType(source) == "player" and not isPedInVehicle(source)) then
		toggleControl("enter_exit",true)
		unbindKey("F","down",enterDoor)
	end
end
addEventHandler("onClientPickupLeave",job_weapon_enter,onPlayerLeave)

function onPlayerHit(source)
	if (source == localPlayer and getElementType(source) == "player" and not isPedInVehicle(source)) then
		toggleControl("enter_exit",false)
		bindKey ("F","down",enterDoor)
        outputChatBox("Нажмите #7979dcF#ffffff, чтобы войти в это здание.",255,255,255,true)
	end
end
addEventHandler("onClientPickupHit",job_weapon_enter,onPlayerHit)

function enterDoor()
    unbindKey("F","down",exitDoor)
	triggerServerEvent("enterDoor",localPlayer,localPlayer)
end

job_weapon_exit = createPickup(2523.464,-1301.870,1048.5,3,1318,10) -- маркер выхода
setElementDimension(job_weapon_exit, 1)
setElementInterior(job_weapon_exit, 2)

function onPlayerHit2(source)
	if (source == localPlayer and getElementType(source) == "player" and not isPedInVehicle(source)) then
		toggleControl("enter_exit",false)
		bindKey ("F","down",exitDoor)
        outputChatBox("Нажмите #7979dcF#ffffff, чтобы выйти из этого здания.",255,255,255,true)
	end
end
addEventHandler("onClientPickupHit",job_weapon_exit,onPlayerHit2)

function onPlayerLeave2(source)
	if (source == localPlayer and getElementType(source) == "player" and not isPedInVehicle(source)) then
		toggleControl("enter_exit",true)
		unbindKey("F","down",exitDoor)
	end
end
addEventHandler("onClientPickupLeave",job_weapon_exit,onPlayerLeave2)

function exitDoor()
    unbindKey("F","down",enterDoor)
	triggerServerEvent("exitDoor",localPlayer,localPlayer)
end