fix send/receive cargo

test-utf-8
rubin 2 years ago
parent f295bcebcc
commit 5a320dc985
  1. 30
      TruckHUD.lua

@ -2801,7 +2801,7 @@ function loadEvents()
unload_location = false
current_warehouse = "none"
end
say("remove 3d text "..Cid)
--say("remove 3d text "..Cid)
local result, key = isTruck3dTextDefined(Cid)
if result then
for i = 1, #key do
@ -3526,6 +3526,10 @@ function transponder_solo_message(info)
end
local result_find = false -- Îòêëîíèòü ïîêàç ñîîáùåíèÿ
local check_label = { "id", "name", "action", "cargo" }
local cargo_symbol = (inifiles.Settings.luCheckerCargo == 1 and "n" or (inifiles.Settings.luCheckerCargo == 2 and "y" or (inifiles.Settings.luCheckerCargo == 3 and "l" or "")))
if cargo_symbol ~= "" then
if solo_data["cargo"]:find(cargo_symbol) then
for i = 1, #solo_data_antiflood[sender] do -- Ïîèñê äóáëèêàòà
local counter = 0
for s = 1, #check_label do
@ -3549,6 +3553,8 @@ function transponder_solo_message(info)
end
end
end
end
end
end
@ -4219,7 +4225,6 @@ function luChecker.checkerLoad(playerId, data, position) --
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)
local cargoNow = (key:find("n") and 1 or (key:find("y") and 2 or (key:find("l") and 3 or 0)))
if cargoNow == inifiles.Settings.luCheckerCargo and inifiles.Settings.luCheckerCargo ~= 0 then
local local_x, local_y, local_z = getCharCoordinates(PLAYER_PED)
local dist_localPlayer_storage = getDistanceBetweenCoords3d(local_x, local_y, local_z, x, y, z)
local dist_trucker_storage = getDistanceBetweenCoords3d(trucker_x, trucker_y, trucker_z, x, y, z)
@ -4236,26 +4241,25 @@ function luChecker.checkerLoad(playerId, data, position) --
end
end
end
end
end
function luChecker.set3Dtext(type, data_old, data, position)
if inifiles.Settings.luCheckerCargo == 0 then return end
if type == "Ïîðò" then
local key = inifiles.Settings.luCheckerCargo
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 }
say("Ðàçãðóçêà â ïîðòó ðÿäîì "..inifiles.Settings.luCheckerCargo)
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
elseif type == "Ñêëàä" then
local cargoName = data[2]
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 then
if cargoId ~= 0 then
luChecker.load_position = { x = position.x, y = position.y, z = position.z }
sampAddChatMessage("ïîðò ïîðò ïîðò "..tonumber(data[1]), -1)
sampAddChatMessage("ñêëàä ñêëàä ñêëàä "..tonumber(data[1]), -1)
end
end
end
@ -4266,7 +4270,7 @@ function luChecker.checker()
clear_old_value("price_set")
clear_old_value("trailer_delete")
if luChecker.price_set[1] ~= nil and luChecker.trailer_delete[1] ~= nil and inifiles.Settings.luCheckerCargo ~= 0 then
if luChecker.price_set[1] ~= nil and luChecker.trailer_delete[1] ~= nil then
playerId = luChecker.trailer_delete[1].playerId
old_price = luChecker.price_set[1].old_price
new_price = luChecker.price_set[1].new_price
@ -4277,9 +4281,7 @@ function luChecker.checker()
local dist = getDistanceBetweenCoords3d(position_3dtext.x,position_3dtext.y,position_3dtext.z,position_trailer.x,position_trailer.y,position_trailer.z)
if dist < 50 then
local key = getPort(position_trailer.x,position_trailer.y,position_trailer.z)
if inifiles.Settings.luCheckerCargo >= 1 and inifiles.Settings.luCheckerCargo <= 3 then
key = key..cargo_replace[inifiles.Settings.luCheckerCargo]
end
key = key..cargo_replace[luChecker.price_set[1].key]
solo_message_send = {
name = getNameById(playerId),
id = playerId,
@ -4287,7 +4289,7 @@ 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 "ðàçãðóçèë"), inifiles.Settings.luCheckerCargo, dist )
local text = string.format("èãðîê %s %s %s %s", playerId, (luChecker.price_set[1].type == "load" and "çàãðóçèë" or "ðàçãðóçèë"), key, dist )
say(">> "..text)
end
end

Loading…
Cancel
Save