MenanAk47
  • Welcome
  • FAQ
  • ESX
    • ak47_whitewidowv2
      • Installation
      • Configuration
    • ak47_cannabiscafev2
      • Installation
      • Configuration
    • ak47_clothing
      • Installation
      • Configuration
      • Integration
      • Exports
      • Triggers
      • Commands
      • Common Issues
    • ak47_iclothingv3
      • Installation
    • ak47_switch
      • Installation
      • Commands
    • ak47_crutch
      • Installation
      • Triggers
      • Commands
    • ak47_housing
      • Installation
      • Configuration
      • Integration
      • Commands
      • Common Issues
    • ak47_cardealer
      • Installation
      • Configuration
      • Integration
      • Commands
      • Common Issues
    • ak47_ambulancejob
      • Installation
      • Guideline
      • Items
      • Integration
      • Commands
      • Triggers
      • Exports
    • ak47_gangs
      • Installation
      • Integration
      • Commands
      • Exports
    • ak47_garage
      • Installation
      • Integration
      • Commands
    • ak47_jobgarage
      • Installation
      • Integration
      • Commands
    • ak47_vehiclekeys
      • Installation
      • Integration
      • Commands
    • ak47_carboosting
      • Installation
      • Integration
      • Commands
    • ak47_safezone
      • Installation
      • Integration
      • Commands
    • ak47_inventory
      • Installation
      • Exports
        • Client
        • Server
      • Event Handlers
        • Client
        • Server
      • Commands
      • Guides
        • Custom Stash
        • External Shop
        • Protected Item
        • Convert Items
        • Show Info Value
      • Templates
        • Item
        • Weapon
        • Crafting
        • Stash
        • Shop
        • Vending
        • Dumpster
        • Tooltip
      • Modified Scripts
        • LegacyFuel
    • ak47_idcardv2
      • Installation
      • Integration
      • Commands
    • ak47_territories
      • Installation
      • Integration
      • Commands
      • Exports
  • QBCore
    • ak47_qb_whitewidowv2
      • Installation
      • Configuration
    • ak47_qb_cannabiscafev2
      • Installation
      • Configuration
    • ak47_qb_clothing
      • Installation
      • Configuration
      • Integration
      • Exports
      • Triggers
      • Commands
      • Common Issues
    • ak47_qb_iclothingv3
      • Installation
    • ak47_qb_switch
      • Installation
      • Commands
    • ak47_qb_crutch
      • Installation
      • Triggers
      • Commands
    • ak47_qb_wanted
      • Installation
      • Triggers
    • ak47_qb_housing
      • Installation
      • Configuration
      • Integration
      • Commands
      • Common Issues
    • ak47_qb_cardealer
      • Installation
      • Configuration
      • Integration
      • Commands
      • Common Issues
    • ak47_qb_ambulancejob
      • Installation
      • Guideline
      • Items
      • Integration
      • Commands
      • Triggers
      • Exports
    • ak47_qb_gangs
      • Installation
      • Integration
      • Commands
      • Exports
    • ak47_qb_garage
      • Installation
      • Integration
      • Commands
    • ak47_qb_jobgarage
      • Installation
      • Integration
      • Commands
    • ak47_qb_vehiclekeys
      • Installation
      • Integration
      • Commands
    • ak47_qb_carboosting
      • Installation
      • Integration
      • Commands
    • ak47_qb_safezone
      • Installation
      • Integration
      • Commands
    • ak47_qb_inventory
      • Installation
      • Exports
        • Client
        • Server
      • Event Handlers
        • Client
        • Server
      • Commands
      • Guides
        • Custom Stash
        • External Shop
        • Protected Item
        • Convert Items
        • Enable Weapon Wheel
        • Show Info Value
      • Templates
        • Item
        • Weapon
        • Crafting
        • Stash
        • Shop
        • Vending
        • Dumpster
        • Tooltip
      • Modified Scripts
        • LegacyFuel
    • ak47_qb_idcardv2
      • Installation
      • Integration
      • Commands
    • ak47_qb_territories
      • Installation
      • Integration
      • Commands
      • Exports
