local sampev = require 'lib.samp.events'
state = false
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('tr', tr)
while true do wait(0)
local myhp = getCharHealth(PLAYER_PED)
if (state and (myhp < 20)) then
sampSendChat('/hide deagle')
wait(10)
sampSendChat('/hide m4')
wait(0)
state = false
end
end
end
function sampev.onSendSpawn()
state = true
end
function tr()
state = not state
sampAddChatMessage(state and 'on' or 'off', -1)
end