added 2 min vip timer & bump version

master
rubin 4 months ago
parent be0d5d9184
commit 026636c7e3
  1. 75
      TruckHUD.lua
  2. 5
      changelog
  3. 2
      version

@ -1,6 +1,6 @@
script_name("TruckHUD") script_name("TruckHUD")
script_author("Serhiy_Rubin") script_author("Serhiy_Rubin")
script_version("30.06.2023") script_version("24.11.2023")
local inicfg = require "inicfg" local inicfg = require "inicfg"
local dlstatus = require("moonloader").download_status local dlstatus = require("moonloader").download_status
@ -196,8 +196,8 @@ function main()
(server:find("02") and "Two" or (server:find("02") and "Two" or
(server:find("Revo") and "Revolution" or (server:find("Revo") and "Revolution" or
(server:find("Legacy") and "Legacy" or (server:find("Classic") and "Classic" or (server:find("Legacy") and "Legacy" or (server:find("Classic") and "Classic" or
(server:find("Zero Two") and "Two" or (server:find("Zero Two") and "Two" or
(server:find("TEST") and "TEST" or (server:find("TEST") and "TEST" or
(server:find("Underground") and "Underground" or "" ))))))) (server:find("Underground") and "Underground" or "" )))))))
if server == "" then if server == "" then
thisScript():unload() thisScript():unload()
@ -230,7 +230,7 @@ function main()
lua_thread.create(luChecker.checker) lua_thread.create(luChecker.checker)
lua_thread.create(doCruise) lua_thread.create(doCruise)
platinum_check()
repeat repeat
wait(0) wait(0)
@ -347,7 +347,11 @@ function settings_load()
binder = { '/r На месте', '/r Загружаюсь', '/r Задержусь', '/r Разгружаюсь' }, binder = { '/r На месте', '/r Загружаюсь', '/r Задержусь', '/r Разгружаюсь' },
binder_sms = { '/sms !ИдПары На месте', '/sms !ИдПары Загружаюсь', '/sms !ИдПары Задержусь', '/sms !ИдПары Разгружаюсь' }, binder_sms = { '/sms !ИдПары На месте', '/sms !ИдПары Загружаюсь', '/sms !ИдПары Задержусь', '/sms !ИдПары Разгружаюсь' },
blacklist = {}, blacklist = {},
version = thisScript().version version = thisScript().version,
platinum = {
status = false,
time = 0
}
} }
if not doesFileExist(AdressJson) then if not doesFileExist(AdressJson) then
local file, error = io.open(AdressJson, "w") local file, error = io.open(AdressJson, "w")
@ -779,6 +783,11 @@ function doDialog()
) )
end end
end end
if str:find("Platinum VIP") then
inifiles.platinum.status = not inifiles.platinum.status
settings_save()
ShowDialog1(1)
end
if str:find("Шрифт") then if str:find("Шрифт") then
if dialogTextToList[list + 1] ~= nil then if dialogTextToList[list + 1] ~= nil then
ShowDialog1(2, dialogTextToList[list + 1], inifiles.Render.FontName, true, "Render", "FontName") ShowDialog1(2, dialogTextToList[list + 1], inifiles.Render.FontName, true, "Render", "FontName")
@ -1145,7 +1154,8 @@ function doRenderStats()
end end
end end
Y = Y + height Y = Y + height
timer_secc = 180 - os.difftime(msk_timestamp, timer) sec_timer = (inifiles.platinum.status and 120 or 180)
timer_secc = sec_timer - os.difftime(msk_timestamp, timer)
local ost_time = 3600 - (os.date("%M", msk_timestamp) * 60) + (os.date("%S", msk_timestamp)) local ost_time = 3600 - (os.date("%M", msk_timestamp) * 60) + (os.date("%S", msk_timestamp))
local greys = 0 local greys = 0
if workload == 1 then if workload == 1 then
@ -1159,7 +1169,7 @@ function doRenderStats()
end end
end end
greys = greys + math.floor(ost_time / 360) greys = greys + math.floor(ost_time / 360)
if timer_secc >= 177 and workload == 0 and isTruckCar() and inifiles.Settings.Stop then if timer_secc >= (sec_timer - 3) and workload == 0 and isTruckCar() and inifiles.Settings.Stop then
setGameKeyState(6, 255) setGameKeyState(6, 255)
end end
timer_min, timer_sec = math.floor(timer_secc / 60), timer_secc % 60 timer_min, timer_sec = math.floor(timer_secc / 60), timer_secc % 60
@ -1205,12 +1215,12 @@ function doRenderStats()
end end
if if
os.difftime(msk_timestamp, timer) > 180 and os.difftime(msk_timestamp, timer) > sec_timer and
autoh and autoh and
(not isPairModeActive() or (isPairModeActive() and os.time() - pair_afk_stop.auto_stop >= 3)) 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 (msk_timestamp - pair_timestamp) < 5)) and
(not isPairModeActive() or (isPairModeActive() and (pair_ready and player_ready))) 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) 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) <= sec_timer)
then then
if workload == 1 then if workload == 1 then
if unload_location then if unload_location then
@ -1335,7 +1345,7 @@ function doRenderStats()
end end
if inifiles.Settings.pairinfo and pair_mode and pair_status == 200 and pair_table ~= nil and pair_table["pos"] ~= nil and base[pair_mode_name] ~= nil then if inifiles.Settings.pairinfo and pair_mode and pair_status == 200 and pair_table ~= nil and pair_table["pos"] ~= nil and base[pair_mode_name] ~= nil then
local afk = msk_timestamp - pair_timestamp local afk = msk_timestamp - pair_timestamp
local timer_d = 180 - (base[pair_mode_name].timer > 1000 and os.difftime(msk_timestamp, base[pair_mode_name].timer) or 181) local timer_d = sec_timer - (base[pair_mode_name].timer > 1000 and os.difftime(msk_timestamp, base[pair_mode_name].timer) or (sec_timer+1))
local color = ( not player_ready and "" or ( local color = ( not player_ready and "" or (
pair_ready and "{07a817}" or "{d90b0b}" pair_ready and "{07a817}" or "{d90b0b}"
)) ))
@ -1846,6 +1856,7 @@ end
function ShowDialog1(int, dtext, dinput, string_or_number, ini1, ini2) function ShowDialog1(int, dtext, dinput, string_or_number, ini1, ini2)
d[1], d[2], d[3], d[4], d[5], d[6] = int, dtext, dinput, string_or_number, ini1, ini2 d[1], d[2], d[3], d[4], d[5], d[6] = int, dtext, dinput, string_or_number, ini1, ini2
if int == 1 then if int == 1 then
local new = "{59fc30}[NEW]{ffffff} "
dialogLine, dialogTextToList, iniName = {}, {}, {} dialogLine, dialogTextToList, iniName = {}, {}, {}
dialogLine[#dialogLine + 1] = (script_run and "TruckHUD\t{59fc30}ON" or "TruckHUD\t{ff0000}OFF") dialogLine[#dialogLine + 1] = (script_run and "TruckHUD\t{59fc30}ON" or "TruckHUD\t{ff0000}OFF")
@ -1948,6 +1959,8 @@ function ShowDialog1(int, dtext, dinput, string_or_number, ini1, ini2)
dialogTextToList[#dialogLine] = dialogTextToList[#dialogLine] =
"{FFFFFF}Введите новый цвет в HEX\nПодобрать цвет можно через браузер\nЧтобы скопировать ссылку введите /truck url" "{FFFFFF}Введите новый цвет в HEX\nПодобрать цвет можно через браузер\nЧтобы скопировать ссылку введите /truck url"
dialogLine[#dialogLine + 1] = new.."Platinum VIP (2 мин кд)\t" .. (inifiles.platinum.status == true and "{59fc30}ON" or "{ff0000}OFF")
dialogLine[#dialogLine + 1] = "Шрифт\t" .. inifiles.Render.FontName -- 7 dialogLine[#dialogLine + 1] = "Шрифт\t" .. inifiles.Render.FontName -- 7
dialogTextToList[#dialogLine] = "{FFFFFF}Введите название шрифта" dialogTextToList[#dialogLine] = "{FFFFFF}Введите название шрифта"
@ -2250,6 +2263,25 @@ function loadEvents()
end end
function sampev.onServerMessage(color, message) function sampev.onServerMessage(color, message)
if message:find("У вас .E5E4E2.PLATINUM VIP.EAC700. до %d+/%d+/%d+ %d+:%d+") then
local year, mounth, day, hour, min = message:match("У вас .E5E4E2.PLATINUM VIP.EAC700. до (%d+)/(%d+)/(%d+) (%d+):(%d+)")
datetime = {
year = tonumber(year),
month = tonumber(mounth),
day = tonumber(day),
hour = tonumber(hour),
min = tonumber(min),
sec = 5
}
if os.time(datetime) ~= inifiles.platinum.time then
inifiles.platinum.time = os.time(datetime)
settings_save()
end
if not inifiles.platinum.status then
inifiles.platinum.status = true
settings_save()
end
end
if string.find(message, " Нефть: %d+ / (%d+)$") then if string.find(message, " Нефть: %d+ / (%d+)$") then
maxload_int = tonumber(string.match(message, " Нефть: %d+ / (%d+)$")) maxload_int = tonumber(string.match(message, " Нефть: %d+ / (%d+)$"))
end end
@ -3111,7 +3143,8 @@ function transponder()
paraid = pair_mode_id, paraid = pair_mode_id,
timer = timer, timer = timer,
tmonitor = inifiles.tmonitor, tmonitor = inifiles.tmonitor,
version = inifiles.version version = inifiles.version,
platinum = inifiles.platinum.status
}, },
solo_message = solo_message_send solo_message = solo_message_send
} }
@ -3573,7 +3606,11 @@ function showTruckers()
if (sampIsPlayerConnected(v.id) or myid == v.id) and sampGetPlayerNickname(v.id) == k then if (sampIsPlayerConnected(v.id) or myid == v.id) and sampGetPlayerNickname(v.id) == k then
trucker_count = trucker_count + 1 trucker_count = trucker_count + 1
local afk = math.ceil(msk_timestamp - v.timestamp) local afk = math.ceil(msk_timestamp - v.timestamp)
dialogText = string.format('%s%s[%s] %s\t%s / %s\t%s\t%s\n', dialogText, k, v.id, (afk > 10 and '[AFK: '..afk..']' or ''), v.skill, v.rank, ( (v.is_truck and 'Да ' or 'Нет ')..(v.gruz == 0 and '/ Нет' or (v.gruz == 1 and '/ Нефть' or (v.gruz == 2 and '/ Уголь' or (v.gruz == 3 and '/ Дерево' or '/ Нет')))) ), ( v.pair_mode_name == '____' and 'Нет' or v.pair_mode_name..'['..v.paraid..']')) local platinum = ""
if v.platinum then
platinum = "[VIP] "
end
dialogText = string.format('%s%s%s[%s] %s\t%s / %s\t%s\t%s\n', dialogText, platinum, k, v.id, (afk > 10 and '[AFK: '..afk..']' or ''), v.skill, v.rank, ( (v.is_truck and 'Да ' or 'Нет ')..(v.gruz == 0 and '/ Нет' or (v.gruz == 1 and '/ Нефть' or (v.gruz == 2 and '/ Уголь' or (v.gruz == 3 and '/ Дерево' or '/ Нет')))) ), ( v.pair_mode_name == '____' and 'Нет' or v.pair_mode_name..'['..v.paraid..']'))
end end
end end
end end
@ -3593,13 +3630,14 @@ function renderTruckers()
local stream, ped = sampGetCharHandleBySampPlayerId(id) local stream, ped = sampGetCharHandleBySampPlayerId(id)
if stream then if stream then
if (isCharInModel(ped, 403) or isCharInModel(ped, 514) or isCharInModel(ped, 515)) then if (isCharInModel(ped, 403) or isCharInModel(ped, 514) or isCharInModel(ped, 515)) then
sec_timer = (base[nickname].platinum and 120 or 180)
local car = storeCarCharIsInNoSave(ped) local car = storeCarCharIsInNoSave(ped)
local result, idcar = sampGetVehicleIdByCarHandle(car) local result, idcar = sampGetVehicleIdByCarHandle(car)
if _3dTextplayers[id] == nil and result then if _3dTextplayers[id] == nil and result then
_3dTextplayers[id] = sampCreate3dText(' ', -1, 0.0, 0.0, 0.0, 30.0, false, -1, idcar) _3dTextplayers[id] = sampCreate3dText(' ', -1, 0.0, 0.0, 0.0, 30.0, false, -1, idcar)
end end
if _3dTextplayers[id] ~= nil and result then if _3dTextplayers[id] ~= nil and result then
local timer_player = 180 - (base[nickname].timer > 1000 and os.difftime(msk_timestamp, base[nickname].timer) or 181) local timer_player = sec_timer - (base[nickname].timer > 1000 and os.difftime(msk_timestamp, base[nickname].timer) or (sec_timer+1))
local color = (timer_player <= 0 and inifiles.Render.Color2 or (timer_player <= 10 and 'b50000' or inifiles.Render.Color2)) local color = (timer_player <= 0 and inifiles.Render.Color2 or (timer_player <= 10 and 'b50000' or inifiles.Render.Color2))
local kd_player = (timer_player > 0 local kd_player = (timer_player > 0
and and
@ -3615,7 +3653,7 @@ function renderTruckers()
) )
local pair_kd = '' local pair_kd = ''
if base[nickname].pair_mode_name ~= '____' and base[base[nickname].pair_mode_name] ~= nil then if base[nickname].pair_mode_name ~= '____' and base[base[nickname].pair_mode_name] ~= nil then
local timer_d = 180 - (base[base[nickname].pair_mode_name].timer > 1000 and os.difftime(msk_timestamp, base[base[nickname].pair_mode_name].timer) or 181) local timer_d = sec_timer - (base[base[nickname].pair_mode_name].timer > 1000 and os.difftime(msk_timestamp, base[base[nickname].pair_mode_name].timer) or (sec_timer+1))
local color = (timer_d <= 0 and inifiles.Render.Color2 or (timer_d <= 10 and 'b50000' or inifiles.Render.Color2)) local color = (timer_d <= 0 and inifiles.Render.Color2 or (timer_d <= 10 and 'b50000' or inifiles.Render.Color2))
pair_kd = string.format('(%s{%s})', (timer_d > 0 and string.format('{%s}%d:%02d', color, math.floor(timer_d / 60), timer_d % 60) or string.format('{%s}0:00', inifiles.Render.Color2)), inifiles.Render.Color2) pair_kd = string.format('(%s{%s})', (timer_d > 0 and string.format('{%s}%d:%02d', color, math.floor(timer_d / 60), timer_d % 60) or string.format('{%s}0:00', inifiles.Render.Color2)), inifiles.Render.Color2)
end end
@ -4098,6 +4136,15 @@ function luChecker.checker()
end end
end end
-- platinum
function platinum_check()
if inifiles.platinum.status and inifiles.platinum.time < os.time() then
addChatMessage("'Platinum VIP' закончился. Теперь у Вас кд сново 3 минуты")
inifiles.platinum.status = false
settings_save()
end
end
function getLocalPlayerId() function getLocalPlayerId()
return select(2,sampGetPlayerIdByCharHandle(PLAYER_PED)) return select(2,sampGetPlayerIdByCharHandle(PLAYER_PED))
end end

@ -30,4 +30,7 @@
Исправлен баг не работало 'Дальнобойщики онлайн' Исправлен баг не работало 'Дальнобойщики онлайн'
Версия от 30.06.2023 Версия от 30.06.2023
Добавлена поддержка нового сервера Underground Добавлена поддержка нового сервера Underground
Версия от 24.11.2023
Добавлен таймер 2 минуты для VIP

@ -1 +1 @@
30.06.2023 24.11.2023
Loading…
Cancel
Save