Iconic-Scripts | Docs
  • SCRIPTS
    • iconic-rope
      • Config
      • Item creation
        • Tgiann_inventory
        • ox_inventory
    • Iconic-Minigames
      • Tutorial
    • Iconic-AdvancedGarges
      • Installation Guide
      • Fixing Categories
      • Exports
        • Client
          • Classes
          • Vehicle Stats
          • Vehicle Category
Powered by GitBook
On this page
  1. SCRIPTS
  2. Iconic-AdvancedGarges

Fixing Categories

Look for in your vehicleshop script, the function to give a vehicle to a player, in our case this is our function

Config.BuyFunction = function(src, xPlayer, props, model)
    MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, state) VALUES (@owner, @plate, @vehicle, @state)',
    {
        ['@owner'] = xPlayer.identifier,
        ['@plate'] = props.plate,
        ['@vehicle'] = json.encode(props),
        ['@state'] = 0,
    }, function(rowsChanged)  
end

Now we need to add category

Config.BuyFunction = function(src, xPlayer, props, model)
    MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, state, cat) VALUES (@owner, @plate, @vehicle, @state, @cat)',
    {
        ['@owner'] = xPlayer.identifier,
        ['@plate'] = props.plate,
        ['@vehicle'] = json.encode(props),
        ['@state'] = 0,
        ['@cat'] = lib.callback.await('i_garages:getVehicleCategory', source, model),
    }, function(rowsChanged)
    end)
end

Now our script works flawless

PreviousInstallation GuideNextExports

Last updated 9 days ago

If you still have a problem with it open a ticket on our

discord