gpScripts Docs
StoreDiscordYoutube
  • 📔gpScripts
  • Clothingshop
    • Installation
    • Developers
      • Client
  • 💰InsuranceSystem
    • Installation
    • Developers
      • Client
      • Server
  • 📲Businesscards
    • Installation
    • Developers
      • Events
  • 🛡️visumsystem
    • Installation
    • Developers
      • Commands
      • Exports
      • Events
    • Code Snippets
      • QB-Garages
  • ☎️Emergencyphone
    • Installation
    • Common mistakes
      • Common mistakes
    • Developer
      • Events
  • 💵Tax-System
    • Installation
      • Step 1 - SQL-File
      • Step 2 - [QB-Core] Changes
      • Step 3 - [ESX] Changes
      • Step 4 - Restart your server
      • Step 5 - Set first deduction date
    • Exclude inactive vehicles
    • Common mistakes
      • Common mistakes
    • Developer
      • Events
Powered by GitBook
On this page

Was this helpful?

  1. visumsystem
  2. Code Snippets

QB-Garages

If you are having trouble parking or unparking visa vehicles with QB garages, this should solve your problem.

File: gp_visum/configs/config.lua

Replace the addVehicleToOwner function in line 239

gp_visum/configs/config.lua
-- (Server)
-- Simple function to add the visum vehicle to a player
Config.addVehicleToOwner = function(src, plate, visumVehicleData)
    local player = QBCore.Functions.GetPlayer(src)
    MySQL.Async.execute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate, @garage, @state)',
    {
        ['@license'] = player.PlayerData.license,
        ['@citizenid'] = player.PlayerData.citizenid,
        ['@vehicle'] = visumVehicleData.vehicleModel,
        ['@hash'] = GetHashKey(visumVehicleData.vehicleModel),
        ['@mods'] = json.encode({model = GetHashKey(visumVehicleData.vehicleModel), plate = plate}),
        ['@plate'] = plate,
        ['@garage'] = "pillboxgarage",
        ['@state'] = "0",
    }, function(rowsChanged)
        Config.debug("Added vehicle to player " .. visum.getPlayerName(src) .. " with plate " .. plate)
        -- Add key to the user with the given plate and source
        Config.addVehicleKeys(src, plate, visumVehicleData.vehicleName)
    end)
end
PreviousCode SnippetsNextInstallation

Last updated 2 years ago

Was this helpful?

🛡️