Installation & Configuration & Integration

Install

Login to your keymaster account, check Granted Assets section and download script you bought from us

IMPORTANT

Replace your baseevents script with this one

Script Start Order

ensure baseevents # Install this one from https://github.com/lesimov/baseevents
ensure es_extended
ensure dusa_vehiclekeys
ensure dusa_lockpick

Set Framework

Config.Framework = "esx" -- esx / oldesx
Config.CustomFramework = true
function CustomFrameworkExport() -- Add the export here, as in the following example.
    ESX = exports["es_extended"]:getSharedObject()
end

Config.PlayerLoadedExport = 'esx:playerLoaded'

Dispatch Integration

We leave default dispatch for you, but if you want to use your own dispatch just use your trigger code below -- exports['ps-dispatch']:VehicleTheft(vehicle) code

If you using ps-dispatch just remove -- at the start of code

--- @param -- For customized dispatch, edit  AlertPolice function below here.
function AlertPolice(type, vehicle)
    if not AlertSend then
        local chance = Config.PoliceAlertChance
        if GetClockHours() >= 1 and GetClockHours() <= 6 then
            chance = Config.PoliceNightAlertChance
        end
        if math.random() <= chance then
            -- Integrate your own dispatch script here
            -- exports['ps-dispatch']:VehicleTheft(vehicle)
            
            -- Default
            TriggerServerEvent('dusa_vehiclekeys:server:policeAlert', Config.Language['info']["palert"] .. type)
        end
        AlertSend = true
        SetTimeout(Config.AlertCooldown, function()
            AlertSend = false
        end)
    end
end

Translation

You can edit these lines for all translations

----------------------------------------------------------------
----                       TRANSLATION                      ----
----------------------------------------------------------------
Config.Language = {
    ['notify'] = {
        ydhk = 'You don\'t have keys to this vehicle.',
        nonear = 'There is nobody nearby to hand keys to',
        vlock = 'Vehicle locked!',
        vunlock = 'Vehicle unlocked!',
        vlockpick = 'You managed to pick the door lock open!',
        fvlockpick = 'You fail to find the keys and get frustrated.',
        vgkeys = 'You hand over the keys.',
        vgetkeys = 'You get keys to the vehicle!',
        fpid = 'Fill out the player ID and Plate arguments',
        cjackfail = 'Carjacking failed!',
        vehclose = 'There\'s no close vehicle!',
        alertowner = 'Leave my car you idiot!',
        removedkey = 'Key removed successfully!',
    },
    ['progress'] = {
        takekeys = 'Taking keys from body...',
        hskeys = 'Searching for the car keys...',
        acjack = 'Attempting Carjacking...',
        stelingkeys = 'Stealing Keys..',
        hotwiring = 'Hotwiring..',
    },
    ['info'] = {
        skeys = '[H] - Hotwire',
        tlock = 'Toggle Vehicle Locks',
        palert = 'Vehicle theft in progress. Type: ',
        engine = 'Toggle Engine',
    },
    ['addcom'] = {
        givekeys = 'Hand over the keys to someone. If no ID, gives to closest person or everyone in the vehicle.',
        givekeys_id = 'id',
        givekeys_id_help = 'Player ID',
        addkeys = 'Adds keys to a vehicle for someone.',
        addkeys_id = 'id',
        addkeys_id_help = 'Player ID',
        addkeys_plate = 'plate',
        addkeys_plate_help = 'Plate',
        rkeys = 'Remove keys to a vehicle for someone.',
        rkeys_id = 'id',
        rkeys_id_help = 'Player ID',
        rkeys_plate = 'plate',
        rkeys_plate_help = 'Plate',
    }
}

Default Integration (Suggested)

Send vehicle plate in the parameter

exports['dusa_vehiclekeys']:IntegrateKey(plate) 

Dynamic Integration

It will automatically get closest vehicle or the vehicle ped is using. If you trying to integrate key for not spawned vehicle, this integration may be cause some issues

exports['dusa_vehiclekeys']:IntegrateDynamically()

Add Key

Give specified plate key for player

exports['dusa_vehiclekeys']:AddKey(plate)

Remove Key

Remove specified plate key from player

exports['dusa_vehiclekeys']:RemoveKey(plate)

Has Keys

Check if player has the key of defined plate

exports['dusa_vehiclekeys']:HasKeys(plate)

Last updated