Как отключить коллизию?

хуега)

РП игрок
Автор темы
Модератор
2,571
2,277
Версия MoonLoader
.026-beta
Как отключить коллизию не используя setCharCollision(),setCarCollision(),setObjectCollision(), или как юзая эти фукнции, избежать баг с гравитацией?
 
Последнее редактирование:

UBP

Известный
332
172
setCarCollision, выключать не своей машине, а другим машинам в определенном радиусе

Lua:
local vehHandle = nil
vehHandle = getNearestVehicle(300)
if vehHandle ~= nil and currentVehicle == nil then
    setCarCollision(vehHandle, false)
    currentVehicle = vehHandle 
end
elseif currentVehicle ~= nil then
    if isVehicleExist(currentVehicle) then
        setCarCollision(currentVehicle, true)
        currentVehicle = nil
    end
end
function getNearestVehicle(radius)
    if not sampIsLocalPlayerSpawned() then return end
    local pVehicle = getLocalVehicle()
    local pCoords = {getCharCoordinates(PLAYER_PED)}
    local vehicles = getAllVehicles()
    table.sort(vehicles, function(a, b)
        local aX, aY, aZ = getCarCoordinates(a)
        local bX, bY, bZ = getCarCoordinates(b)
        return getDistanceBetweenCoords3d(aX, aY, aZ, unpack(pCoords)) < getDistanceBetweenCoords3d(bX, bY, bZ, unpack(pCoords))
    end)
    for i = #vehicles, 1, -1 do
        if vehicles[i] == pVehicle then
            table.remove(vehicles, i)
        elseif radius ~= nil then
            local x, y, z = getCarCoordinates(vehicles[i])
            if getDistanceBetweenCoords3d(x, y, z, unpack(pCoords)) > radius then
                table.remove(vehicles, i)
            end
        end
    end
    return vehicles[1]
end
 
  • Нравится
Реакции: хуега)