Exports & API

legends_driveby provides a client-side export for checking if a player is currently in drive-by mode.

Client Exports

IsInDriveBy

Check if the local player is currently in drive-by mode.

exports['legends_driveby']:IsInDriveBy()

Parameters: None

Returns: boolean

  • true - Player is currently in drive-by mode
  • false - Player is not in drive-by mode

Example Usage:

-- Check before allowing an action
if exports['legends_driveby']:IsInDriveBy() then
    -- Player is in drive-by mode
    print("Cannot perform this action while in drive-by mode")
    return
end
 
-- Conditional logic based on drive-by state
CreateThread(function()
    while true do
        Wait(1000)
        if exports['legends_driveby']:IsInDriveBy() then
            -- Do something while player is in drive-by mode
            -- For example: show a UI element, play a sound, etc.
        end
    end
end)

Integration Examples

Disable Other Features During Drive-by

-- In your other resource
local function canUseFeature()
    -- Check if legends_driveby is running
    if GetResourceState('legends_driveby') == 'started' then
        if exports['legends_driveby']:IsInDriveBy() then
            return false
        end
    end
    return true
end

Custom HUD Integration

-- Show a drive-by indicator on your HUD
CreateThread(function()
    while true do
        Wait(500)
        local inDriveBy = false
 
        if GetResourceState('legends_driveby') == 'started' then
            inDriveBy = exports['legends_driveby']:IsInDriveBy()
        end
 
        -- Send to your HUD/NUI
        SendNUIMessage({
            action = 'updateDriveByStatus',
            active = inDriveBy
        })
    end
end)

Police Alert Integration

-- Alert police when drive-by shooting starts
local wasInDriveBy = false
 
CreateThread(function()
    while true do
        Wait(1000)
        local inDriveBy = exports['legends_driveby']:IsInDriveBy()
 
        if inDriveBy and not wasInDriveBy then
            -- Player just entered drive-by mode
            TriggerServerEvent('police:alert', 'Drive-by shooting in progress')
        end
 
        wasInDriveBy = inDriveBy
    end
end)

Commands

/driveby

The main command to toggle drive-by mode. Registered with FiveM's keymapping system.

Default Keybind: G

Usage: Press the configured key while as a passenger in a vehicle.

/GetVehicleHash

Debug command to get the current vehicle's hash (only available when DebugCommand = true).

Usage: Type in chat while inside a vehicle. Check F8 console for output.

Need Help?

Join our Discord for support: discord.gg/lgnds (opens in a new tab)


Legends Store - Premium FiveM Scripts