|
|
|
@ -7,6 +7,7 @@ local dlstatus = require("moonloader").download_status |
|
|
|
|
local vkeys = require "lib.vkeys" |
|
|
|
|
local ffi = require("ffi") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ffi.cdef [[ bool SetCursorPos(int X, int Y); ]] |
|
|
|
|
|
|
|
|
|
function try(f, catch_f) |
|
|
|
@ -2107,15 +2108,12 @@ function loadEvents() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
function sampev.onVehicleSync(playerId, vehicleId, data) |
|
|
|
|
--lua_thread.create(luChecker.vehicleSync, playerId, vehicleId, data) |
|
|
|
|
luChecker.vehicleSync(playerId, vehicleId, data) |
|
|
|
|
end |
|
|
|
|
function sampev.onTrailerSync(playerId, data) |
|
|
|
|
--lua_thread.create(luChecker.trailerSync, playerId, data) |
|
|
|
|
luChecker.trailerSync(playerId, data) |
|
|
|
|
end |
|
|
|
|
function sampev.onVehicleStreamOut(vehicleId) |
|
|
|
|
--lua_thread.create(luChecker.vehicleStream, false, vehicleId) |
|
|
|
|
luChecker.vehicleStream(false, vehicleId) |
|
|
|
|
end |
|
|
|
|
function sampev.onSendChat(message) |
|
|
|
@ -2198,7 +2196,6 @@ function loadEvents() |
|
|
|
|
antiflood = os.clock() * 1000 |
|
|
|
|
end |
|
|
|
|
function sampev.onVehicleStreamIn(vehicleId, data) |
|
|
|
|
--lua_thread.create(luChecker.vehicleStream, true, vehicleId, data) |
|
|
|
|
luChecker.vehicleStream(true, vehicleId, data) |
|
|
|
|
if inifiles ~= nil and not inifiles.Settings.Tuning and (data.type == 403 or data.type == 515) then |
|
|
|
|
data.modSlots[8] = 0 |
|
|
|
@ -3406,6 +3403,7 @@ function transponder() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
solo_antiflood_message = {} |
|
|
|
|
function transponder_solo_message(info) |
|
|
|
|
if info.solo_data ~= nil then |
|
|
|
|
for sender, solo_data in pairs(info.solo_data) do |
|
|
|
@ -3433,8 +3431,12 @@ function transponder_solo_message(info) |
|
|
|
|
end |
|
|
|
|
if not result_find then |
|
|
|
|
if texts_of_reports[solo_data["cargo"]] ~= nil then |
|
|
|
|
local text = string.format("[TruckHUD]: %s[%s] %s %s. Îòïðàâèë: %s", solo_data.name, solo_data.id, (solo_data.action == "load" and "çàãðóçèëñÿ íà" or "ðàçãðóçèë"), texts_of_reports[solo_data["cargo"]], sender) |
|
|
|
|
sampAddChatMessage(text,-1) |
|
|
|
|
local text1 = string.format("%s[%s] %s %s.", solo_data.name, solo_data.id, (solo_data.action == "load" and "çàãðóçèëñÿ íà" or "ðàçãðóçèë"), texts_of_reports[solo_data["cargo"]]) |
|
|
|
|
local text = string.format("%s Îòïðàâèë: %s", text1, sender) |
|
|
|
|
if solo_antiflood_message[text1] == nil or (os.time() - solo_antiflood_message[text1] > 3) then |
|
|
|
|
solo_antiflood_message[text1] = os.time() |
|
|
|
|
addChatMessage(text) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
solo_data_antiflood[sender][#solo_data_antiflood[sender]+1] = solo_data |
|
|
|
@ -3636,7 +3638,6 @@ function get_time() |
|
|
|
|
msk_timestamp = msk_timestamp + (os.time() - _time) |
|
|
|
|
_time = os.time() |
|
|
|
|
if inifiles.Settings.AutoClear then |
|
|
|
|
threads = {} |
|
|
|
|
collectgarbage("step") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -4058,7 +4059,8 @@ end |
|
|
|
|
|
|
|
|
|
function luChecker.vehicleStream(stream, vehicleId, data) |
|
|
|
|
if stream then |
|
|
|
|
luChecker.vehicles[vehicleId] = data |
|
|
|
|
luChecker.vehicles[vehicleId] = {} |
|
|
|
|
luChecker.vehicles[vehicleId]["type"] = data["type"] |
|
|
|
|
else |
|
|
|
|
local result, playerId, isTrailer = isVehicleTruckersDelete(luChecker.truckers, vehicleId) |
|
|
|
|
if result then |
|
|
|
@ -4081,7 +4083,8 @@ function luChecker.vehicleSync(playerId, vehicleId, data) |
|
|
|
|
if luChecker.vehicles[vehicleId] ~= nil and (luChecker.vehicles[vehicleId].type == 403 or luChecker.vehicles[vehicleId].type == 514 or luChecker.vehicles[vehicleId].type == 515) then |
|
|
|
|
if luChecker.truckers[playerId] == nil then |
|
|
|
|
luChecker.truckers[playerId] = {} |
|
|
|
|
luChecker.truckers[playerId]["data"] = data |
|
|
|
|
luChecker.truckers[playerId]["data"] = {} |
|
|
|
|
luChecker.truckers[playerId]["data"]["position"] = data["position"] |
|
|
|
|
luChecker.truckers[playerId]["vehicleId"] = vehicleId |
|
|
|
|
luChecker.truckers[playerId]["vehicleDataTime"] = os.time() |
|
|
|
|
luChecker.truckers[playerId]["trailerDataTime"] = 0 |
|
|
|
@ -4089,7 +4092,8 @@ function luChecker.vehicleSync(playerId, vehicleId, data) |
|
|
|
|
trailerId = -1 |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
luChecker.truckers[playerId]["data"] = data |
|
|
|
|
luChecker.truckers[playerId]["data"] = {} |
|
|
|
|
luChecker.truckers[playerId]["data"]["position"] = data["position"] |
|
|
|
|
luChecker.truckers[playerId]["vehicleId"] = vehicleId |
|
|
|
|
if os.time() - luChecker.truckers[playerId]["trailerDataTime"] > 5 and os.time() - luChecker.truckers[playerId]["vehicleDataTime"] < 5 and os.time() - live == 0 then |
|
|
|
|
luChecker.truckers[playerId]["trailerData"]["trailerId"] = -1 |
|
|
|
@ -4102,9 +4106,11 @@ end |
|
|
|
|
|
|
|
|
|
function luChecker.trailerSync(playerId, data) |
|
|
|
|
if not isPlayerHaveTruckHUD(playerId) and luChecker.truckers[playerId] ~= nil then |
|
|
|
|
luChecker.truckers[playerId]["trailerDataTime"] = os.time() |
|
|
|
|
luChecker.checkerLoad(playerId, data, luChecker.truckers[playerId]["data"]["position"]) |
|
|
|
|
luChecker.truckers[playerId]["trailerData"] = data |
|
|
|
|
if luChecker.vehicles[data["trailerId"]] ~= nil then |
|
|
|
|
luChecker.truckers[playerId]["trailerDataTime"] = os.time() |
|
|
|
|
luChecker.checkerLoad(playerId, data, luChecker.truckers[playerId]["data"]["position"]) |
|
|
|
|
luChecker.truckers[playerId]["trailerData"]["trailerId"] = data["trailerId"] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -4170,6 +4176,7 @@ 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] |
|
|
|
|