Setting up the client side handlers and functions
There are multiple examples shown in the config, and it is already prepared to ESX frameworks using OX Lib and OX Inventory
AddEventHandler('fusti_vehicleshop:onEnter', function() -- called when the player is entered into the shop
ExecuteCommand('hud')
DisplayRadar(false)
exports.ox_target:disableTargeting(true) -- optional
end)
AddEventHandler('fusti_vehicleshop:onExit', function() -- called when the player is exited from the shop
ExecuteCommand('hud')
DisplayRadar(true)
exports.ox_target:disableTargeting(false) -- optional
end)
AddEventHandler('fusti_vehicleshop:onPurchase', function(data) -- called when the player successfully bought a vehicle
local title = 'Information'
local description = 'You have successfully purchased your vehicle for %s%s! (%s - %s)'
lib.notify({
title = title,
description = description:format(data.price, data.currency, data.name, data.properties.plate),
type = 'inform',
position = 'top',
icon = 'fas fa-car',
time = 3000
})
-- ESX.ShowNotification(description:format(data.price, data.currency, data.vehicleName, data.plate), 'info', 3000)
-- QBCore.Functions.Notify(description:format(data.price, data.currency, data.vehicleName, data.plate), 'info', 3000)
end)
Config.getVehicleProperties = function(entity) -- here you can use your framework's function as you like
return lib.getVehicleProperties(entity) -- QBCore.Functions.GetVehicleProperties(entity) // ESX.Game.GetVehicleProperties(entity)
end
Last updated
Was this helpful?