Documentation
  • Discord Server
  • About Us
  • Free Resources
    • Death Screen
      • PS-Dispatch Integration
    • Battlepass
      • Guides
      • Commands
        • Player Commands
        • Admin Commands
      • API
        • Server
    • Garages
      • Guides
        • Creating Interior
        • Creating Garage
        • How to find entity sets (customizations) for interior
  • Paid Resources
    • Elevator Creator V2
      • Installation
      • Accessible code
    • Radar System V2
      • Installation
      • Accessible code
    • Hotels Creator
      • Accessible code
    • Vehicle Shop Creator
      • Accessible code
    • Stocks Market
      • Accessible code
      • [DEV] - Usable Functions
    • Discord Voice Attendance
      • Installation
    • Deathmatch System
      • Installation
        • esx_ambulancejob
        • qb-ambulancejob
        • wasabi_ambulance
        • qbx_medical
        • codem-inventory
        • core_inventory
      • Accessible code
    • Object Creator
      • Dependencies
      • Accessible code
    • Cocaine Labs
      • Dependencies
      • Accessible code
    • Ownable Crafting Tables
      • Dependencies
      • Accessible code
      • Common Problems
    • Evidence System
      • Dependencies
      • Accessible code
      • Installation
      • API
    • Marketplace V2
      • Accessible code
      • Installation
      • Migration from V1
    • EMS Dispatch
      • Sending Dispatch
      • Accessing the Menu
      • Config File
    • Weed Planting
      • Accessible code
      • How to add new strain?
      • How to install
    • Advanced DarkNet System
      • Config
    • Advanced Taxi Job
      • Accessible code
      • Changelog
    • Advanced Gang Creator
      • Accessible code
      • Installation
        • QB Core
        • QBOX Core
      • API
      • FAQ
    • Advanced Private Cameras
      • ESX
        • Items
      • QBCore
        • Items
      • Accessible code
    • Advanced Elevator Creator
      • Accessible code
    • Advanced Ownable Rent Creator
      • SQL
      • ESX
      • QBCore
      • Config File
    • Advanced Job Creator
      • Installation
        • QB CORE
      • Accessible code
    • Advanced Ownable Shops
      • Installation
      • Accessible code
      • SQL
    • Advanced Ped Creator
      • SQL
      • Config File
    • Advanced Promocode Creator
      • Accessible code
      • SQL File
      • Common problems
    • Advanced Safe Zone Creator
      • Config File
    • Turf Wars
      • Ox Inventory
      • Accessible code
      • API
    • Advanced Gas Station Creator
      • Accessible code
    • Advanced Advertisements System
      • SQL File
      • Accessible code
    • Player Manager
      • Installation
      • Accessible code
    • Mechanic Job
      • Installation
      • Accessible code
      • SQL
    • Advanced Radar System
      • Accessible code
      • SQL
    • Crypto Mining
      • Installation
      • Accessible code
      • Items
      • SQL
    • Racing System
      • Accessible code
    • Car Theft
      • Accessible code
    • Advanced Solar Panels
      • Accessible Code
      • SQL
      • ESX
        • Items
      • QBCore
        • Items
    • Pilot Job
      • Accessible Code
      • ESX
        • SQL
      • QBCore
        • Metadata
        • qb-smallresources
      • QBOX
        • Metadata
    • Advanced Ownable Banks
      • Accessible Code
    • Post Office
      • Accessible Code
      • ESX
        • SQL
      • QBCore
        • SQL
      • Exports
    • Weather Sync
      • API
    • Billing System
      • Accessible code
      • SQL
      • Common problems
Powered by GitBook
On this page
  1. Paid Resources
  2. Car Theft

Accessible code

