function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(0) end
while true do wait(0)
local health = getCharHealth(PLAYER_PED)
if health <= 20 then -- желаемое количество хп
local id = select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))
sampSendChat("/heal "..id)
end
end
end