local ev = require 'samp.events'
local zones, font = {}, nil
local text_position = { x = 25, y = 240 } -- тут можно поменять позицию текста
local function isZoneExist(zoneId) return zones[zoneID] ~= nil end
local function isCharInFlashingZone(char) for zoneID, data in pairs(zones) do if isCharInArea2d(char, data.start.x, data.start.y, data.end_.x, data.end_.y, false) then return true end end return false end
function ev.onCreateGangZone(zoneID, squareStart, squareEnd, color) table.insert(zones, zoneID, { start = squareStart, end_ = squareEnd, main_color = color, flash_color = 0, flashing = false }) end
function ev.onGangZoneFlash(zoneID, color) if isZoneExist(zoneID) then zones[zoneID].flashing = true; zones[zoneID].flash_color = color end end
function ev.onGangZoneStopFlash(zoneID) if isZoneExist(zoneID) then zones[zoneID].flashing = false; zones[zoneID].flash_color = 0 end end
function ev.onGangZoneDestroy(zoneID) if isZoneExist(zoneID) then zones[zoneID] = nil end end
function onD3DLost() if font then renderReleaseFont(font); font = nil end end
function onScriptTerminate(s, q) if s == thisScript() then if font then renderReleaseFont(font); font = nil end end
function onD3DPresent()
if isCharDead(PLAYER_PED) then return end
if not isCharInFlashingZone(PLAYER_PED) then return end
if not font then font = renderCreateFont("Tahoma", 14, 0x5); return end
renderFontDrawText(font, "Вы находитесь в мигающей зоне", text_position.x, text_position.y, 0xFFFFFFFF)
end