Config = {
    FrameworkName = IsESX() and 'es_extended' or 'qb-core',

    Locale = 'en',

    DebugZone = true, -- if you want to debug zones enable this, good when creating new garages so you can get how zones looks

    GangCreatorSupport = false,

    DeleteFromSQL = true, -- when sending vehicle in parts, do you want it also to be removed from sql (owned_vehicles or player_vehicles table)

    Target = 'ox_target', -- qb-target or qtarget

    Commands = {
        creator = {
            name = 'theftcreator',
            help = 'Command that helps you to create theft garage',
            restricted = 'group.admin'
        },
        delete = {
            name = 'deletetheft',
            help = 'Command that allows you to delete theft garages',
            restricted = 'group.admin'
        },
        deleteVehicle = {
            name = 'returnveh',
            help = 'Command that allows you to return vehicle to their owner',
            restricted = 'group.admin'
        },
        restore = {
            name = 'restore',
            help = 'Command that allows you to restore wanted vehicle to theft garage',
            restricted = 'group.admin'
        }
    },

    -- when you can send vehicle in parts, IN GAME CLOCK, if you dont want this put SellHours = false
    SellHours = {
        ['Mon'] = { 19, 5 }, -- from 19 to 05, MUST BE 24H FORMAT
        ['Tue'] = { 19, 5 },
        ['Wed'] = { 19, 5 },
        ['Thu'] = { 19, 5 },
        ['Fri'] = { 19, 5 },
        ['Sat'] = { 19, 5 },
        ['Sun'] = { 19, 5 },
    },

    -- vehicles that cant be stored in garage or sold
    BlackListed = {
        [`t20`] = true
    },

    -- If scipt can't find vehicles price in database then it will calculate it by their class, put down there prices that you want
    VehicleClassPrices = {
        -- These are vehicle classes
        [0] = 10000,  -- Compacts
        [1] = 10000,  -- Sedans
        [2] = 10000,  -- SUVs
        [3] = 10000,  -- Coupes
        [4] = 10000, -- Muscle
        [5] = 100000,  -- Sports Classics
        [6] = 100000, -- Sports
        [7] = 100000, -- Super
        [8] = 50000,  -- Motorcycles
        [9] = 50000,  -- Off-road
        [10] = 75000, -- Industrial
        [11] = 500, -- Utility
        [12] = 75000, -- Vans
        [13] = 100, -- Cylces
        [14] = 0, -- Boats
        [15] = 0, -- Helicopters
        [16] = 0, -- Planes
        [17] = 0, -- Service
        [18] = 0, -- Emergency
        [19] = 0, -- Military
        [20] = 10000, -- Commercial
        [21] = 0 -- Trains
    },
}

Discord = {

    url = '',  -- url here

    title = '',

    /*
        https://www.spycolor.com/

        ['default'] = 14423100,
        ['blue'] = 255,
        ['red'] = 16711680,
        ['green'] = 65280,
        ['white'] = 16777215,
        ['black'] = 0,
        ['orange'] = 16744192,
        ['yellow'] = 16776960,
        ['pink'] = 16761035,
        ['lightgreen'] = 65309,
    */

    color = 65309, -- green

    imageUrl = '', -- optional, if you dont want it put ''
}
-- msg: message that will be shown 
-- type: success and error
function Notify(msg, type)
    lib.notify({
        description = msg,
        type = type
    })
end

RegisterNetEvent('uniq_theft:Notify', Notify)

-- if in contex menu vehicle is shown as NULL NULL you need to fill up this text entry
Citizen.CreateThread(function()
    -- AddTextEntry('modelName', 'label')
    -- AddTextEntry('vehicleMakeName', 'label')

    -- Example: 
    -- AddTextEntry('gtr', "Skyline GTR '17") -- For the car name itself
    -- AddTextEntry('Nissan', 'Nissan') -- For the make name (in vehicles.meta -> <vehicleMakeName>)
end)

-- your export event for giving keys
function GiveCarKeys(plate)
    
end

-- if you use something else it must have Citizen.Await for code to wait for this response, also must return true or false
function MiniGame()
    -- https://overextended.dev/ox_lib/Modules/Interface/Client/skillcheck
    local success = lib.skillCheck({'medium'}, {'w', 'a', 's', 'd'})

    return success
end
local Query = {
    esx = {
        update = 'UPDATE `owned_vehicles` SET `owner` = ? WHERE `plate` = ?',
        select = 'SELECT `owner` FROM `owned_vehicles` WHERE `plate` = ?',
        delete = 'DELETE FROM `owned_vehicles` WHERE `plate` = ?'
    },

    qb = {
        update = 'UPDATE `player_vehicles` SET `citizenid` = ? WHERE `plate` = ?',
        select = 'SELECT `citizenid` FROM `player_vehicles` WHERE `plate` = ?',
        delete = 'DELETE FROM `player_vehicles` WHERE `plate` = ?'
    }
}

-- global, used also in server/main.lua
Vehicles = {}

-- this should get vehicle price from your shop, if you use something else add it here
if GetResourceState('esx_vehicleshop'):find('start') then
    local vehicles = MySQL.query.await('SELECT `name`, `price` FROM `vehicles`')

    if vehicles[1] then
        for i = 1, #vehicles do
            local data = vehicles[i]

            if data then
                Vehicles[joaat(data.name)] = data.price
            end
        end
    end
end

if IsQBCore() then
    for k,v in pairs(QBCore.Shared.Vehicles) do
        Vehicles[v.hash] = v.price
    end
end

if GetResourceState('okokVehicleShop'):find('start') then
    local vehicles = MySQL.query.await('SELECT `vehicle_id`, `min_price` FROM `okokvehicleshop_vehicles`')

    if vehicles[1] then
        for i = 1, #vehicles do
            local data = vehicles[i]

            if data then
                Vehicles[joaat(data.vehicle_id)] = data.min_price
            end
        end
    end
end

function ReturnToOwner(owner, plate)
    if IsESX() then
        MySQL.query(Query.esx.update, { owner, plate })
    elseif IsQBCore() then
        MySQL.query(Query.qb.update, { owner, plate })
    end
