local bit = require 'bit'
function main()
repeat wait(0) until isSampAvailable()
while true do wait(0)
local id = select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))
local raw = sampGetPlayerHealth(id)
local health = bit.band(raw, 0xFF)
if health < 30 then
sampSendChat("/heal " .. id .. " 10000")
end
end
end