|
|
@ -200,6 +200,7 @@ function main() |
|
|
|
lua_thread.create(transponder) |
|
|
|
lua_thread.create(transponder) |
|
|
|
lua_thread.create(fastmap) |
|
|
|
lua_thread.create(fastmap) |
|
|
|
lua_thread.create(renderTruckers) |
|
|
|
lua_thread.create(renderTruckers) |
|
|
|
|
|
|
|
lua_thread.create(luChecker.checker) |
|
|
|
repeat |
|
|
|
repeat |
|
|
|
wait(0) |
|
|
|
wait(0) |
|
|
|
until msk_timestamp ~= 0 |
|
|
|
until msk_timestamp ~= 0 |
|
|
@ -2681,7 +2682,7 @@ function loadEvents() |
|
|
|
if text:find("Ïîðò") then |
|
|
|
if text:find("Ïîðò") then |
|
|
|
unload_location = true |
|
|
|
unload_location = true |
|
|
|
local cargoN, cargoY, cargoL = string.match(text, v) |
|
|
|
local cargoN, cargoY, cargoL = string.match(text, v) |
|
|
|
luChecker.set3Dtext("Ïîðò", {prices_3dtext[k .. "n"], prices_3dtext[k .. "y"], prices_3dtext[k .. "l"]}, {cargoN, cargoY, cargoL}) |
|
|
|
luChecker.set3Dtext("Ïîðò", {prices_3dtext[k .. "n"], prices_3dtext[k .. "y"], prices_3dtext[k .. "l"]}, {cargoN, cargoY, cargoL}, position) |
|
|
|
prices_3dtext[k .. "n"], prices_3dtext[k .. "y"], prices_3dtext[k .. "l"] = cargoN, cargoY, cargoL |
|
|
|
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_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 |
|
|
|
prices_3dtext_pos[k .. "n"], prices_3dtext_pos[k .. "y"], prices_3dtext_pos[k .. "l"] = position, position, position |
|
|
@ -2730,7 +2731,7 @@ function loadEvents() |
|
|
|
) |
|
|
|
) |
|
|
|
else |
|
|
|
else |
|
|
|
local cargo_save = string.match(text, v) |
|
|
|
local cargo_save = string.match(text, v) |
|
|
|
luChecker.set3Dtext("Ñêëàä", {prices_3dtext[k], k}, {cargo_save, k}) |
|
|
|
luChecker.set3Dtext("Ñêëàä", {prices_3dtext[k], k}, {cargo_save, k}, position) |
|
|
|
prices_3dtext[k] = cargo_save |
|
|
|
prices_3dtext[k] = cargo_save |
|
|
|
prices_3dtext_id[k] = id |
|
|
|
prices_3dtext_id[k] = id |
|
|
|
prices_3dtext_pos[k] = position |
|
|
|
prices_3dtext_pos[k] = position |
|
|
@ -2758,6 +2759,7 @@ function loadEvents() |
|
|
|
unload_location = false |
|
|
|
unload_location = false |
|
|
|
current_warehouse = "none" |
|
|
|
current_warehouse = "none" |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
say("remove 3d text "..Cid) |
|
|
|
local result, key = isTruck3dTextDefined(Cid) |
|
|
|
local result, key = isTruck3dTextDefined(Cid) |
|
|
|
if result then |
|
|
|
if result then |
|
|
|
for i = 1, #key do |
|
|
|
for i = 1, #key do |
|
|
@ -2777,7 +2779,6 @@ function isTruck3dTextDefined(id) |
|
|
|
local x, y, z = getCharCoordinates(PLAYER_PED) |
|
|
|
local x, y, z = getCharCoordinates(PLAYER_PED) |
|
|
|
for k,v in pairs(prices_3dtext_id) do |
|
|
|
for k,v in pairs(prices_3dtext_id) do |
|
|
|
local dist = getDistanceBetweenCoords3d(x, y, z, prices_3dtext_pos[k].x, prices_3dtext_pos[k].y, prices_3dtext_pos[k].z) |
|
|
|
local dist = getDistanceBetweenCoords3d(x, y, z, prices_3dtext_pos[k].x, prices_3dtext_pos[k].y, prices_3dtext_pos[k].z) |
|
|
|
say(dist) |
|
|
|
|
|
|
|
if id == v and v ~= -1 and dist > 20 then |
|
|
|
if id == v and v ~= -1 and dist > 20 then |
|
|
|
result = true |
|
|
|
result = true |
|
|
|
say(k) |
|
|
|
say(k) |
|
|
@ -4025,8 +4026,6 @@ function isVehicleTruckersDelete(table, vehicleId) |
|
|
|
local isTrailer = false |
|
|
|
local isTrailer = false |
|
|
|
for k,v in pairs(table) do |
|
|
|
for k,v in pairs(table) do |
|
|
|
if v["trailerData"] ~= nil and v["trailerData"].trailerId == vehicleId then |
|
|
|
if v["trailerData"] ~= nil and v["trailerData"].trailerId == vehicleId then |
|
|
|
say(v["trailerData"].trailerId) |
|
|
|
|
|
|
|
say("òðåéëåð óäàëåí") |
|
|
|
|
|
|
|
result = true |
|
|
|
result = true |
|
|
|
playerId = k |
|
|
|
playerId = k |
|
|
|
isTrailer = true |
|
|
|
isTrailer = true |
|
|
@ -4048,11 +4047,14 @@ function luChecker.vehicleStream(stream, vehicleId, data) |
|
|
|
local result, playerId, isTrailer = isVehicleTruckersDelete(luChecker.truckers, vehicleId) |
|
|
|
local result, playerId, isTrailer = isVehicleTruckersDelete(luChecker.truckers, vehicleId) |
|
|
|
if result then |
|
|
|
if result then |
|
|
|
if isTrailer then |
|
|
|
if isTrailer then |
|
|
|
say("Òðåéëåð èãðîêà óäàëåí") |
|
|
|
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 |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
say("Ìàøèíà èãðîêà óäàëåíà") |
|
|
|
luChecker.truckers[playerId] = nil |
|
|
|
end |
|
|
|
end |
|
|
|
luChecker.truckers[playerId] = nil |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
luChecker.vehicles[vehicleId] = nil |
|
|
|
luChecker.vehicles[vehicleId] = nil |
|
|
|
end |
|
|
|
end |
|
|
@ -4082,14 +4084,14 @@ function luChecker.trailerSync(playerId, data) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function luChecker.set3Dtext(type, data_old, data) |
|
|
|
function luChecker.set3Dtext(type, data_old, data, position) |
|
|
|
inifiles.Settings.luCheckerCargo = 1 |
|
|
|
inifiles.Settings.luCheckerCargo = 1 |
|
|
|
if type == "Ïîðò" then |
|
|
|
if type == "Ïîðò" then |
|
|
|
local key = inifiles.Settings.luCheckerCargo |
|
|
|
local key = inifiles.Settings.luCheckerCargo |
|
|
|
say(string.format("%s %s", data_old[key], data[key])) |
|
|
|
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]) ~= 0 and not (tonumber(data_old[key]) == tonumber(data[1])) then |
|
|
|
if tonumber(data_old[key]) > tonumber(data[key]) 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 } |
|
|
|
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 } |
|
|
|
say("Ðàçãðóçêà â ïîðòó ðÿäîì "..inifiles.Settings.luCheckerCargo) |
|
|
|
say("Ðàçãðóçêà â ïîðòó ðÿäîì "..inifiles.Settings.luCheckerCargo) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -4098,13 +4100,51 @@ function luChecker.set3Dtext(type, data_old, data) |
|
|
|
local cargoId = (cargoName:find("n") and 1 or (cargoName:find("y") and 2 or (cargoName:find("l") and 3 or 0))) |
|
|
|
local cargoId = (cargoName:find("n") and 1 or (cargoName:find("y") and 2 or (cargoName:find("l") and 3 or 0))) |
|
|
|
if cargoId == inifiles.Settings.luCheckerCargo and tonumber(data_old[1]) ~= 0 and not (tonumber(data_old[1]) == tonumber(data[1])) then |
|
|
|
if cargoId == inifiles.Settings.luCheckerCargo and tonumber(data_old[1]) ~= 0 and not (tonumber(data_old[1]) == tonumber(data[1])) then |
|
|
|
if tonumber(data_old[1]) < tonumber(data[1]) then |
|
|
|
if tonumber(data_old[1]) < tonumber(data[1]) then |
|
|
|
luChecker.price_set[#luChecker.price_set + 1] = { type = "load", old_price = tonumber(data_old[key]), new_price = tonumber(data[key]), time = os.clock() * 1000 } |
|
|
|
luChecker.price_set[#luChecker.price_set + 1] = { type = "load", old_price = tonumber(data_old[key]), new_price = tonumber(data[key]), time = os.clock() * 1000, position = position } |
|
|
|
say("Çàãðóçêà íà ñêëàäå ðÿäîì "..inifiles.Settings.luCheckerCargo) |
|
|
|
say("Çàãðóçêà íà ñêëàäå ðÿäîì "..inifiles.Settings.luCheckerCargo) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function luChecker.checker() |
|
|
|
|
|
|
|
while true do |
|
|
|
|
|
|
|
wait(0) |
|
|
|
|
|
|
|
clear_old_value("price_set") |
|
|
|
|
|
|
|
clear_old_value("trailer_delete") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if luChecker.price_set[1] ~= nil and luChecker.trailer_delete[1] ~= nil then |
|
|
|
|
|
|
|
playerId = luChecker.trailer_delete[1].playerId |
|
|
|
|
|
|
|
type = luChecker.price_set[1].type |
|
|
|
|
|
|
|
old_price = luChecker.price_set[1].old_price |
|
|
|
|
|
|
|
new_price = luChecker.price_set[1].new_price |
|
|
|
|
|
|
|
position_3dtext = luChecker.price_set[1].position |
|
|
|
|
|
|
|
position_trailer = luChecker.trailer_delete[1].position |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local dist = getDistanceBetweenCoords3d(position_3dtext.x,position_3dtext.y,position_3dtext.z,position_trailer.x,position_trailer.y,position_trailer.z) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local text = string.format("èãðîê %s %s %s %s", playerId, (type == "load" and "çàãðóçèë" or "ðàçãðóçèë"), inifiles.Settings.luCheckerCargo, dist ) |
|
|
|
|
|
|
|
say(">> "..text) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table.remove(luChecker.trailer_delete, 1) |
|
|
|
|
|
|
|
table.remove(luChecker.price_set, 1) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function clear_old_value(key) |
|
|
|
|
|
|
|
local delete = {} |
|
|
|
|
|
|
|
for i = 1, #luChecker[key] do |
|
|
|
|
|
|
|
if os.clock() * 1000 - luChecker[key][i].time > 3000 then |
|
|
|
|
|
|
|
delete[#delete+1] = i |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
for i = 1, #delete do |
|
|
|
|
|
|
|
say("remove "..key.." "..i) |
|
|
|
|
|
|
|
table.remove(luChecker[key], delete[i]) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- luCheckerCargo |
|
|
|
--- luCheckerCargo |
|
|
|
--[[ |
|
|
|
--[[ |
|
|
|