end

-- this is used when you are deleting theft garage and you want to return vehicles to their owners (ability to execute more queries at once)
function ReturnOwnerPrepare(parameters)
    if IsESX() then
        MySQL.prepare(Query.esx.update, parameters)
    elseif IsQBCore() then
        MySQL.prepare(Query.qb.update, parameters)
    end
end


function ReturnOwnerPrepareGang(parameters)
    MySQL.prepare('UPDATE `uniq_mafia_garage` SET `owner` = ? WHERE `plate` = ?', parameters)
end

function DeleteGang(plate)
    MySQL.query('DELETE FROM `uniq_mafia_garage` WHERE `plate` = ?', { plate })
end

function DeleteOwned(plate)
    if IsESX() then
        MySQL.query(Query.esx.delete, { plate })
    elseif IsQBCore() then
        MySQL.query(Query.qb.delete, { plate })
    end
end

lib.callback.register('uniq_theft:CheckOwner', function(source, name, plate)
    if IsESX() then
        if Garages[name].vehicles[plate] then
            return true, Garages[name].vehicles[plate].owner, Garages[name].vehicles[plate].gangVeh
        end

        local owner = MySQL.scalar.await(Query.esx.select, { plate })

        if owner then
            MySQL.update.await(Query.esx.update, { 'uniq_theft', plate })
            return true, owner, false
        end

        -- this checks if vehicle is owned by gang in our gang creator
        if GetResourceState('uniq-mafia'):find('start') then
            owner = MySQL.scalar.await('SELECT `owner` FROM `uniq_mafia_garage` WHERE `plate` = ?', { plate })

            if owner then
                MySQL.update.await('UPDATE `uniq_mafia_garage` SET `owner` = ? WHERE `plate` = ?', { 'uniq_theft', plate })
                return true, owner, true
            end
        end

        return false
    elseif IsQBCore() then
        if Garages[name].vehicles[plate] then
            return true, Garages[name].vehicles[plate].owner, Garages[name].vehicles[plate].gangVeh
        end

        local owner = MySQL.scalar.await(Query.qb.select, { plate })

        if owner then
            MySQL.update.await(Query.qb.update, { 'uniq_theft', plate })
            return true, owner, false
        end

        -- this checks if vehicle is owned by gang in our gang creator
        if GetResourceState('uniq-mafia'):find('start') then
            owner = MySQL.scalar.await('SELECT `owner` FROM `uniq_mafia_garage` WHERE `plate` = ?', { plate })

            if owner then
                MySQL.update.await('UPDATE `uniq_mafia_garage` SET `owner` = ? WHERE `plate` = ?', { 'uniq_theft', plate })
                return true, owner, true
            end
        end

        return false
    end
end)

lib.callback.register('uniq_theft:FindPrice', function(source, hash)
    if Vehicles[hash] then
        return Vehicles[hash]
    end

    return nil
end)

lib.callback.register('uniq_theft:GetJobs', function(source)
    local options = {}

    if IsESX() then
        for k,v in pairs(ESX.Jobs) do
            options[#options + 1] = { label = v.label, value = k }
        end
    elseif IsQBCore() then
        for k,v in pairs(QBCore.Shared.Jobs) do
            options[#options + 1] = { label = v.label, value = k }
        end
    end

    return options
end)

if IsQBCore() then
    lib.callback.register('uniq_theft:GetGangs', function(source)
        local options = {}

        for k,v in pairs(QBCore.Shared.Gangs) do
            options[#options + 1] = { label = v.label, value = k }
        end

        return options
    end)
end


function HasMoney(playerId, amount)
    if IsESX() then
        return ESX.GetPlayerFromId(playerId)?.getMoney() >= amount
    elseif IsQBCore() then
        return QBCore.Functions.GetPlayer(playerId)?.Functions.GetMoney('cash') >= amount
    end
end

function RemoveMoney(playerId, amount)
    if IsESX() then
        ESX.GetPlayerFromId(playerId).removeMoney(amount)
    elseif IsQBCore() then
        QBCore.Functions.GetPlayer(playerId)?.Functions.RemoveMoney('cash', amount)
    end
end

function GiveMoney(playerId, amount)
    if IsESX() then
        ESX.GetPlayerFromId(playerId).addMoney(amount)
    elseif IsQBCore() then
        QBCore.Functions.GetPlayer(playerId)?.Functions.AddMoney('cash', amount)
    end
end

function GiveReward(playerId, reward, amount)
    if IsESX() then
        ESX.GetPlayerFromId(playerId)?.addInventoryItem(reward, amount)
    elseif IsQBCore() then
        QBCore.Functions.GetPlayer(playerId)?.Functions.AddMoney('cash', amount)
    end
end
PreviousCar TheftNextAdvanced Solar Panels

Last updated 10 months ago