|
|
|
@ -191,7 +191,7 @@ function main() |
|
|
|
|
server = sampGetCurrentServerName():gsub("|", "") |
|
|
|
|
server = |
|
|
|
|
(server:find("02") and "Two" or |
|
|
|
|
(server:find("Revolution") and "Revolution" or |
|
|
|
|
(server:find("Revo") and "Revolution" or |
|
|
|
|
(server:find("Legacy") and "Legacy" or (server:find("Classic") and "Classic" or |
|
|
|
|
(server:find("Zero Two") and "Two" or ""))))) |
|
|
|
|
if server == "" then |
|
|
|
@ -347,25 +347,6 @@ function settings_load() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- try( |
|
|
|
|
-- function() |
|
|
|
|
-- local file, error = io.open(AdressJson, "r") |
|
|
|
|
-- if file then |
|
|
|
|
-- inifiles = decodeJson(file:read("*a")) |
|
|
|
|
-- io.close(file) |
|
|
|
|
-- end |
|
|
|
|
-- end, |
|
|
|
|
-- function(e) |
|
|
|
|
-- sampAddChatMessage("[TruckHUD] Îøèáêà ÷òåíèÿ êîíôèãà! Ñáðàñûâàþ êîíôèã!", 0xff0000) |
|
|
|
|
-- local file, error = io.open(AdressJson, "w") |
|
|
|
|
-- if file ~= nil then |
|
|
|
|
-- file:write(encodeJson(table_std)) |
|
|
|
|
-- file:flush() |
|
|
|
|
-- io.close(file) |
|
|
|
|
-- end |
|
|
|
|
-- end |
|
|
|
|
-- ) |
|
|
|
|
|
|
|
|
|
local readJson = function() |
|
|
|
|
local file, error = io.open(AdressJson, "r") |
|
|
|
|
if file then |
|
|
|
@ -999,12 +980,6 @@ function doPair() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Ïðîâåðêà íàïàðíèêà íà ïðîòèâîïîëîæíîå ìåñòî |
|
|
|
|
-- pair_table["pos"]["x"], pair_table["pos"]["y"], pair_table["pos"]["z"] |
|
|
|
|
|
|
|
|
|
-- Ñîäåðæàòü ïåðåìåííóþ ãîòîâíîñòè ëîêàëüíîãî ïåðñà |
|
|
|
|
-- Ñîäåðæàòü ïåðåìåííóþ ãîòîâíîñòè íàïàðíèêà |
|
|
|
|
|
|
|
|
|
if pair_table["pos"] ~= nil then |
|
|
|
|
local x, y, z = getCharCoordinates(playerPed) |
|
|
|
|
local result_find = false |
|
|
|
@ -2731,11 +2706,6 @@ function loadEvents() |
|
|
|
|
prices_3dtext[k .. "n"], prices_3dtext[k .. "y"], prices_3dtext[k .. "l"] = cargoN, cargoY, cargoL |
|
|
|
|
prices_3dtext_id[k .. "n"], prices_3dtext_id[k .. "y"], prices_3dtext_id[k .. "l"] = id, id, id |
|
|
|
|
prices_3dtext_pos[k .. "n"], prices_3dtext_pos[k .. "y"], prices_3dtext_pos[k .. "l"] = position, position, position |
|
|
|
|
-- for k, v in pairs(prices_3dtext) do |
|
|
|
|
-- if string.find(tostring(prices_3dtext[k]), "99") then |
|
|
|
|
-- prices_3dtext[k] = tonumber(prices_3dtext[k]) + 1 |
|
|
|
|
-- end |
|
|
|
|
-- end |
|
|
|
|
local port = (text:find("ËÑ") and "ËÑ" or "ÑÔ") |
|
|
|
|
local ctext = |
|
|
|
|
string.format( |
|
|
|
@ -2805,15 +2775,11 @@ function loadEvents() |
|
|
|
|
unload_location = false |
|
|
|
|
current_warehouse = "none" |
|
|
|
|
end |
|
|
|
|
--say("remove 3d text "..Cid) |
|
|
|
|
local result, key = isTruck3dTextDefined(Cid) |
|
|
|
|
if result then |
|
|
|
|
for i = 1, #key do |
|
|
|
|
--prices_3dtext_id[key[i]] = -1 |
|
|
|
|
prices_3dtext_id[key[i]] = nil |
|
|
|
|
prices_3dtext[key[i]] = 0 |
|
|
|
|
|
|
|
|
|
say("Óäàëåíî "..key[i]) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end, Cid) |
|
|
|
@ -2828,7 +2794,6 @@ function isTruck3dTextDefined(id) |
|
|
|
|
local dist = getDistanceBetweenCoords3d(x, y, z, prices_3dtext_pos[k].x, prices_3dtext_pos[k].y, prices_3dtext_pos[k].z) |
|
|
|
|
if id == v and v ~= -1 and dist > 20 then |
|
|
|
|
result = true |
|
|
|
|
say(k) |
|
|
|
|
delete[#delete+1] = k |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -3288,7 +3253,6 @@ function transponder() |
|
|
|
|
local myname = sampGetPlayerNickname(myid) |
|
|
|
|
|
|
|
|
|
if (os.time() - afk_solo_message_false < 7 or os.time() - live > 7) or (solo_message_send.time ~= 0 and os.time() - solo_message_send.time > 5) then -- Î÷èñòèòü åñëè äàííûå óñòàðåëè |
|
|
|
|
say("Î÷èñòêà solo_message - óñòàðåëî!!!") |
|
|
|
|
clearSoloMessage() |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -3322,9 +3286,8 @@ function transponder() |
|
|
|
|
wait_for_response = true |
|
|
|
|
local response_path = os.tmpname() |
|
|
|
|
down = false |
|
|
|
|
sampfuncsLog("http://thprivate.deadpoo.net/" .. encodeJson(request_table)) |
|
|
|
|
download_id_4 = downloadUrlToFile( |
|
|
|
|
"http://thprivate.deadpoo.net/" .. encodeJson(request_table), |
|
|
|
|
"http://th.deadpoo.net/" .. encodeJson(request_table), |
|
|
|
|
response_path, |
|
|
|
|
function(id, status, p1, p2) |
|
|
|
|
if stop_downloading_4 then |
|
|
|
@ -3351,7 +3314,6 @@ function transponder() |
|
|
|
|
local f = io.open(response_path, "r") |
|
|
|
|
if f then |
|
|
|
|
local fileText = f:read("*a") |
|
|
|
|
sampfuncsLog(fileText) |
|
|
|
|
if fileText ~= nil and #fileText > 0 then |
|
|
|
|
try(function() |
|
|
|
|
info = decodeJson(fileText) |
|
|
|
@ -3366,8 +3328,6 @@ function transponder() |
|
|
|
|
if download_call == 0 then |
|
|
|
|
if request_table["info"]["solo_message"]["name"] == solo_message_send.name then |
|
|
|
|
clearSoloMessage() |
|
|
|
|
else |
|
|
|
|
say("ÇÀÙÈÒÀ ÎÒ ÏÅÐÅÇÀÏÈÑÈ ÑÎËÎ ÌÅÑÑÅÄÆ") |
|
|
|
|
end |
|
|
|
|
transponder_delay = info.delay |
|
|
|
|
response_timestamp = info.timestamp |
|
|
|
@ -3504,9 +3464,6 @@ function transponder_solo_message(info) |
|
|
|
|
|
|
|
|
|
if af_say[key] == nil then |
|
|
|
|
af_say[key] = true |
|
|
|
|
say(solo_data_antiflood[sender][i]["name"].." antiflood 10 sek!!") |
|
|
|
|
say(os.time() - solo_data_antiflood[sender][i]["antiflood"].." sec") |
|
|
|
|
say(counter) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -3563,7 +3520,7 @@ function dn(nam) |
|
|
|
|
file = getGameDirectory() .. "\\moonloader\\resource\\TruckHUD\\" .. nam |
|
|
|
|
if not doesFileExist(file) then |
|
|
|
|
downloadUrlToFile( |
|
|
|
|
"http://thprivate.deadpoo.net/download/" .. nam, |
|
|
|
|
"http://th.deadpoo.net/download/" .. nam, |
|
|
|
|
file |
|
|
|
|
) |
|
|
|
|
end |
|
|
|
@ -3686,7 +3643,7 @@ function get_time() |
|
|
|
|
_time = os.time() |
|
|
|
|
if inifiles.Settings.transponder then |
|
|
|
|
local adress = os.getenv('TEMP')..'\\truck-timestamp' |
|
|
|
|
local url = 'http://thprivate.deadpoo.net/timestamp' |
|
|
|
|
local url = 'http://th.deadpoo.net/timestamp' |
|
|
|
|
downloadUrlToFile(url, adress, function(id, status, p1, p2) |
|
|
|
|
if status == dlstatus.STATUSEX_ENDDOWNLOAD then |
|
|
|
|
if doesFileExist(adress) then |
|
|
|
@ -4148,7 +4105,6 @@ function luChecker.vehicleStream(stream, vehicleId, data) |
|
|
|
|
local result, playerId, isTrailer = isVehicleTruckersDelete(luChecker.truckers, vehicleId) |
|
|
|
|
if result then |
|
|
|
|
if isTrailer then |
|
|
|
|
say("traile delete") |
|
|
|
|
luChecker.trailer_delete[#luChecker.trailer_delete + 1] = { time = os.clock() * 1000, playerId = playerId, position = luChecker.truckers[playerId]["data"]["position"] } |
|
|
|
|
luChecker.truckers[playerId]["trailerData"] = { |
|
|
|
|
trailerId = -1 |
|
|
|
@ -4199,8 +4155,6 @@ end |
|
|
|
|
|
|
|
|
|
function luChecker.checkerLoad(playerId, data, position) -- Ïðîâåðêà êîãäà èãðîê ïîëó÷èë ãðóç |
|
|
|
|
if luChecker.truckers[playerId]["trailerData"]["trailerId"] ~= data["trailerId"] then |
|
|
|
|
say(luChecker.truckers[playerId]["trailerData"]["trailerId"].." - "..data["trailerId"]) |
|
|
|
|
sampAddChatMessage(data["trailerId"],-1) |
|
|
|
|
if getLocalPlayerId() ~= playerId then |
|
|
|
|
local trucker_x, trucker_y, trucker_z = position.x, position.y, position.z |
|
|
|
|
local key, x, y, z = getKeysPoint(trucker_x, trucker_y, trucker_z) |
|
|
|
@ -4217,7 +4171,6 @@ function luChecker.checkerLoad(playerId, data, position) -- |
|
|
|
|
cargo = key, |
|
|
|
|
time = os.time() |
|
|
|
|
} |
|
|
|
|
sampAddChatMessage("èãðîê ïîëó÷èë ãðóç "..playerId.." "..dist_localPlayer_storage.." "..dist_trucker_storage.." +++ "..luChecker.truckers[playerId]["trailerData"]["trailerId"].." ++++ "..data["trailerId"],-1) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -4226,11 +4179,9 @@ end |
|
|
|
|
function luChecker.set3Dtext(type, data_old, data, position) |
|
|
|
|
if type == "Ïîðò" then |
|
|
|
|
for key = 1, 3 do |
|
|
|
|
say(string.format("%s %s", data_old[key], data[key])) |
|
|
|
|
if tonumber(data_old[key]) ~= 0 and not (tonumber(data_old[key]) == tonumber(data[1])) then |
|
|
|
|
if tonumber(data_old[key]) > tonumber(data[key]) then |
|
|
|
|
luChecker.price_set[#luChecker.price_set + 1] = { type = "unload", old_price = tonumber(data_old[key]), new_price = tonumber(data[key]), time = os.clock() * 1000, position = position, key = key } |
|
|
|
|
say("Ðàçãðóçêà â ïîðòó ðÿäîì "..key) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -4239,7 +4190,6 @@ function luChecker.set3Dtext(type, data_old, data, position) |
|
|
|
|
local cargoId = (cargoName:find("n") and 1 or (cargoName:find("y") and 2 or (cargoName:find("l") and 3 or 0))) |
|
|
|
|
if cargoId ~= 0 then |
|
|
|
|
luChecker.load_position = { x = position.x, y = position.y, z = position.z } |
|
|
|
|
sampAddChatMessage("ñêëàä ñêëàä ñêëàä "..tonumber(data[1]), -1) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -4259,7 +4209,6 @@ function luChecker.checker() |
|
|
|
|
|
|
|
|
|
if getLocalPlayerId() ~= playerId then |
|
|
|
|
local dist = getDistanceBetweenCoords3d(position_3dtext.x,position_3dtext.y,position_3dtext.z,position_trailer.x,position_trailer.y,position_trailer.z) |
|
|
|
|
say("Äèñòàíöèÿ îò ðàçãðóçèâøåãîñÿ äî ïîðòà "..dist) |
|
|
|
|
if dist < 50 then |
|
|
|
|
local key = getPort(position_trailer.x,position_trailer.y,position_trailer.z) |
|
|
|
|
key = key..cargo_replace[luChecker.price_set[1].key] |
|
|
|
@ -4270,8 +4219,6 @@ function luChecker.checker() |
|
|
|
|
cargo = key, |
|
|
|
|
time = os.time() |
|
|
|
|
} |
|
|
|
|
local text = string.format("èãðîê %s %s %s %s", playerId, (luChecker.price_set[1].type == "load" and "çàãðóçèë" or "ðàçãðóçèë"), key, dist ) |
|
|
|
|
say(">> "..text) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -4301,7 +4248,6 @@ function clear_old_value(key) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
for i = 1, #delete do |
|
|
|
|
say("remove "..key.." "..i) |
|
|
|
|
table.remove(luChecker[key], delete[i]) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -4482,19 +4428,19 @@ script_update = { |
|
|
|
|
end, |
|
|
|
|
command = function() |
|
|
|
|
lua_thread.create(function() |
|
|
|
|
-- local fpath = os.tmpname() |
|
|
|
|
-- local result, text = pcall(openURL, script_update.script_url, fpath) |
|
|
|
|
-- if result and text ~= "" and text:find(thisScript().name:gsub("%-", "%%-")) then |
|
|
|
|
-- local file, error = io.open(thisScript().path, "w") |
|
|
|
|
-- if file ~= nil then |
|
|
|
|
-- file:write(text) |
|
|
|
|
-- file:flush() |
|
|
|
|
-- io.close(file) |
|
|
|
|
-- addChatMessage("Îáíîâëåíèå çàâåðøåíî, ñêðèïò ïåðåçàãðóæåí!") |
|
|
|
|
-- wait(500) |
|
|
|
|
-- thisScript():reload() |
|
|
|
|
-- end |
|
|
|
|
-- end |
|
|
|
|
local fpath = os.tmpname() |
|
|
|
|
local result, text = pcall(openURL, script_update.script_url, fpath) |
|
|
|
|
if result and text ~= "" and text:find(thisScript().name:gsub("%-", "%%-")) then |
|
|
|
|
local file, error = io.open(thisScript().path, "w") |
|
|
|
|
if file ~= nil then |
|
|
|
|
file:write(text) |
|
|
|
|
file:flush() |
|
|
|
|
io.close(file) |
|
|
|
|
addChatMessage("Îáíîâëåíèå çàâåðøåíî, ñêðèïò ïåðåçàãðóæåí!") |
|
|
|
|
wait(500) |
|
|
|
|
thisScript():reload() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end) |
|
|
|
|
end, |
|
|
|
|
menu = { |
|
|
|
|