|
|
|
@ -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,26 +3526,32 @@ function transponder_solo_message(info) |
|
|
|
|
end |
|
|
|
|
local result_find = false -- Îòêëîíèòü ïîêàç ñîîáùåíèÿ |
|
|
|
|
local check_label = { "id", "name", "action", "cargo" } |
|
|
|
|
for i = 1, #solo_data_antiflood[sender] do -- Ïîèñê äóáëèêàòà |
|
|
|
|
local counter = 0 |
|
|
|
|
for s = 1, #check_label do |
|
|
|
|
if solo_data[s] == solo_data_antiflood[sender][i][s] then |
|
|
|
|
counter = counter + 1 |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
if solo_data[s] == solo_data_antiflood[sender][i][s] then |
|
|
|
|
counter = counter + 1 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if counter == 4 and os.time() - solo_data_antiflood[sender][i]["antiflood"] < 10 then |
|
|
|
|
result_find = true |
|
|
|
|
break |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if counter == 4 and os.time() - solo_data_antiflood[sender][i]["antiflood"] < 10 then |
|
|
|
|
result_find = true |
|
|
|
|
break |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if not result_find then |
|
|
|
|
if texts_of_reports[solo_data["cargo"]] ~= nil then |
|
|
|
|
local text = string.format("[TruckHUD]: %s[%s] %s %s", solo_data.name, solo_data.id, (solo_data.action == "load" and "çàãðóçèëñÿ íà" or "ðàçãðóçèë"), texts_of_reports[solo_data["cargo"]]) |
|
|
|
|
sampAddChatMessage(text,-1) |
|
|
|
|
if not result_find then |
|
|
|
|
if texts_of_reports[solo_data["cargo"]] ~= nil then |
|
|
|
|
local text = string.format("[TruckHUD]: %s[%s] %s %s", solo_data.name, solo_data.id, (solo_data.action == "load" and "çàãðóçèëñÿ íà" or "ðàçãðóçèë"), texts_of_reports[solo_data["cargo"]]) |
|
|
|
|
sampAddChatMessage(text,-1) |
|
|
|
|
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 |
|
|
|
|
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 |
|
|
|
@ -4219,43 +4225,41 @@ 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) |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
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 |
|
|
|
|
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 |
|
|
|
|
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 |
|
|
|
|
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) |
|
|
|
|
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, 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 |
|
|
|
|