fix trailer search

test-utf-8
rubin 2 years ago
parent 0e32990d75
commit ae4443a9af
  1. 26
      TruckHUD.lua

@ -2761,7 +2761,8 @@ function loadEvents()
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
prices_3dtext_id[key[i]] = -1 --prices_3dtext_id[key[i]] = -1
prices_3dtext_id[key[i]] = nil
prices_3dtext[key[i]] = 0 prices_3dtext[key[i]] = 0
say("Óäàëåíî "..key[i]) say("Óäàëåíî "..key[i])
@ -3994,7 +3995,8 @@ end
luChecker = { luChecker = {
vehicles = {}, vehicles = {},
truckers = {}, -- Èãðîêè íå â ñêðèïòå truckers = {}, -- Èãðîêè íå â ñêðèïòå
event = {} price_set = {},
trailer_delete = {}
} }
--[[ --[[
@ -4023,6 +4025,8 @@ 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
@ -4057,18 +4061,22 @@ end
function luChecker.vehicleSync(playerId, vehicleId, data) function luChecker.vehicleSync(playerId, vehicleId, data)
if luChecker.vehicles[vehicleId] ~= nil and not isPlayerHaveTruckHUD(playerId) then if luChecker.vehicles[vehicleId] ~= nil and not isPlayerHaveTruckHUD(playerId) then
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.vehicles[vehicleId] ~= nil and (luChecker.vehicles[vehicleId].type == 403 or luChecker.vehicles[vehicleId].type == 514 or luChecker.vehicles[vehicleId].type == 515) then
luChecker.truckers[playerId] = data if luChecker.truckers[playerId] == nil then
luChecker.truckers[playerId]["vehicleId"] = vehicleId luChecker.truckers[playerId] = {}
if luChecker.truckers[playerId]["trailerData"] == nil then luChecker.truckers[playerId]["data"] = data
luChecker.truckers[playerId]["vehicleId"] = vehicleId
luChecker.truckers[playerId]["trailerData"] = { luChecker.truckers[playerId]["trailerData"] = {
trailerId = -1 trailerId = -1
} }
else
luChecker.truckers[playerId]["data"] = data
luChecker.truckers[playerId]["vehicleId"] = vehicleId
end end
end end
end end
end end
function luChecker.trailerSync(playerId, data_old, data) function luChecker.trailerSync(playerId, data)
if not isPlayerHaveTruckHUD(playerId) and luChecker.truckers[playerId] ~= nil then if not isPlayerHaveTruckHUD(playerId) and luChecker.truckers[playerId] ~= nil then
luChecker.truckers[playerId]["trailerData"] = data luChecker.truckers[playerId]["trailerData"] = data
end end
@ -4081,9 +4089,8 @@ function luChecker.set3Dtext(type, data_old, data)
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 }
say("Ðàçãðóçêà â ïîðòó ðÿäîì "..inifiles.Settings.luCheckerCargo) say("Ðàçãðóçêà â ïîðòó ðÿäîì "..inifiles.Settings.luCheckerCargo)
else
say("â äðóãîì ïîðòó êòî òî ðàçãðóçèëñÿ "..inifiles.Settings.luCheckerCargo)
end end
end end
elseif type == "Ñêëàä" then elseif type == "Ñêëàä" then
@ -4091,9 +4098,8 @@ 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 }
say("Çàãðóçêà íà ñêëàäå ðÿäîì "..inifiles.Settings.luCheckerCargo) say("Çàãðóçêà íà ñêëàäå ðÿäîì "..inifiles.Settings.luCheckerCargo)
else
say("íà äðóãîì ñêëàäå êòî òî çàêóïèëñÿ "..inifiles.Settings.luCheckerCargo)
end end
end end
end end

Loading…
Cancel
Save