script_name('ShowDoor')
script_author('Bredd Lane')
require 'lib.moonloader'
font = renderCreateFont('Arial', 7, 13)
act = false
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampAddChatMessage('{3660E9}[ShowDoor]{FFFFFF} Загружен! Команда - /showdoor',-1)
sampRegisterChatCommand('showdoor',function ()
act = not act
end)
lua_thread.create(render)
while true do
wait(0)
end
end
function render()
while true do wait(0)
if not isPauseMenuActive() then
if act and sampGetGamestate() == 3 and not newdlact then
for k,v in pairs(getAllVehicles()) do
local x,y,z = getCarCoordinates(v)
local positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
local carbool, carid = sampGetVehicleIdByCarHandle(v)
local DoorsStats = getCarDoorLockStatus(v)
local wposX, wposY = convert3DCoordsToScreen(x,y,z)
local statusstr = ''
if DoorsStats == 0 then
statusstr = '{00FF00}Открыто'
elseif DoorsStats == 2 then
statusstr = '{FF0000}Закрыто'
end
local dist = getDistanceBetweenCoords3d(positionX, positionY, positionZ,x,y,z)
if isPointOnScreen(x,y,z,0) and dist < 20 then
renderFontDrawText(font,statusstr,wposX,wposY,-255878787)
end
end
end
end
end
end