đĨī¸Compatibilities
okokVehicleShop/sv_utils.lua - Search this code:
RegisterServerEvent(Config.EventPrefix..':setVehicleOwned')
AddEventHandler(Config.EventPrefix..':setVehicleOwned', function (vehicleProps, vehicleModel, id)
local _source = source
local xPlayer = QBCore.Functions.GetPlayer(_source)
MySQLexecute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, state) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate, @state)', {
['@license'] = xPlayer.PlayerData.license,
['@citizenid'] = xPlayer.PlayerData.citizenid,
['@vehicle'] = vehicleModel,
['@hash'] = GetHashKey(vehicleModel),
['@mods'] = json.encode(vehicleProps),
['@plate'] = vehicleProps.plate:match( "^%s*(.-)%s*$" ),
['@state'] = 0
}, function (rowsChanged)
end)
end)
Replace with:
RegisterServerEvent(Config.EventPrefix..':setVehicleOwned')
AddEventHandler(Config.EventPrefix..':setVehicleOwned', function (vehicleProps, vehicleModel, id)
local _source = source
local xPlayer = QBCore.Functions.GetPlayer(_source)
local Inventory = "qb" -- "qb" or "ox"
MySQLexecute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, state) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate, @state)', {
['@license'] = xPlayer.PlayerData.license,
['@citizenid'] = xPlayer.PlayerData.citizenid,
['@vehicle'] = vehicleModel,
['@hash'] = GetHashKey(vehicleModel),
['@mods'] = json.encode(vehicleProps),
['@plate'] = vehicleProps.plate:match( "^%s*(.-)%s*$" ),
['@state'] = 0
}, function (rowsChanged)
end)
local info = {}
info.name = xPlayer.PlayerData.charinfo.firstname .. " " .. xPlayer.PlayerData.charinfo.lastname
info.plate = vehicleProps.plate
info.model = vehicleModel
if Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', _source, QBCore.Shared.Items["car_registration"], 'add')
xPlayer.Functions.AddItem('car_registration', 1, false, info)
elseif Inventory == "ox" then
local metadata = { description = 'Name: '..name..' \nPlate: '..vehicleProps.plate..' \nModel: '..vehicleModel }
exports.ox_inventory:AddItem(_source, 'car_registration', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', _source, QBCore.Shared.Items["car_registration"], 'add')
end
MySQLexecute('INSERT INTO m_insurance_registration (plate, model, registration) VALUES (?, ?, ?)', {vehicleProps.plate, vehicleModel, 1})
end)
qb-vehicleshop/server.lua - Search this code:
RegisterNetEvent('qb-vehicleshop:server:buyShowroomVehicle', function(vehicle)
local src = source
vehicle = vehicle.buyVehicle
local pData = QBCore.Functions.GetPlayer(src)
local cid = pData.PlayerData.citizenid
local cash = pData.PlayerData.money['cash']
local bank = pData.PlayerData.money['bank']
local vehiclePrice = QBCore.Shared.Vehicles[vehicle]['price']
local plate = GeneratePlate()
if cash > tonumber(vehiclePrice) then
MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
pData.PlayerData.license,
cid,
vehicle,
GetHashKey(vehicle),
'{}',
plate,
'pillboxgarage',
0
})
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.purchased'), 'success')
TriggerClientEvent('qb-vehicleshop:client:buyShowroomVehicle', src, vehicle, plate)
pData.Functions.RemoveMoney('cash', vehiclePrice, 'vehicle-bought-in-showroom')
elseif bank > tonumber(vehiclePrice) then
MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
pData.PlayerData.license,
cid,
vehicle,
GetHashKey(vehicle),
'{}',
plate,
'pillboxgarage',
0
})
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.purchased'), 'success')
TriggerClientEvent('qb-vehicleshop:client:buyShowroomVehicle', src, vehicle, plate)
pData.Functions.RemoveMoney('bank', vehiclePrice, 'vehicle-bought-in-showroom')
else
TriggerClientEvent('QBCore:Notify', src, Lang:t('error.notenoughmoney'), 'error')
end
end)
Replace with:
RegisterNetEvent('qb-vehicleshop:server:buyShowroomVehicle', function(vehicle)
local src = source
vehicle = vehicle.buyVehicle
local pData = QBCore.Functions.GetPlayer(src)
local cid = pData.PlayerData.citizenid
local cash = pData.PlayerData.money['cash']
local bank = pData.PlayerData.money['bank']
local vehiclePrice = QBCore.Shared.Vehicles[vehicle]['price']
local plate = GeneratePlate()
if cash > tonumber(vehiclePrice) then
MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
pData.PlayerData.license,
cid,
vehicle,
GetHashKey(vehicle),
'{}',
plate,
'pillboxgarage',
0
})
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.purchased'), 'success')
TriggerClientEvent('qb-vehicleshop:client:buyShowroomVehicle', src, vehicle, plate)
pData.Functions.RemoveMoney('cash', vehiclePrice, 'vehicle-bought-in-showroom')
local Inventory = "qb" -- "qb" or "ox"
local info = {}
info.name = pData.PlayerData.charinfo.firstname .. " " .. pData.PlayerData.charinfo.lastname
info.plate = plate
info.model = vehicle
if Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["car_registration"], 'add')
pData.Functions.AddItem('car_registration', 1, false, info)
elseif Inventory == "ox" then
local metadata = { description = 'Name: '..name..' \nPlate: '..plate..' \nModel: '..vehicle }
exports.ox_inventory:AddItem(src, 'car_registration', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["car_registration"], 'add')
end
MySQL.insert('INSERT INTO m_insurance_registration (plate, model, registration) VALUES (?, ?, ?)', {plate, vehicle, 1})
elseif bank > tonumber(vehiclePrice) then
MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
pData.PlayerData.license,
cid,
vehicle,
GetHashKey(vehicle),
'{}',
plate,
'pillboxgarage',
0
})
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.purchased'), 'success')
TriggerClientEvent('qb-vehicleshop:client:buyShowroomVehicle', src, vehicle, plate)
pData.Functions.RemoveMoney('bank', vehiclePrice, 'vehicle-bought-in-showroom')
local Inventory = "qb" -- "qb" or "ox"
local info = {}
info.name = pData.PlayerData.charinfo.firstname .. " " .. pData.PlayerData.charinfo.lastname
info.plate = plate
info.model = vehicle
if Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["car_registration"], 'add')
pData.Functions.AddItem('car_registration', 1, false, info)
elseif Inventory == "ox" then
local metadata = { description = 'Name: '..name..' \nPlate: '..plate..' \nModel: '..vehicle }
exports.ox_inventory:AddItem(src, 'car_registration', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["car_registration"], 'add')
end
MySQL.insert('INSERT INTO m_insurance_registration (plate, model, registration) VALUES (?, ?, ?)', {plate, vehicle, 1})
else
TriggerClientEvent('QBCore:Notify', src, Lang:t('error.notenoughmoney'), 'error')
end
end)
server.lua - Search this code:
function Utils.Framework.givePlayerVehicle(source, vehicle, vehicle_type, plate, vehicle_props, state, finance_details)
local xPlayer = QBCore.Functions.GetPlayer(source)
local plate = vehicle_props and vehicle_props.plate or Utils.Framework.generatePlate(plate)
local mods = vehicle_props and vehicle_props or {}
local state = state or 0
local finance_details = finance_details or {}
local vehicle_type = vehicle_type or 'car'
local garage = Config.owned_vehicles['default'].garage
if Config.owned_vehicles[vehicle_type] then
garage = Config.owned_vehicles[vehicle_type].garage
end
Utils.Database.execute('INSERT INTO player_vehicles (license, citizenid, plate, vehicle, hash, mods, garage, state, balance, paymentamount, paymentsleft, financetime) VALUES (@license, @citizenid, @plate, @vehicle, @hash, @mods, @garage, @state, @balance, @paymentamount, @paymentsleft, @financetime)',
{
['@license'] = xPlayer.PlayerData.license,
['@citizenid'] = xPlayer.PlayerData.citizenid,
['@plate'] = plate,
['@state'] = state, -- 1 = inside garage | 0 = outside garage
['@vehicle'] = vehicle,
['@hash'] = GetHashKey(vehicle),
['@garage'] = garage,
['@mods'] = json.encode(mods),
['@balance'] = finance_details.balance or 0,
['@paymentamount'] = finance_details.paymentamount or 0,
['@paymentsleft'] = finance_details.paymentsleft or 0,
['@financetime'] = finance_details.financetime or 0
})
return true
end
Replace with:
function Utils.Framework.givePlayerVehicle(source, vehicle, vehicle_type, plate, vehicle_props, state, finance_details)
local xPlayer = QBCore.Functions.GetPlayer(source)
local plate = vehicle_props and vehicle_props.plate or Utils.Framework.generatePlate(plate)
local mods = vehicle_props and vehicle_props or {}
local state = state or 0
local finance_details = finance_details or {}
local vehicle_type = vehicle_type or 'car'
local garage = Config.owned_vehicles['default'].garage
if Config.owned_vehicles[vehicle_type] then
garage = Config.owned_vehicles[vehicle_type].garage
end
local Inventory = "qb"
local info = {}
info.name = xPlayer.PlayerData.charinfo.firstname .. " " .. xPlayer.PlayerData.charinfo.lastname
info.plate = plate
info.model = vehicle
if Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["car_registration"], 'add')
xPlayer.Functions.AddItem('car_registration', 1, false, info)
elseif Inventory == "ox" then
local metadata = { description = 'Name: '..name..' \nPlate: '..plate..' \nModel: '..vehicle }
exports.ox_inventory:AddItem(src, 'car_registration', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["car_registration"], 'add')
end
Utils.Database.execute('INSERT INTO m_insurance_registration (plate, model, registration) VALUES (?, ?, ?)', {plate, vehicle, 1})
Utils.Database.execute('INSERT INTO player_vehicles (license, citizenid, plate, vehicle, hash, mods, garage, state, balance, paymentamount, paymentsleft, financetime) VALUES (@license, @citizenid, @plate, @vehicle, @hash, @mods, @garage, @state, @balance, @paymentamount, @paymentsleft, @financetime)',
{
['@license'] = xPlayer.PlayerData.license,
['@citizenid'] = xPlayer.PlayerData.citizenid,
['@plate'] = plate,
['@state'] = state, -- 1 = inside garage | 0 = outside garage
['@vehicle'] = vehicle,
['@hash'] = GetHashKey(vehicle),
['@garage'] = garage,
['@mods'] = json.encode(mods),
['@balance'] = finance_details.balance or 0,
['@paymentamount'] = finance_details.paymentamount or 0,
['@paymentsleft'] = finance_details.paymentsleft or 0,
['@financetime'] = finance_details.financetime or 0
})
return true
end
qb-ambulancejob/server/main.lua - Search this code:
RegisterNetEvent('hospital:server:SendToBed', function(bedId, isRevive)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
TriggerClientEvent('hospital:client:SendToBed', src, bedId, Config.Locations["beds"][bedId], isRevive)
TriggerClientEvent('hospital:client:SetBed', -1, bedId, true)
Player.Functions.RemoveMoney("bank", Config.BillCost , "respawned-at-hospital")
exports['qb-management']:AddMoney("ambulance", Config.BillCost)
TriggerClientEvent('hospital:client:SendBillEmail', src, Config.BillCost)
end)
Replace with:
RegisterNetEvent('hospital:server:SendToBed', function(bedId, isRevive)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local citizenid = Player.PlayerData.citizenid
TriggerClientEvent('hospital:client:SendToBed', src, bedId, Config.Locations["beds"][bedId], isRevive)
TriggerClientEvent('hospital:client:SetBed', -1, bedId, true)
MySQL.Async.fetchScalar('SELECT citizenid FROM m_insurance_health WHERE citizenid = ?', {citizenid}, function(result)
if result then
Player.Functions.RemoveMoney("bank", Config.BillCost - 500, "respawned-at-hospital") -- The value "500" is the discount
exports['qb-management']:AddMoney("ambulance", Config.BillCost - 500) -- The value "500" is the discount
else
Player.Functions.RemoveMoney("bank", Config.BillCost , "respawned-at-hospital")
exports['qb-management']:AddMoney("ambulance", Config.BillCost)
end
end)
TriggerClientEvent('hospital:client:SendBillEmail', src, Config.BillCost)
end)
qs-housing/server/custom/misc/buyHouse.lua - Replace all code with this:
RegisterServerEvent('housing:server:buyHouse')
AddEventHandler('housing:server:buyHouse', function(house, isCredit)
local house = house
local src = source
local pData = GetPlayerFromId(src)
local houses = #getHousesByIdentifier(pData.identifier) or 0
local totalFees
if Config.LimitOfHouses == 0 or houses < Config.LimitOfHouses then
if not Config.Houses[house] or not house then return end
local price = tonumber(Config.Houses[house].price)
local brokerfee = (price * Config.Taxes.AgencyFee) / 100
local bankfee = (price * Config.Taxes.BankFee) / 100
local taxes = (price * Config.Taxes.TaxesFee) / 100
if Config.Decimals then
totalFees = tonumber(price + brokerfee + bankfee + taxes)
else
totalFees = math.floor(tonumber(price + brokerfee + bankfee + taxes))
end
local HousePrice = totalFees
local eq = math.floor(HousePrice / Config.NumberOfPayments)
local Balance = GetBankMoney(src)
local timer = Config.NumberOfPayments * Config.CreditTime
local seller
local result = MySQL.Sync.fetchAll('SELECT * FROM houselocations WHERE name = @name', {
['@name'] = house,
})
if result[1].houseID then
house_ID = result[1].houseID
else
updateidhouse(result[1].house)
end
if result and result[1] and result[1].creator then
seller = GetPlayerIdentifier(result[1].creator)
end
if (Balance >= HousePrice) or (isCredit and Balance >= eq) then -- here
local prices = isCredit and HousePrice - eq or 0
MySQL.Async.execute("INSERT INTO `player_houses` (`house`, `"..identifierTypes.."`, `insideId`, `keyholders`, `decorations`, `stash`, `houseID`, `outfit`, `logout`, `decorateStash`, `charge`, `credit`, `creditPrice`, `timer`) VALUES ('" .. house .. "','" .. pData.identifier .. "', NULL, NULL, '{}', NULL, '" .. house_ID .. "', NULL, NULL, NULL, NULL, '" ..prices.. "', '" .. eq .. "', '" .. Config.CreditTime .. "')",{})
local hous = MySQL.Sync.fetchAll('SELECT * FROM houselocations WHERE name = @name', { ['@name'] = house })
if hous and hous[1] then
local moneyToRealState = (HousePrice / 100) * Config.PercentageForSell
MySQL.Async.execute("UPDATE `houselocations` SET `owned` = 1, `creator` = '" .. '' .. "' WHERE `name` = '" .. house .. "'", {}, function()
DebugPrint('A house was bought for ' .. json.encode(HousePrice) .. ' and ' .. moneyToRealState .. ' was sent to the real estate')
RemoveBankMoney(src, isCredit and eq or HousePrice) -- 21% Extra house costs
if result and result[1] and result[1].creator and result[1].creator ~= '' and result[1].creator ~= nil then
if seller then
AddBankMoney(seller.source, moneyToRealState)
if Config.Smartphone then
TriggerClientEvent('housing:client:sellerMail', seller.source, Lang('HOUSING_SMARTPHONE_MESSAGE_TITLE'), Lang('HOUSING_SMARTPHONE_MESSAGE_SUBJECT'), Lang('HOUSING_SMARTPHONE_MESSAGE_COMPLETE') .. math.floor(moneyToRealState / 2))
end
else
AddOfflineBank(result[1].creator, moneyToRealState)
end
end
if seller and Config.Society then
local societyName = GetJobName(seller.source)
local societyPaid = math.floor(tonumber((HousePrice / 100) * Config.SocietyPorcentage))
buyHouseSocietyMoney(src, societyName, societyPaid)
DebugPrint('Added ' .. societyPaid .. ' to the ' .. societyName .. ' society with ' .. Config.Society)
else
DebugPrint('The seller and creator of this house no longer has a character on your server, therefore he did not receive any salary in society...')
::continue::
end
Config.Houses[house].owned = true
Config.Houses[house].identifier = pData.identifier
Config.Houses[house].keys = {}
UpdateHouseServer(house, Config.Houses[house])
TriggerClientEvent('housing:client:changeClosestHouse', -1, house)
if Config.Webhooks.buyhouse ~= '' or not Config.Webhooks.buyhouse then
sendToDiscordBuyHouse(Config.WebhookTranslates['buyhouse']['title'],
Config.WebhookTranslates['buyhouse']['player'] .. ' ' .. GetPlayerName(src) ..
Config.WebhookTranslates['buyhouse']['license'] .. ' ' .. pData.identifier ..
Config.WebhookTranslates['buyhouse']['coords'] .. ' ' .. json.encode(Config.Houses[house].coords.enter.x) .. ', ' .. json.encode(Config.Houses[house].coords.enter.y) .. ', ' .. json.encode(Config.Houses[house].coords.enter.z) ..
Config.WebhookTranslates['buyhouse']['price'] .. ' $' .. HousePrice ..
Config.WebhookTranslates['buyhouse']['realestateMoney'] .. ' $' .. moneyToRealState,
7393279)
end
----------------------------------
-- m-Insurance
local inventory = "qb" -- "qb" or "ox"
local months = 1 -- 1 Month only when you player buy a house
local now = os.time()
local nowFormatted = os.date('%Y-%m-%d %H:%M:%S')
local expiration = now + months * 30 * 24 * 60 * 60
local expirationFormatted = os.date('%Y-%m-%d %H:%M:%S', expiration)
local formattedTodayDate = os.date('%Y-%m-%d', now)
local formattedEndDate = os.date('%Y-%m-%d', expiration)
local citizenid = pData.PlayerData.citizenid
local info = {
name = GetPlayerName(src),
citizenid = citizenid,
date = formattedTodayDate,
expire = formattedEndDate,
}
if Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["home_insurance"], 'add')
pData.Functions.AddItem('home_insurance', 1, false, info)
elseif Inventory == "ox" then
local metadata = { description = 'Name: ' .. name .. ' \nCitizenID: ' .. citizenid .. ' \nDate: ' .. info.date .. ' \nExpire: ' .. info.expire }
exports.ox_inventory:AddItem(src, 'home_insurance', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["home_insurance"], 'add')
end
MySQL.insert('INSERT INTO m_insurance_home (citizenid, creation_date, expire_date) VALUES (?, ?, ?)', {citizenid, nowFormatted, expirationFormatted})
-- m-Insurance
----------------------------------
end)
else
MySQL.Async.execute('INSERT INTO houselocations (name, label, coords, owned, price, tier, garage) VALUES (@name, @label, @coords, @owned, @price, @tier, @garage)', {
['@name'] = house,
['@label'] = house,
['@coords'] = json.encode(Config.Houses[house].coords),
['@owned'] = 1,
['@price'] = HousePrice,
['@tier'] = Config.Houses[house].tier,
['@garage'] = json.encode(Config.Houses[house].garage)
}, {}, function()
local moneyToRealState = (HousePrice / 100) * Config.PercentageForSell
RemoveBankMoney(src, isCredit and eq or HousePrice) -- 21% Extra house costs
DebugPrint('A house was bought for ' .. json.encode(HousePrice) .. ' and ' .. moneyToRealState .. ' was sent to the real estate')
if result and result[1] and result[1].creator and result[1].creator ~= '' and result[1].creator ~= nil then
if seller then
AddBankMoney(seller.source, moneyToRealState)
if Config.Smartphone then
TriggerClientEvent('housing:client:sellerMail', seller.source, Lang('HOUSING_SMARTPHONE_MESSAGE_TITLE'), Lang('HOUSING_SMARTPHONE_MESSAGE_SUBJECT'), Lang('HOUSING_SMARTPHONE_MESSAGE_COMPLETE') .. math.floor(moneyToRealState / 2))
end
else
AddOfflineBank(result[1].creator, moneyToRealState)
end
end
if seller and Config.Society then
local societyName = GetJobName(seller.source)
local societyPaid = math.floor(tonumber((HousePrice / 100) * Config.SocietyPorcentage))
buyHouseSocietyMoney(src, societyName, societyPaid)
DebugPrint('Added ' .. societyPaid .. ' to the ' .. societyName .. ' society with ' .. Config.Society)
else
DebugPrint('The seller and creator of this house no longer has a character on your server, therefore he did not receive any salary in society...')
::continue::
end
Config.Houses[house] = {
coords = Config.Houses[house].coords,
owned = true,
price = HousePrice,
locked = true,
adress = house,
tier = Config.Houses[house].tier,
garage = Config.Houses[house].garage,
decorations = Config.Houses[house].decorations or {},
mlo = {},
identifier = pData.identifier,
keys = {},
houseID = houseID,
}
UpdateHouseServer(house, Config.Houses[house])
TriggerClientEvent('housing:client:changeClosestHouse', -1, house)
if Config.WebhookEnable.buyhouse then
sendToDiscordBuyHouse(Config.WebhookTranslates['buyhouse']['title'],
Config.WebhookTranslates['buyhouse']['player'] .. ' ' .. GetPlayerName(src) ..
Config.WebhookTranslates['buyhouse']['license'] .. ' ' .. pData.identifier ..
Config.WebhookTranslates['buyhouse']['coords'] .. ' ' .. json.encode(Config.Houses[house].coords.enter.x) .. ', ' .. json.encode(Config.Houses[house].coords.enter.y) .. ', ' .. json.encode(Config.Houses[house].coords.enter.z) ..
Config.WebhookTranslates['buyhouse']['price'] .. ' $' .. HousePrice ..
Config.WebhookTranslates['buyhouse']['realestateMoney'] .. ' $' .. moneyToRealState,
7393279)
end
----------------------------------
-- m-Insurance
local inventory = "qb" -- "qb" or "ox"
local months = 1 -- 1 Month only when you player buy a house
local now = os.time()
local nowFormatted = os.date('%Y-%m-%d %H:%M:%S')
local expiration = now + months * 30 * 24 * 60 * 60
local expirationFormatted = os.date('%Y-%m-%d %H:%M:%S', expiration)
local formattedTodayDate = os.date('%Y-%m-%d', now)
local formattedEndDate = os.date('%Y-%m-%d', expiration)
local citizenid = pData.PlayerData.citizenid
local info = {
name = GetPlayerName(src),
citizenid = citizenid,
date = formattedTodayDate,
expire = formattedEndDate,
}
if Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["home_insurance"], 'add')
pData.Functions.AddItem('home_insurance', 1, false, info)
elseif Inventory == "ox" then
local metadata = { description = 'Name: ' .. name .. ' \nCitizenID: ' .. citizenid .. ' \nDate: ' .. info.date .. ' \nExpire: ' .. info.expire }
exports.ox_inventory:AddItem(src, 'home_insurance', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["home_insurance"], 'add')
end
MySQL.insert('INSERT INTO m_insurance_home (citizenid, creation_date, expire_date) VALUES (?, ?, ?)', {citizenid, nowFormatted, expirationFormatted})
-- m-Insurance
----------------------------------
end)
end
DebugPrint('Home purchase for $' .. HousePrice .. '...')
else
TriggerClientEvent('housing:client:sendMessage', src, Lang('HOUSING_NOTIFICATION_NO_MONEY'), 'error')
end
else
TriggerClientEvent('housing:client:sendMessage', src, Lang('HOUSING_NOTIFICATION_HOUSE_LIMIT'), 'error')
end
end)
ps-housing/server/server.lua - Search this code:
AddEventHandler("ps-housing:server:registerProperty", function (propertyData, preventEnter) -- triggered by realtor job
local propertyData = propertyData
propertyData.owner = propertyData.owner or nil
propertyData.has_access = propertyData.has_access or {}
propertyData.extra_imgs = propertyData.extra_imgs or {}
propertyData.furnitures = propertyData.furnitures or {}
propertyData.door_data = propertyData.door_data or {}
propertyData.garage_data = propertyData.garage_data or {}
local cols = "(owner_citizenid, street, region, description, has_access, extra_imgs, furnitures, for_sale, price, shell, apartment, door_data, garage_data)"
local vals = "(@owner_citizenid, @street, @region, @description, @has_access, @extra_imgs, @furnitures, @for_sale, @price, @shell, @apartment, @door_data, @garage_data)"
local id = MySQL.insert.await("INSERT INTO properties " .. cols .. " VALUES " .. vals , {
["@owner_citizenid"] = propertyData.owner or nil,
["@street"] = propertyData.street,
["@region"] = propertyData.region,
["@description"] = propertyData.description,
["@has_access"] = json.encode(propertyData.has_access),
["@extra_imgs"] = json.encode(propertyData.extra_imgs),
["@furnitures"] = json.encode(propertyData.furnitures),
["@for_sale"] = propertyData.for_sale ~= nil and propertyData.for_sale or 1,
["@price"] = propertyData.price or 0,
["@shell"] = propertyData.shell,
["@apartment"] = propertyData.apartment,
["@door_data"] = json.encode(propertyData.door_data),
["@garage_data"] = json.encode(propertyData.garage_data),
})
id = tostring(id)
propertyData.property_id = id
PropertiesTable[id] = Property:new(propertyData)
TriggerClientEvent("ps-housing:client:addProperty", -1, propertyData)
if propertyData.apartment and not preventEnter then
local player = QBCore.Functions.GetPlayerByCitizenId(propertyData.owner)
local src = player.PlayerData.source
local property = Property.Get(id)
property:PlayerEnter(src)
Wait(1000)
local query = "SELECT skin FROM playerskins WHERE citizenid = ?"
local result = MySQL.Sync.fetchAll(query, {propertyData.owner})
if result and result[1] then
Debug("Player: " .. propertyData.owner .. " skin already exists!")
else
TriggerClientEvent("qb-clothes:client:CreateFirstCharacter", src)
Debug("Player: " .. propertyData.owner .. " is creating a new character!")
end
Framework[Config.Notify].Notify(src, "Open radial menu for furniture menu and place down your stash and clothing locker.", "info")
-- This will create the stash for the apartment and migrate the items from the old apartment stash if applicable
TriggerEvent("ps-housing:server:createApartmentStash", propertyData.owner, id)
end
end)
Replace with:
AddEventHandler("ps-housing:server:registerProperty", function (propertyData, preventEnter) -- triggered by realtor job
local propertyData = propertyData
propertyData.owner = propertyData.owner or nil
propertyData.has_access = propertyData.has_access or {}
propertyData.extra_imgs = propertyData.extra_imgs or {}
propertyData.furnitures = propertyData.furnitures or {}
propertyData.door_data = propertyData.door_data or {}
propertyData.garage_data = propertyData.garage_data or {}
local cols = "(owner_citizenid, street, region, description, has_access, extra_imgs, furnitures, for_sale, price, shell, apartment, door_data, garage_data)"
local vals = "(@owner_citizenid, @street, @region, @description, @has_access, @extra_imgs, @furnitures, @for_sale, @price, @shell, @apartment, @door_data, @garage_data)"
local id = MySQL.insert.await("INSERT INTO properties " .. cols .. " VALUES " .. vals , {
["@owner_citizenid"] = propertyData.owner or nil,
["@street"] = propertyData.street,
["@region"] = propertyData.region,
["@description"] = propertyData.description,
["@has_access"] = json.encode(propertyData.has_access),
["@extra_imgs"] = json.encode(propertyData.extra_imgs),
["@furnitures"] = json.encode(propertyData.furnitures),
["@for_sale"] = propertyData.for_sale ~= nil and propertyData.for_sale or 1,
["@price"] = propertyData.price or 0,
["@shell"] = propertyData.shell,
["@apartment"] = propertyData.apartment,
["@door_data"] = json.encode(propertyData.door_data),
["@garage_data"] = json.encode(propertyData.garage_data),
})
id = tostring(id)
propertyData.property_id = id
PropertiesTable[id] = Property:new(propertyData)
TriggerClientEvent("ps-housing:client:addProperty", -1, propertyData)
if propertyData.apartment and not preventEnter then
local player = QBCore.Functions.GetPlayerByCitizenId(propertyData.owner)
local src = player.PlayerData.source
local property = Property.Get(id)
property:PlayerEnter(src)
Wait(1000)
local query = "SELECT skin FROM playerskins WHERE citizenid = ?"
local result = MySQL.Sync.fetchAll(query, {propertyData.owner})
if result and result[1] then
Debug("Player: " .. propertyData.owner .. " skin already exists!")
else
TriggerClientEvent("qb-clothes:client:CreateFirstCharacter", src)
Debug("Player: " .. propertyData.owner .. " is creating a new character!")
end
Framework[Config.Notify].Notify(src, "Open radial menu for furniture menu and place down your stash and clothing locker.", "info")
-- This will create the stash for the apartment and migrate the items from the old apartment stash if applicable
TriggerEvent("ps-housing:server:createApartmentStash", propertyData.owner, id)
end
----------------------
-- m-Insurance
local Inventory = "qb" -- "qb" or "ox"
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local citizenid = Player.PlayerData.citizenid
local name = PlayerData.charinfo.firstname .. " " .. PlayerData.charinfo.lastname
local now = os.time()
local nowFormatted = os.date('%Y-%m-%d %H:%M:%S')
local expiration = now + 1 * 30 * 24 * 60 * 60 -- 1 Month of home_insurance when you buy
local expirationFormatted = os.date('%Y-%m-%d %H:%M:%S', expiration)
local info = {
name = name,
citizenid = citizenid,
date = os.date('%Y-%m-%d', now),
expire = os.date('%Y-%m-%d', expiration),
}
if Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["home_insurance"], 'add')
Player.Functions.AddItem('home_insurance', 1, false, info)
elseif Inventory == "ox" then
local metadata = { description = 'Name: ' .. name .. ' \nCitizenID: ' .. citizenid .. ' \nDate: ' .. info.date .. ' \nExpire: ' .. info.expire }
exports.ox_inventory:AddItem(src, 'home_insurance', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["home_insurance"], 'add')
end
MySQL.insert('INSERT INTO m_insurance_home (citizenid, creation_date, expire_date) VALUES (?, ?, ?)', {citizenid, nowFormatted, expirationFormatted})
-- m-Insurance
----------------------
end)
config-cl - Search this code:
RegisterNetEvent("jg-dealerships:client:purchase-vehicle:config", function(vehicle, plate, purchaseType, amount, paymentMethod, financed)
end)
Replace with:
RegisterNetEvent("jg-dealerships:client:purchase-vehicle:config", function(vehicle, plate, purchaseType, amount, paymentMethod, financed)
if Config.InsuranceEnable then
function GetVehicleName(model)
name = GetLabelText(GetDisplayNameFromVehicleModel(model))
return name
end
local hash = GetEntityModel(vehicle)
local modelName = GetVehicleName(hash)
TriggerServerEvent("jg-dealerships:server:AddRegistration", modelName, plate)
end
end)
config-sv - Add this code:
if Config.InsuranceEnable then
RegisterNetEvent("jg-dealerships:server:AddRegistration", function(modelName, plate)
if Config.Framework == "QBCore" then
local QBCore = exports["qb-core"]:GetCoreObject()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local citizenid = Player.PlayerData.citizenid
local info = {}
info.name = Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname
info.plate = plate
info.model = modelName
if Config.Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["car_registration"], 'add')
Player.Functions.AddItem('car_registration', 1, false, info)
elseif Config.Inventory == "ox" then
local metadata = { description = 'Name: '..name..' \nPlate: '..plate..' \nModel: '..modelName }
exports.ox_inventory:AddItem(src, 'car_registration', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["car_registration"], 'add')
end
MySQL.insert('INSERT INTO m_insurance_registration (plate, model, registration, citizenid) VALUES (?, ?, ?, ?)', {plate, modelName, 1, citizenid})
elseif Config.Framework == "ESX" then
ESX = exports.es_extended:getSharedObject()
local src = source
local xPlayer = ESX.GetPlayerFromId(src)
local name = xPlayer.getName()
local identifier = GetPlayerIdentifier(src, 0)
local metadata = { description = 'Name: '..name..' \nPlate: '..plate..' \nModel: '..modelName }
exports.ox_inventory:AddItem(src, 'car_registration', 1, metadata)
MySQL.insert('INSERT INTO m_insurance_registration (plate, model, registration, identifier) VALUES (?, ?, ?, ?)', {plate, modelName, 1, identifier})
end
end)
end
config.lua - Add this code:
-- m-Insurance
Config.InsuranceEnable = true -- Enable m-Insurance?
Config.Inventory = "qb" -- "qb" or "ox"
-- m-Insurance
ak47_cardealer/modules/main/server/customizable.lua - Replace the code:
AddEventHandler('ak47_cardealer:onpurchase', function(xPlayer, data, prop)
if GetResourceState('ak47_inventory') == 'started' then
exports["ak47_inventory"]:registerVehicleInventory(data.plate, data.category , GetHashKey(data.model))
end
if prop then
prop.plate = data.plate
end
MySQL.Async.execute('INSERT INTO '..Config.OwnedVehiclesTable..' (owner, plate, vehicle) VALUES (@owner, @plate, @vehicle)',
{
['@owner'] = xPlayer.identifier,
['@plate'] = data.plate,
['@vehicle'] = prop and json.encode(prop) or json.encode({model = GetHashKey(data.model), plate = data.plate}),
})
end)
With this:
AddEventHandler('ak47_cardealer:onpurchase', function(xPlayer, data, prop)
if GetResourceState('ak47_inventory') == 'started' then
exports["ak47_inventory"]:registerVehicleInventory(data.plate, data.category , GetHashKey(data.model))
end
if prop then
prop.plate = data.plate
end
MySQL.Async.execute('INSERT INTO '..Config.OwnedVehiclesTable..' (owner, plate, vehicle) VALUES (@owner, @plate, @vehicle)',
{
['@owner'] = xPlayer.identifier,
['@plate'] = data.plate,
['@vehicle'] = prop and json.encode(prop) or json.encode({model = GetHashKey(data.model), plate = data.plate}),
})
if Config.mInsurance then
local info = {}
info.name = xPlayer.PlayerData.charinfo.firstname .. " " .. xPlayer.PlayerData.charinfo.lastname
info.plate = data.plate
info.model = data.model
if Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', _source, QBCore.Shared.Items["car_registration"], 'add')
xPlayer.Functions.AddItem('car_registration', 1, false, info)
elseif Inventory == "ox" then
local metadata = { description = 'Name: '..info.name..' \nPlate: '..info.plate..' \nModel: '..info.model }
exports.ox_inventory:AddItem(_source, 'car_registration', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', _source, QBCore.Shared.Items["car_registration"], 'add')
end
MySQLexecute('INSERT INTO m_insurance_registration (plate, model, registration) VALUES (?, ?, ?)', {info.plate, info.model, 1})
end
end)
config.lua
-- m-Insurance
Config.Inventory = "qb" -- "qb" or "ox"
Config.mInsurance = true -- Enable m-Insurance?
-- m-Insurance
wasabi_ambulance/game/client/client.lua
Search this:
local checkInTimer = GetGameTimer()
AddEventHandler('wasabi_ambulance:attemptCheckin', function(data)
if not data.hospital then return end
local cooldown = 3000
if data.hospital == 'standalone' then
if Config.StandaloneCheckIns[data.standaloneID].DisableHospitalBeds then
cooldown = Config.StandaloneCheckIns
[data.standaloneID].Duration + 500
end
if GetGameTimer() - checkInTimer > cooldown then
checkInTimer = GetGameTimer()
TriggerServerEvent('wasabi_ambulance:tryStandaloneRevive', data.standaloneID)
else
TriggerEvent('wasabi_bridge:notify', Strings.checkin_cooldown, Strings.checkin_cooldown_desc, 'error')
end
return
end
local hospital = Config.Locations[data.hospital]
if not hospital then return end
if not hospital.CheckIn.Target.enabled then return end
if hospital.CheckIn.DisableHospitalBeds then cooldown = hospital.CheckIn.Duration + 500 end
if GetGameTimer() - checkInTimer > cooldown then
checkInTimer = GetGameTimer()
TriggerServerEvent('wasabi_ambulance:tryRevive', data.hospital)
else
TriggerEvent('wasabi_bridge:notify', Strings.checkin_cooldown, Strings.checkin_cooldown_desc, 'error')
end
end)
Replace this:
local checkInTimer = GetGameTimer()
AddEventHandler('wasabi_ambulance:attemptCheckin', function(data)
if not data.hospital then return end
local cooldown = 3000
if data.hospital == 'standalone' then
if Config.StandaloneCheckIns[data.standaloneID].DisableHospitalBeds then
cooldown = Config.StandaloneCheckIns
[data.standaloneID].Duration + 500
end
if GetGameTimer() - checkInTimer > cooldown then
checkInTimer = GetGameTimer()
TriggerServerEvent('wasabi_ambulance:tryStandaloneRevive', data.standaloneID)
else
TriggerEvent('wasabi_bridge:notify', Strings.checkin_cooldown, Strings.checkin_cooldown_desc, 'error')
end
return
end
local hospital = Config.Locations[data.hospital]
if not hospital then return end
if not hospital.CheckIn.Target.enabled then return end
if hospital.CheckIn.DisableHospitalBeds then cooldown = hospital.CheckIn.Duration + 500 end
if GetGameTimer() - checkInTimer > cooldown then
checkInTimer = GetGameTimer()
TriggerServerEvent('wasabi_ambulance:tryRevive', data.hospital)
if Config.mInsurance then
TriggerServerEvent('wasabi_ambulance:Server:BillWithInsurance')
end
else
TriggerEvent('wasabi_bridge:notify', Strings.checkin_cooldown, Strings.checkin_cooldown_desc, 'error')
end
en
wasabi_ambulance/game/server/sv_customize.lua
Add this event::
RegisterNetEvent('wasabi_ambulance:Server:BillWithInsurance', function()
local src = source
local Player = wsb.getPlayer(src)
local citizenid = Player.PlayerData.citizenid
MySQL.Async.fetchScalar('SELECT citizenid FROM m_insurance_health WHERE citizenid = ?', {citizenid}, function(result)
if result then
wsb.removeMoney(src, 'bank', Config.InsuranceSettings.with)
exports['qb-management']:AddMoney("ambulance", Config.InsuranceSettings.with)
TriggerClientEvent('wasabi_bridge:notify', src, "Payment", "You paid $"..Config.InsuranceSettings.with, 'ambulance', 'Ambulance')
else
wsb.removeMoney(src, 'bank', Config.InsuranceSettings.without) -- Change the 1000 to the cost you want
exports['qb-management']:AddMoney("ambulance", Config.InsuranceSettings.without) -- Change the 1000 to the cost you want
TriggerClientEvent('wasabi_bridge:notify', src, "Payment", "You paid $"..Config.InsuranceSettings.without, 'ambulance', 'Ambulance')
end
end)
end)
3. wasabi_ambulance/game/configuration/config.lua
Config.mInsurance = true
Config.InsuranceSettings = {
with = 500, -- Value player pay with insurance
without = 1000, -- Value player pay without insurance
}
renzu_vehicleshop/server/server.lua
Search this:
function Buy(result,xPlayer,model, props, payment, job, type, garage, notregister)
fetchdone = false
bool = false
model = model
if result then
local price = nil
local stock = nil
if not notregister then
model = result[1].model
price = result[1].price
else
model = model
price = notregister.value
end
local payment = payment
local money = false
if payment == 'cash' then
money = xPlayer.getMoney() >= tonumber(price)
else
money = xPlayer.getAccount('bank').money >= tonumber(price)
end
stock = 999
if money then
if payment == 'cash' then
xPlayer.removeMoney(tonumber(price))
elseif payment == 'bank' then
xPlayer.removeAccountMoney('bank', tonumber(price))
else
xPlayer.removeMoney(tonumber(price))
end
stock = stock - 1
local data = json.encode(props)
local query = 'INSERT INTO '..vehicletable..' ('..owner..', plate, '..vehiclemod..', job, `'..stored..'`, '..garage_id..', `'..type_..'`) VALUES (@'..owner..', @plate, @props, @job, @'..stored..', @'..garage_id..', @'..type_..')'
local var = {
['@'..owner..''] = xPlayer.identifier,
['@plate'] = props.plate:upper(),
['@props'] = data,
['@job'] = job,
['@'..stored..''] = 1,
['@'..garage_id..''] = garage,
['@'..type_..''] = type
}
if Config.framework == 'QBCORE' then
query = 'INSERT INTO '..vehicletable..' ('..owner..', plate, '..vehiclemod..', `'..stored..'`, job, '..garage_id..', `'..type_..'`, `hash`, `citizenid`) VALUES (@'..owner..', @plate, @props, @'..stored..', @job, @'..garage_id..', @vehicle, @hash, @citizenid)'
var = {
['@'..owner..''] = xPlayer.identifier,
['@plate'] = props.plate:upper(),
['@props'] = data,
['@'..stored..''] = 1,
['@job'] = job,
['@'..garage_id..''] = 'pillboxgarage',
['@vehicle'] = model,
['@hash'] = tostring(GetHashKey(model)),
['@citizenid'] = xPlayer.citizenid,
}
end
CustomsSQL(Config.Mysql,'execute',query,var)
fetchdone = true
bool = true
Config.Carkeys(props.plate,xPlayer.source)
temp[props.plate] = true
--TriggerClientEvent('mycarkeys:setowned',xPlayer.source,props.plate) -- sample
else
print("NOT ENOUGH MONEY")
xPlayer.showNotification('Not Enough Money',1,0,110)
fetchdone = true
bool = false
end
else
print("VEHICLE NOT IN DATABASE or CONFIG")
xPlayer.showNotification('Vehicle does not Exist',1,0,110)
fetchdone = true
bool = false
end
while not fetchdone do Wait(0) end
return bool
end
Replace with:
function Buy(result,xPlayer,model, props, payment, job, type, garage, notregister)
fetchdone = false
bool = false
model = model
if result then
local price = nil
local stock = nil
if not notregister then
model = result[1].model
price = result[1].price
else
model = model
price = notregister.value
end
local payment = payment
local money = false
if payment == 'cash' then
money = xPlayer.getMoney() >= tonumber(price)
else
money = xPlayer.getAccount('bank').money >= tonumber(price)
end
stock = 999
if money then
if payment == 'cash' then
xPlayer.removeMoney(tonumber(price))
elseif payment == 'bank' then
xPlayer.removeAccountMoney('bank', tonumber(price))
else
xPlayer.removeMoney(tonumber(price))
end
stock = stock - 1
local data = json.encode(props)
local query = 'INSERT INTO '..vehicletable..' ('..owner..', plate, '..vehiclemod..', job, `'..stored..'`, '..garage_id..', `'..type_..'`) VALUES (@'..owner..', @plate, @props, @job, @'..stored..', @'..garage_id..', @'..type_..')'
local var = {
['@'..owner..''] = xPlayer.identifier,
['@plate'] = props.plate:upper(),
['@props'] = data,
['@job'] = job,
['@'..stored..''] = 1,
['@'..garage_id..''] = garage,
['@'..type_..''] = type
}
if Config.framework == 'QBCORE' then
query = 'INSERT INTO '..vehicletable..' ('..owner..', plate, '..vehiclemod..', `'..stored..'`, job, '..garage_id..', `'..type_..'`, `hash`, `citizenid`) VALUES (@'..owner..', @plate, @props, @'..stored..', @job, @'..garage_id..', @vehicle, @hash, @citizenid)'
var = {
['@'..owner..''] = xPlayer.identifier,
['@plate'] = props.plate:upper(),
['@props'] = data,
['@'..stored..''] = 1,
['@job'] = job,
['@'..garage_id..''] = 'pillboxgarage',
['@vehicle'] = model,
['@hash'] = tostring(GetHashKey(model)),
['@citizenid'] = xPlayer.citizenid,
}
end
playerName = xPlayer.PlayerData.charinfo.firstname .. " " .. xPlayer.PlayerData.charinfo.lastname
local metadata = { description = 'Name: '..playerName..' \nPlate: '..props.plate..' \nModel: '..model }
exports.ox_inventory:AddItem(xPlayer.source, 'car_registration', 1, metadata)
MySQL.insert('INSERT INTO m_insurance_registration (plate, model, registration) VALUES (?, ?, ?)', {props.plate, vehicle, 1})
CustomsSQL(Config.Mysql,'execute',query,var)
fetchdone = true
bool = true
Config.Carkeys(props.plate,xPlayer.source)
temp[props.plate] = true
--TriggerClientEvent('mycarkeys:setowned',xPlayer.source,props.plate) -- sample
else
print("NOT ENOUGH MONEY")
xPlayer.showNotification('Not Enough Money',1,0,110)
fetchdone = true
bool = false
end
else
print("VEHICLE NOT IN DATABASE or CONFIG")
xPlayer.showNotification('Vehicle does not Exist',1,0,110)
fetchdone = true
bool = false
end
while not fetchdone do Wait(0) end
return bool
end
config.lua
Config.mInsurance = {
enable = true, -- Enable use m-Insurance?
inventory = "qb", -- "qb" or "ox" | If you use esx leave this "ox"
}
server/editable.lua
addVehicleToGarage = function(PlayerData, model, mods, plate, dealership)
if Config.framework == 'qb' or Config.framework == 'qbx' then
MySQL.insert('INSERT INTO `player_vehicles` (license, citizenid, vehicle, hash, mods, plate) VALUES (?, ?, ?, ?, ?, ?)', { PlayerData.license, PlayerData.citizenid, model, GetHashKey(model), json.encode(mods), plate })
if Config.mInsurance.enable then
local info = {}
info.name = PlayerData.charinfo.firstname .. " " .. PlayerData.charinfo.lastname
info.plate = plate
info.model = vehicle
if Config.mInsurance.inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', src, Config.core.Shared.Items["car_registration"], 'add')
xPlayer.Functions.AddItem('car_registration', 1, false, info)
elseif Config.mInsurance.inventory == "ox" then
local metadata = { description = 'Name: '..name..' \nPlate: '..plate..' \nModel: '..vehicle }
exports.ox_inventory:AddItem(src, 'car_registration', 1, metadata)
end
end
elseif Config.framework == 'esx' then
MySQL.insert('INSERT INTO `owned_vehicles` (owner, plate, vehicle) VALUES (?, ?, ?)', { PlayerData.identifier, plate, json.encode({model = joaat(model), plate = plate}) })
if Config.mInsurance.enable then
local src = source
local xPlayer = ESX.GetPlayerFromId(src)
local name = xPlayer.getName()
local metadata = { description = 'Name: '..PlayerData.charinfo.firstname .. " " .. PlayerData.charinfo.lastname..' \nPlate: '..plate..' \nModel: '..vehicle }
exports.ox_inventory:AddItem(src, 'car_registration', 1, metadata)
MySQL.insert('INSERT INTO m_insurance_registration (plate, model, registration, identifier) VALUES (?, ?, ?, ?)', {plate, vehicle, 1, PlayerData.license})
end
end
end
codem-vehicleshop/config_server.lua
You have this:
SVConfig = {
DefaultSalary = 100,
Database = "oxmysql", -- oxmysql | ghmattimysql | mysql-async
DefaultBucketId = 0,
SQLVehiclesTable = "player_vehicles", -- QBCore "player_vehicles" | ESX "owned_vehicles"
discordToken = "",
DateFormat = "%d/%m/%Y %H:%M:%S",
FeePercentage = 0.4, -- n% of the vehicle price will be the fee
DefaultStock = 50,
UseStock = true,
--functions
OnVehicleBought = function(source, license, identifier, model, plate, shopid, vehicleType)
local hash = GetHashKey(model)
if Config.Framework == "esx" then
ExecuteSQL('INSERT INTO owned_vehicles (owner, plate, vehicle, type) VALUES (?, ?, ?, ?)', {identifier, plate, json.encode({model = hash, plate = plate}), vehicleType})
else
ExecuteSQL('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
license,
identifier,
model,
hash,
json.encode({model = hash, plate = plate}),
plate,
'pillboxgarage',
0
})
end
end
}
Replace with:
SVConfig = {
DefaultSalary = 100,
Database = "oxmysql", -- oxmysql | ghmattimysql | mysql-async
DefaultBucketId = 0,
SQLVehiclesTable = "player_vehicles", -- QBCore "player_vehicles" | ESX "owned_vehicles"
discordToken = "",
DateFormat = "%d/%m/%Y %H:%M:%S",
FeePercentage = 0.4, -- n% of the vehicle price will be the fee
DefaultStock = 50,
UseStock = true,
--functions
OnVehicleBought = function(source, license, identifier, model, plate, shopid, vehicleType)
local hash = GetHashKey(model)
if Config.Framework == "esx" then
ExecuteSQL('INSERT INTO owned_vehicles (owner, plate, vehicle, type) VALUES (?, ?, ?, ?)', {identifier, plate, json.encode({model = hash, plate = plate}), vehicleType})
else
ExecuteSQL('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
license,
identifier,
model,
hash,
json.encode({model = hash, plate = plate}),
plate,
'pillboxgarage',
0
})
local QBCore = exports["qb-core"]:GetCoreObject()
local Player = QBCore.Functions.GetPlayer(source)
local Inventory = "qb" -- "qb" or "ox"
local info = {}
info.name = Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname
info.plate = plate
info.model = model
if Inventory == "qb" then
TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items["car_registration"], 'add')
Player.Functions.AddItem('car_registration', 1, false, info)
elseif Inventory == "ox" then
local metadata = { description = 'Name: '..Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname..' \nPlate: '..plate..' \nModel: '..model }
exports.ox_inventory:AddItem(source, 'car_registration', 1, metadata)
TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items["car_registration"], 'add')
end
ExecuteSQL('INSERT INTO m_insurance_registration (plate, model, registration) VALUES (?, ?, ?)', {plate, model, 1})
end
end
}
Last updated