Ramps/Trailers

Exports

Exports

Client exports for other scripts. Call them from a client file.

exports['suty-rampas']:GrabTrailer(trailer)         -- grab a trailer by the tongue
exports['suty-rampas']:IsCarryingTrailer()          -- the trailer in your hand, or nil
exports['suty-rampas']:CanHitchTrailer(truck)       -- true, or false + reason
exports['suty-rampas']:HitchTrailer(truck)
exports['suty-rampas']:DropTrailer()
exports['suty-rampas']:CanOpenTrailerGate(trailer)
exports['suty-rampas']:CanCloseTrailerGate(trailer)
exports['suty-rampas']:OpenTrailerGate(trailer)
exports['suty-rampas']:CloseTrailerGate(trailer)
Export Returns
GrabTrailer(trailer) true when it started, or false, reason
IsCarryingTrailer() The trailer entity, or nil
CanHitchTrailer(truck) true, or false, reason
HitchTrailer(truck) true when it started, or false, reason
DropTrailer() true when it started, or false, reason
CanOpenTrailerGate(trailer), CanCloseTrailerGate(trailer) true, or false, reason
OpenTrailerGate(trailer), CloseTrailerGate(trailer) true when it started, or false, reason

The reason is a text in Spanish, ready to show to the player.

Arguments you can leave out

Argument Without it
trailer in GrabTrailer The nearest loose trailer within carry.grabDistance (8 m)
trailer in the gate exports The nearest trailer within gateAnim.distance (6 m)
truck in CanHitchTrailer and HitchTrailer The nearest parked vehicle with a free ball within carry.hitchDistance (3 m) of the coupler

Example

local carrying = exports['suty-rampas']:IsCarryingTrailer()
if carrying then
    local ok, reason = exports['suty-rampas']:HitchTrailer(truck)
    if not ok then
        lib.notify({ description = reason, type = 'error' })
    end
end

Item exports

ox_inventory calls these from the item entries (Installation). You don't need to call them yourself.

Export Item
suty-rampas.useKit suty_ramp_kit
suty-rampas.useTrailer suty_trailer_5x8, suty_trailer_7x16, suty_trailer_jetski

Merry Christmas.

From Suty.