add 2 sec wait player/pair AFK

test-utf-8
rubin 2 years ago
parent 563b47149b
commit 25126adfa7
  1. 24
      TruckHUD.lua

@ -67,6 +67,14 @@ local menu = {
[12] = {[1] = "Âîññòàíîâèòü ãðóç", [2] = "Âîññòàíîâèòü ãðóç", run = false}
}
local pair_afk_stop = {
player_live = 0,
pair_live = 0,
auto_stop = 0
}
local pair_mode, sms_pair_mode, report_text, pair_mode_id, pair_mode_name, BinderMode = false, "", "", -1, "Íåò", true
local script_run, control, auto, autoh, wait_auto, pos = false, false, false, true, 0, {[1] = false, [2] = false, [3] = false}
@ -1105,6 +1113,15 @@ function doRenderStats()
sampSetCursorMode(0)
end
end
local afk_wait = (live-pair_afk_stop.player_live > 3 and live-pair_afk_stop.player_live or
(pair_timestamp-pair_afk_stop.pair_live > 3 and pair_timestamp-pair_afk_stop.pair_live or 0))
if afk_wait > 0 then
pair_afk_stop.auto_stop = os.time()
end
pair_afk_stop.player_live = live
pair_afk_stop.pair_live = pair_timestamp
local X, Y, c1, c2 = inifiles.Settings.X1, inifiles.Settings.Y1, inifiles.Render.Color1, inifiles.Render.Color2
local down = (renderGetFontDrawHeight(font) / 6)
local height = (renderGetFontDrawHeight(font) - (renderGetFontDrawHeight(font) / 20))
@ -1167,9 +1184,16 @@ function doRenderStats()
(workload == 1 and "Un" or "") ..
"Load: " .. inifiles.Price[(workload == 1 and "UnLoad" or "Load")] .. "] " or
" {" .. autoColor .. "}[" .. (workload == 1 and "Un" or "") .. "Load] ")
if os.difftime(msk_timestamp, timer) > 178 and isPairModeActive() and os.time() - pair_afk_stop.auto_stop <= 3 then
printStyledString("Wait afk " .. (3 - (os.time() - pair_afk_stop.auto_stop)), 1111, 5)
end
if
os.difftime(msk_timestamp, timer) > 180 and
autoh and
(not isPairModeActive() or (isPairModeActive() and os.time() - pair_afk_stop.auto_stop >= 3)) and
(not isPairModeActive() or (isPairModeActive() and (msk_timestamp - pair_timestamp) < 5)) and
(not isPairModeActive() or (isPairModeActive() and (pair_ready and player_ready))) and
not (isPairModeActive() and inifiles.Settings.auto_load_unload_kd_pair_use and base[pair_mode_name].gruz == current_load and os.difftime(msk_timestamp, base[pair_mode_name].timer) <= 180)

Loading…
Cancel
Save