local timed = 280 -- секунд
------------------------------------------------------------
local time = timed
local ee = false
local smoke = false
local q = require('lib.samp.events')
local timeid = math.floor(timed / 60)
function main()
repeat wait(0) until isSampAvailable()
wait(50)
lua_thread.create(hui)
sampRegisterChatCommand("afkbaryga", function() ee = not ee sampAddChatMessage(ee and "AFK барыга activated. След выход из АФК через "..timeid.." мин!" or "AFK барыга off", -1) time = timed end)
while true do
wait(0)
if ee then
if time == 0 then
ee = false
if sampGetGamestate() == 3 then
health = getCharHealth(PLAYER_PED)
if health <= -1 then
sampAddChatMessage("Выход из АФК, сейчас закурю и вернусь в афк",-1)
smoke = true
sampSendChat("/smoke")
else
sampAddChatMessage("Выход из АФК, сейчас вернусь в афк",-1)
wait(2000 + math.random (5000))
sampAddChatMessage("Вы в АФК! Через "..timeid.." минут выход",-1)
time = math.random (100, 280)
ee = true
end
end
else
wait(1000)
time = time-1
end
end
end
end
function q.onSendPlayerSync(data)
if ee then return false end
end
function q.onSendClientJoin()
ee = false
time = timed
end
function q.onSendDeathNotification(reason, killerId)
ee = false
time = timed
end
function hui()
while true do wait(0)
WorkInBackground(true)
end
end
function WorkInBackground(work)
local memory = require 'memory'
if work then
memory.setuint8(7634870, 1)
memory.setuint8(7635034, 1)
memory.fill(7623723, 144, 8)
memory.fill(5499528, 144, 6)
else
memory.setuint8(7634870, 0)
memory.setuint8(7635034, 0)
memory.hex2bin('5051FF1500838500', 7623723, 8)
memory.hex2bin('0F847B010000', 5499528, 6)
end
end