Exports & API
legends_raceessentials provides several client-side exports for dynamic control of its features.
Client Exports
toggleSlipstream
Enables or disables the slipstream system at runtime.
exports['legends_raceessentials']:toggleSlipstream(state)Parameters:
state(boolean):trueto enable,falseto disable
Example:
-- Disable slipstream for a specific event
exports['legends_raceessentials']:toggleSlipstream(false)
-- Re-enable slipstream
exports['legends_raceessentials']:toggleSlipstream(true)Use cases:
- Disable slipstream during certain race types
- Toggle for specific zones or events
- Admin commands to control feature state
setSlipstreamMultiplier
Dynamically changes the slipstream power boost multiplier.
exports['legends_raceessentials']:setSlipstreamMultiplier(multiplier)Parameters:
multiplier(number): Power boost multiplier (must be > 0)
Example:
-- Set to 50% boost
exports['legends_raceessentials']:setSlipstreamMultiplier(1.5)
-- Set to 100% boost (double power in draft)
exports['legends_raceessentials']:setSlipstreamMultiplier(2.0)
-- Disable boost (no advantage from drafting)
exports['legends_raceessentials']:setSlipstreamMultiplier(1.0)Use cases:
- Different multipliers for different race types
- Progressive boost during events
- Balance adjustments without server restart
toggleDoubleClutchBlock
Enables or disables the double clutching prevention.
exports['legends_raceessentials']:toggleDoubleClutchBlock(state)Parameters:
state(boolean):trueto enable blocking,falseto allow double clutching
Example:
-- Allow double clutching (for a specific event)
exports['legends_raceessentials']:toggleDoubleClutchBlock(false)
-- Re-enable blocking
exports['legends_raceessentials']:toggleDoubleClutchBlock(true)Use cases:
- Drag racing events where double clutching is allowed
- Testing/debugging vehicle physics
- Admin toggle for specific scenarios
Integration Examples
Race Event Integration
-- Start of special race event
local function StartDragRace()
-- Allow double clutching for drag races
exports['legends_raceessentials']:toggleDoubleClutchBlock(false)
-- Increase slipstream for excitement
exports['legends_raceessentials']:setSlipstreamMultiplier(2.0)
-- Notify players
TriggerEvent('chat:addMessage', {
args = {'RACE', 'Double clutching enabled! Slipstream boosted!'}
})
end
-- End of race event
local function EndDragRace()
-- Restore normal settings
exports['legends_raceessentials']:toggleDoubleClutchBlock(true)
exports['legends_raceessentials']:setSlipstreamMultiplier(1.5)
endZone-Based Slipstream
-- Disable slipstream in city zones
local inCityZone = false
CreateThread(function()
while true do
Wait(1000)
local coords = GetEntityCoords(PlayerPedId())
-- Check if in city zone (example coords)
local inZone = coords.x > -1000 and coords.x < 1000 and
coords.y > -1000 and coords.y < 1000
if inZone and not inCityZone then
inCityZone = true
exports['legends_raceessentials']:toggleSlipstream(false)
elseif not inZone and inCityZone then
inCityZone = false
exports['legends_raceessentials']:toggleSlipstream(true)
end
end
end)Admin Commands
-- Admin command to toggle double clutching
RegisterCommand('toggleclutch', function(source, args)
local state = args[1] == 'on'
exports['legends_raceessentials']:toggleDoubleClutchBlock(not state)
print('Double clutching ' .. (state and 'enabled' or 'blocked'))
end, false)
-- Admin command to set slipstream power
RegisterCommand('slippower', function(source, args)
local power = tonumber(args[1]) or 1.5
exports['legends_raceessentials']:setSlipstreamMultiplier(power)
print('Slipstream power set to ' .. power .. 'x')
end, false)Compatibility
This resource is standalone and compatible with:
- Any framework (QB-Core, ESX, QBX, standalone)
- Any vehicle modification resources
- Custom handling files
- ELS/vehicle lighting systems
Need Help?
Join our Discord for support: discord.gg/lgnds (opens in a new tab)