|
|
@ -2035,16 +2035,16 @@ end |
|
|
|
function loadEvents() |
|
|
|
function loadEvents() |
|
|
|
|
|
|
|
|
|
|
|
function sampev.onVehicleSync(vehicleId, data) |
|
|
|
function sampev.onVehicleSync(vehicleId, data) |
|
|
|
luChecker.vehicleSync(vehicleId, data) |
|
|
|
lua_thread.create(luChecker.vehicleSync, vehicleId, data) |
|
|
|
end |
|
|
|
end |
|
|
|
function sampev.onTrailerSync(playerId, data) |
|
|
|
function sampev.onTrailerSync(playerId, data) |
|
|
|
luChecker.trailerSync(playerId, data) |
|
|
|
lua_thread.create(luChecker.trailerSync, playerId, data) |
|
|
|
end |
|
|
|
end |
|
|
|
function sampev.onVehicleStreamIn(vehicleId, data) |
|
|
|
function sampev.onVehicleStreamIn(vehicleId, data) |
|
|
|
luChecker.vehicleStream(true, vehicleId, data) |
|
|
|
lua_thread.create(luChecker.vehicleStream, true, vehicleId, data) |
|
|
|
end |
|
|
|
end |
|
|
|
function sampev.onVehicleStreamOut(vehicleId) |
|
|
|
function sampev.onVehicleStreamOut(vehicleId) |
|
|
|
luChecker.vehicleStream(false, vehicleId) |
|
|
|
lua_thread.create(luChecker.vehicleStream, false, vehicleId) |
|
|
|
end |
|
|
|
end |
|
|
|
function sampev.onSendChat(message) |
|
|
|
function sampev.onSendChat(message) |
|
|
|
antiflood = os.clock() * 1000 |
|
|
|
antiflood = os.clock() * 1000 |
|
|
@ -3959,17 +3959,67 @@ end |
|
|
|
--> LOAD & UNLOAD CHECKER |
|
|
|
--> LOAD & UNLOAD CHECKER |
|
|
|
|
|
|
|
|
|
|
|
luChecker = { |
|
|
|
luChecker = { |
|
|
|
truckers = {} |
|
|
|
vehicles = {}, |
|
|
|
} |
|
|
|
truckers = {}, -- Èãðîêè íå â ñêðèïòå |
|
|
|
|
|
|
|
|
|
|
|
function luChecker.vehicleStream(stream, vehicleId, data) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isPlayerHaveTruckHUD(playerId) |
|
|
|
|
|
|
|
local result = false |
|
|
|
|
|
|
|
for k,v in pairs(base) do |
|
|
|
|
|
|
|
if v.id == playerId then |
|
|
|
|
|
|
|
result = true |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
return result |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function luChecker.vehicleSync(playerId, data) |
|
|
|
function isVehicleTruckersDelete(table, vehicleId) |
|
|
|
|
|
|
|
local result = false |
|
|
|
|
|
|
|
local playerId = -1 |
|
|
|
|
|
|
|
local isTrailer = false |
|
|
|
|
|
|
|
for k,v in pairs(table) do |
|
|
|
|
|
|
|
if v["trailerData"].vehicleId == vehicleId then |
|
|
|
|
|
|
|
result = true |
|
|
|
|
|
|
|
playerId = k |
|
|
|
|
|
|
|
isTrailer = true |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
if v.vehicleId == vehicleId then |
|
|
|
|
|
|
|
result = true |
|
|
|
|
|
|
|
playerId = k |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
return result, playerId, isTrailer |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function luChecker.vehicleStream(stream, vehicleId, data) |
|
|
|
|
|
|
|
if stream then |
|
|
|
|
|
|
|
luChecker.vehicles[vehicleId] = data |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
local result, playerId, isTrailer = isVehicleTruckersDelete(luChecker.truckers, vehicleId) |
|
|
|
|
|
|
|
if result then |
|
|
|
|
|
|
|
luChecker.truckers[playerId] = nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
luChecker.vehicles[vehicleId] = nil |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function luChecker.onVehicleSync(vehicleId, data) |
|
|
|
function luChecker.vehicleSync(vehicleId, data) |
|
|
|
|
|
|
|
if not isPlayerHaveTruckHUD(data.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 |
|
|
|
|
|
|
|
luChecker.truckers[data.playerId] = data |
|
|
|
|
|
|
|
luChecker.truckers[data.playerId]["trailerData"] = { |
|
|
|
|
|
|
|
trailerId = -1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function luChecker.trailerSync(playerId, data) |
|
|
|
|
|
|
|
if not isPlayerHaveTruckHUD(playerId) and luChecker.truckers[playerId] ~= nil then |
|
|
|
|
|
|
|
luChecker.truckers[playerId]["trailerData"] = data |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |