From 0cd85aeff8092f0af927a5f10685485485c8388b Mon Sep 17 00:00:00 2001 From: rubin Date: Tue, 13 Dec 2022 20:41:37 +0300 Subject: [PATCH] fix cargo load message & fix select cargo --- TruckHUD.lua | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/TruckHUD.lua b/TruckHUD.lua index 26f77f3..1b8b438 100644 --- a/TruckHUD.lua +++ b/TruckHUD.lua @@ -3533,7 +3533,7 @@ function transponder_solo_message(info) counter = counter + 1 end end - if counter == 4 and solo_data["time"] - solo_data_antiflood[sender][i]["time"] < 10 then + if counter == 4 and os.time() - solo_data_antiflood[sender][i]["antiflood"] < 10 then result_find = true break end @@ -3545,6 +3545,7 @@ function transponder_solo_message(info) end end solo_data_antiflood[sender][#solo_data_antiflood[sender]+1] = solo_data + solo_data_antiflood[sender][#solo_data_antiflood[sender]]["antiflood"] = os.time() end end end @@ -4215,29 +4216,24 @@ function luChecker.checkerLoad(playerId, data, position) -- if luChecker.truckers[playerId]["trailerData"]["trailerId"] ~= data["trailerId"] then 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) + 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) - 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) - - if dist_localPlayer_storage <= 120.0 and dist_trucker_storage <= 50.0 then - if key == "ls" or key == "sf" then - if inifiles.Settings.luCheckerCargo >= 1 and inifiles.Settings.luCheckerCargo <= 3 then - key = key..cargo_replace[inifiles.Settings.luCheckerCargo] - end + if dist_localPlayer_storage <= 120.0 and dist_trucker_storage <= 50.0 then + solo_message_send = { + name = getNameById(playerId), + id = playerId, + action = "load", + cargo = key, + time = os.time() + } + sampAddChatMessage("игрок получил груз "..playerId.." "..dist_localPlayer_storage.." "..dist_trucker_storage.." +++ "..luChecker.truckers[playerId]["trailerData"]["trailerId"].." ++++ "..data["trailerId"],-1) end - solo_message_send = { - name = getNameById(playerId), - id = playerId, - action = "load", - cargo = key, - time = os.time() - } - sampAddChatMessage("игрок получил груз "..playerId.." "..dist_localPlayer_storage.." "..dist_trucker_storage.." +++ "..luChecker.truckers[playerId]["trailerData"]["trailerId"].." ++++ "..data["trailerId"],-1) end end end