function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(0) end
repeat wait(0) until sampGetCurrentServerName() ~= "SA-MP"
repeat wait(0) until sampGetCurrentServerName():find("Samp%-Rp.Ru")
lua_thread.create(get_time)
local _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
my_nick = sampGetPlayerNickname(my_id)
server = sampGetCurrentServerName():gsub("|", "")
server =
(server:find("02") and "Two" or
(server:find("Revolution") and "Revolution" or
(server:find("Legacy") and "Legacy" or (server:find("Classic") and "Classic" or ""))))
if server == "" then
thisScript():unload()
end
AdressConfig = string.format("%s\\moonloader\\config ", getGameDirectory())
AdressBind = string.format("%s\\moonloader\\config\\TruckHUD\\Binder.txt", getGameDirectory())
AdressFolder = string.format("%s\\moonloader\\config\\TruckHUD\\%s-%s", getGameDirectory(), server, my_nick)
AdressLogFolder = string.format("%s\\Log\\", AdressFolder)
AdressIni = string.format("TruckHUD\\%s-%s\\Settings.ini", server, my_nick)
AdressBlackList = string.format("%s\\moonloader\\config\\TruckHUD\\BlackList.txt", getGameDirectory())
if not doesDirectoryExist(AdressConfig) then
createDirectory(AdressConfig)
end
if not doesDirectoryExist(AdressLogFolder) then
createDirectory(AdressLogFolder)
end
local x1, y1 = convertGameScreenCoordsToWindowScreenCoords(14.992679595947, 274.75)
local x2, y2 = convertGameScreenCoordsToWindowScreenCoords(146.17861938477, 345.91665649414)
local x3, y3 = convertGameScreenCoordsToWindowScreenCoords(529.42901611328, 158.08332824707)
inifiles =
inicfg.load(
{
Settings = {
ad = true,
AutoWait = true,
highlight_jf = true,
Style = true,
Stop = true,
MonDownload = true,
ChatOFF = false,
ChatDoklad = false,
X1 = x1,
Y1 = y1,
X2 = x2,
Y2 = y2,
X3 = x3,
Y3 = y3,
AutoOFF = false,
Tuning = true,
Report = true,
Key = 90,
Key1 = "VK_RBUTTON",
Key2 = "VK_Z",
Key3 = "VK_LBUTTON",
Key4 = "VK_M",
Key5 = "VK_K",
Key6 = "VK_OEM_COMMA",
Binder = true,
SMSpara = false,
ColorPara = "ff9900",
LightingPara = true,
LightingPrice = true,
girl = false,
pickup = true,
markers = true
},
Render = {
FontName = "Segoe UI",
FontSize = 10,
FontFlag = 15,
Color1 = "2f72f7",
Color2 = "FFFFFF"
},
Trucker = {
Skill = 1,
ReysSkill = 0,
Rank = 1,
ReysRank = 0,
ProcSkill = 100.0,
ProcRank = 100.0,
MaxZP = 197000
},
map = {
sqr = false
},
Stats = {
Hour = true,
Day = true
},
Price = {
Load = 500,
UnLoad = 800
},
tmonitor = {
time = 0,
n1 = 0, n2 = 0, y1 = 0, y2 = 0, l1 = 0, l2 = 0, lsn = 0, lsy = 0, lsl = 0, sfn = 0, sfy = 0, sfl = 0
}
},
AdressIni
)
inicfg.save(inifiles, AdressIni)
for k,v in pairs(prices_mon) do
prices_mon[k] = inifiles.tmonitor[k]
end
mon_time = inifiles.tmonitor.time
if inifiles.Settings.ad then
local fpath = os.getenv("TEMP") .. "\\TruckHUD-version.txt"
download_id_1 = downloadUrlToFile(
"https://raw.githubusercontent.com/Serhiy-Rubin/TruckHUD/master/version",
fpath,
function(id, status, p1, p2)
if stop_downloading_1 then
stop_downloading_1 = false
download_id_1 = nil
return false
end
if status == dlstatus.STATUS_ENDDOWNLOADDATA then
local f = io.open(fpath, "r")
if f then
local text = f:read("*a")
if text ~= nil then
if not string.find(text, tostring(thisScript().version)) then
sampAddChatMessage(
">> Вышло обновление для Truck HUD, версия от " ..
text .. ". Текущая версия от " .. thisScript().version,
0xFF2f72f7
)
sampAddChatMessage(
">> Посмотреть список изменений: /truck up. Включить/Выключить уведомления: /truck ad",
0xFF2f72f7
)
sampAddChatMessage(
">> Официальная страница Truck HUD: https://vk.com/rubin.mods",
0xFF2f72f7
)
end
end
io.close(f)
end
end
end
)
end
if not doesFileExist(AdressBind) then
local text = "кд !КД\nНа месте\nБеру\nРазгружаю\nБерем по КД\nСдаем по КД\nЗадержусь\n"
file = io.open(AdressBind, "a")
file:write(text)
file:flush()
io.close(file)
end
menu[3].run = inifiles.Settings.Report
font = renderCreateFont(inifiles.Render.FontName, inifiles.Render.FontSize, inifiles.Render.FontFlag)
ReadLog()
--gmap area
lua_thread.create(transponder)
lua_thread.create(fastmap)
--gmap area
while true do
wait(0)
doControl()
doSendCMD()
doDialog()
doPair()
doPickup()
doMarkers()
if script_run then
if not sampIsScoreboardOpen() and sampIsChatVisible() and not isKeyDown(116) and not isKeyDown(121) then
doRenderStats()
doRenderMon()
doRenderBind()
end
end
end
end