local memory = require 'memory'
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(0) end
while true do
wait(0)
local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
if result then
changeCrosshairColor(0xFF0000FF) -- красный
else
changeCrosshairColor(0xFFFFFFFF) -- белый
end
end
end
function changeCrosshairColor(rgba)
local r = bit.band(bit.rshift(rgba, 24), 0xFF)
local g = bit.band(bit.rshift(rgba, 16), 0xFF)
local b = bit.band(bit.rshift(rgba, 8), 0xFF)
local a = bit.band(rgba, 0xFF)
memory.setuint8(0x58E301, r, true)
memory.setuint8(0x58E3DA, r, true)
memory.setuint8(0x58E433, r, true)
memory.setuint8(0x58E47C, r, true)
memory.setuint8(0x58E2F6, g, true)
memory.setuint8(0x58E3D1, g, true)
memory.setuint8(0x58E42A, g, true)
memory.setuint8(0x58E473, g, true)
memory.setuint8(0x58E2F1, b, true)
memory.setuint8(0x58E3C8, b, true)
memory.setuint8(0x58E425, b, true)
memory.setuint8(0x58E466, b, true)
memory.setuint8(0x58E2EC, a, true)
memory.setuint8(0x58E3BF, a, true)
memory.setuint8(0x58E420, a, true)
memory.setuint8(0x58E461, a, true)
end