1
0
Fork 0
forked from Simnation/Main
Main/resources/[carscripts]/AdvancedParking/fixFreezeEntity.lua
2025-08-07 14:38:30 +02:00

20 lines
722 B
Lua

local AP_RESOURCE_NAME <const> = "AdvancedParking"
if (GetCurrentResourceName() == AP_RESOURCE_NAME) then return end
local IS_CLIENT <const> = not IsDuplicityVersion()
local AP <const> = exports[AP_RESOURCE_NAME]
-- replaces FreezeEntityPosition native on client and server side
local original_FreezeEntityPosition <const> = FreezeEntityPosition
FreezeEntityPosition = function(entity, freeze)
if (not DoesEntityExist(entity)) then return end
if (GetEntityType(entity) ~= 2 or (IS_CLIENT and not NetworkGetEntityIsNetworked(entity)) or GetResourceState(AP_RESOURCE_NAME) ~= "started" or not AP.FreezeVehicle) then
original_FreezeEntityPosition(entity, freeze)
return
end
AP:FreezeVehicle(entity, freeze)
end