Powered by GitBook
On this page
  • Add dependencies:
  • Add the script:
  • Apply Modifications: (if you want to add new job with /adddealerjob)
  1. ESX
  2. ak47_cardealer

Installation

Previousak47_cardealerNextConfiguration

Last updated 1 year ago

Add dependencies:

  1. PolyZone:

  2. ox_lib:

Add the script:

  1. Add the script into resources folder.

  2. Import dealers.sql into database.

  3. Start the script in server.cfg

Apply Modifications: (if you want to add new job with /adddealerjob)

Add this code at the bottom of "es_extended/server/common.lua"

RegisterNetEvent('esx:refreshJobs', function(cb, triggerCheck)
    if triggerCheck then
        triggerCheck(true)
        return
    end
    local Jobs = {}
    MySQL.Async.fetchAll('SELECT * FROM jobs', {}, function(jobs)
        for k, v in ipairs(jobs) do
            Jobs[v.name] = v
            Jobs[v.name].grades = {}
        end
        MySQL.Async.fetchAll('SELECT * FROM job_grades', {}, function(jobGrades)
            for k, v in ipairs(jobGrades) do
                if Jobs[v.job_name] then
                    Jobs[v.job_name].grades[tostring(v.grade)] = v
                end
            end
            for k2, v2 in pairs(Jobs) do
                if ESX.Table.SizeOf(v2.grades) == 0 then
                    Jobs[v2.name] = nil
                end
            end
            ESX.Jobs = Jobs
            if cb then
                cb(true)
            end
        end)
    end)
end)

Add this code at the bottom of "esx_addonaccount/server/main.lua"

RegisterNetEvent('esx_addonaccount:refreshAccounts', function(cb, triggerCheck)
	if triggerCheck then
		triggerCheck(true)
		return
	end
	AccountsIndex, Accounts, SharedAccounts = {}, {}, {}
	local result = MySQL.Sync.fetchAll('SELECT * FROM addon_account')
	for i=1, #result, 1 do
		local name   = result[i].name
		local label  = result[i].label
		local shared = result[i].shared
		local result2 = MySQL.Sync.fetchAll('SELECT * FROM addon_account_data WHERE account_name = @account_name', {
			['@account_name'] = name
		})
		if shared == 0 then
			table.insert(AccountsIndex, name)
			Accounts[name] = {}
			for j=1, #result2, 1 do
				local addonAccount = CreateAddonAccount(name, result2[j].owner, result2[j].money)
				table.insert(Accounts[name], addonAccount)
			end
		else
			local money = nil
			if #result2 == 0 then
				MySQL.Sync.execute('INSERT INTO addon_account_data (account_name, money, owner) VALUES (@account_name, @money, NULL)', {
					['@account_name'] = name,
					['@money']        = 0
				})
				money = 0
			else
				money = result2[1].money
			end
			local addonAccount   = CreateAddonAccount(name, nil, money)
			SharedAccounts[name] = addonAccount
		end
	end
	if cb then
		cb(true)
	end
end)

Add this code at the bottom of "esx_society/server/main.lua"

RegisterNetEvent('esx_society:refreshSociety', function(cb, triggerCheck)
	if triggerCheck then
		triggerCheck()
		return
	end
	Jobs = {}
	local result = MySQL.Sync.fetchAll('SELECT * FROM jobs', {})
	for i=1, #result, 1 do
		Jobs[result[i].name] = result[i]
		Jobs[result[i].name].grades = {}
	end
	local result2 = MySQL.Sync.fetchAll('SELECT * FROM job_grades', {})
	for i=1, #result2, 1 do
		Jobs[result2[i].job_name].grades[tostring(result2[i].grade)] = result2[i]
	end
	if cb then
		cb()
	end
end)

Notes:

  • Don't upload the script with FileZilla, Use Winscp if you are using FTP for file uploading.

  • Renaming of the script is not allowed.

  • We do not support custom frameworks, highly modified versions of ESX, or deprecated/outdated versions of anything.

https://github.com/mkafrin/PolyZone
https://github.com/overextended/ox_lib