QB-RadialMenu
Explore snippets made by the community and developers for you to utilize within TCVS.
Last updated
Was this helpful?
Explore snippets made by the community and developers for you to utilize within TCVS.
Last updated
Was this helpful?
If you are utilizing and want to incorporate impound/garages/insurance through it, then this section will help you incorporate it with written code by Cisoko.
CLIENT-SIDED
First, ensure you comment out the sections highlighted in the provided photo to avoid conflicts. Additionally, insert a Citizen.Wait(1000)
to prevent crashes when entering the PolyZone.
The specified code is located at client/publicGarages.lua
This code needs to be incorporated directly within TCVS, specifically inside the client/publicGarages.lua
file. This addition will introduce two options when entering a garage PolyZone and remove those Public Garages options upon exiting the PolyZone.
RegisterNetEvent('TCVS:client:store')
AddEventHandler('TCVS:client:store', function()
if(globalPlayerVehicle ~= 0)then
local plate = GetVehicleNumberPlateText(globalPlayerVehicle)
plate = string.gsub(plate, " ", "")
local isPlayerInsideGaragePoly, polyType, garageID = exports['realisticVehicleSystem']:IsPlayerInsidePoly()
if(isPlayerInsideGaragePoly and polyType == "garage-public")then
exports['realisticVehicleSystem']:StoreVehicleInGarage(garageID + 10000, plate)
end
end
end)
RegisterNetEvent('TCVS:client:form')
AddEventHandler('TCVS:client:form', function(garageID, owner)
local isPlayerInsideGaragePoly, polyType, garageID = exports['realisticVehicleSystem']:IsPlayerInsidePoly()
if(isPlayerInsideGaragePoly and polyType == "garage-public")then
exports['realisticVehicleSystem']:SetupGarageForm(garageID)
end
end
end)
Citizen.CreateThread(function()
local radialmenu, radialmenu2
while vehicleList == nil or Config == nil do
Citizen.Wait(100)
end
while true do
Citizen.Wait(500)
local isPlayerInsideGaragePoly, polyType, garageID = exports['realisticVehicleSystem']:IsPlayerInsidePoly()
if(isPlayerInsideGaragePoly and polyType == "garage-public")then
if not radialmenu then
radialmenu = exports['qb-radialmenu']:AddOption({
id = 'store_in_garage',
title = 'Store in Garage',
icon = 'car',
type = 'client',
event = 'TCVS:client:store',
shouldClose = true
})
end
if not radialmenu2 then
radialmenu = exports['qb-radialmenu']:AddOption({
id = 'open_garage',
title = 'Open Garage',
icon = 'car',
type = 'client',
event = 'TCVS:client:form',
shouldClose = true
})
end
else
if radialmenu then
exports['qb-radialmenu']:RemoveOption(radialmenu)
radialmenu = nil
end
if radialmenu2 then
exports['qb-radialmenu']:RemoveOption(radialmenu2)
radialmenu2 = nil
end
end
end
end)
CLIENT-SIDED
First, ensure you comment out the sections highlighted in the provided photos to avoid conflicts. Additionally, insert a Citizen.Wait(1000)
to prevent crashes when entering the PolyZone.
The specified code is located at client/impound.lua
This code needs to be incorporated directly within TCVS, specifically inside the client/impound.lua
file. This addition will introduce two options when entering a impound related PolyZone and remove the options upon exiting the PolyZones.
RegisterNetEvent('TCVS:client:impoundLock')
AddEventHandler('TCVS:client:impoundLock', function()
local isPlayerInsideImpoundPoly, polyType = exports['realisticVehicleSystem']:IsPlayerInsidePoly()
if(isPlayerInsideImpoundPoly and polyType == "impound-lock") then
exports['realisticVehicleSystem']:SetupImpoundLockForm(localisedUnlockImpoundID)
end
end)
RegisterNetEvent('TCVS:client:impoundRetrieve')
AddEventHandler('TCVS:client:impoundRetrieve', function()
local isPlayerInsideImpoundPoly, polyType = exports['realisticVehicleSystem']:IsPlayerInsidePoly()
if(isPlayerInsideImpoundPoly and polyType == "impound-retrieve") then
exports['realisticVehicleSystem']:SetupImpoundRetrieveForm(localisedImpoundID)
end
end)
Citizen.CreateThread(function()
local radialmenuImpoundLock, radialmenuImpoundRetrieve
while true do
Citizen.Wait(500)
local isPlayerInsideImpoundLockPoly, polyTypeLock = exports['realisticVehicleSystem']:IsPlayerInsidePoly()
local isPlayerInsideImpoundRetrievePoly, polyTypeRetrieve = exports['realisticVehicleSystem']:IsPlayerInsidePoly()
if(isPlayerInsideImpoundLockPoly and polyTypeLock == "impound-lock") then
if not radialmenuImpoundLock then
radialmenuImpoundLock = exports['qb-radialmenu']:AddOption({
id = 'impound_lock',
title = 'Lock Vehicle',
icon = 'lock',
type = 'client',
event = 'TCVS:client:impoundLock',
shouldClose = true
})
end
else
if radialmenuImpoundLock then
exports['qb-radialmenu']:RemoveOption(radialmenuImpoundLock)
radialmenuImpoundLock = nil
end
end
if(isPlayerInsideImpoundRetrievePoly and polyTypeRetrieve == "impound-retrieve") then
if not radialmenuImpoundRetrieve then
radialmenuImpoundRetrieve = exports['qb-radialmenu']:AddOption({
id = 'impound_retrieve',
title = 'Retrieve Vehicle',
icon = 'car',
type = 'client',
event = 'TCVS:client:impoundRetrieve',
shouldClose = true
})
end
else
if radialmenuImpoundRetrieve then
exports['qb-radialmenu']:RemoveOption(radialmenuImpoundRetrieve)
radialmenuImpoundRetrieve = nil
end
end
end
end)
CLIENT-SIDED
First, ensure you comment out the sections highlighted in the provided photo to avoid conflicts. Additionally, insert a Citizen.Wait(1000)
to prevent crashes when entering the PolyZone.
The specified code is located at client/insurance.lua
This code needs to be incorporated directly within TCVS, specifically inside the client/insurance.lua
file. This addition will introduce the option when entering an insurance PolyZone and remove the options upon exiting the PolyZone.
RegisterNetEvent('TCVS:client:insurance')
AddEventHandler('TCVS:client:insurance', function()
local isPlayerInsideInsurancePoly, polyType = exports['realisticVehicleSystem']:IsPlayerInsidePoly()
if(isPlayerInsideInsurancePoly and polyType == "insurance") then
exports['realisticVehicleSystem']:SetupInsuranceForm(localisedInsuranceID)
end
end)
Citizen.CreateThread(function()
local radialmenuInsurance
while true do
Citizen.Wait(500)
local isPlayerInsideInsurancePoly, polyType = exports['realisticVehicleSystem']:IsPlayerInsidePoly()
if(isPlayerInsideInsurancePoly and polyType == "insurance") then
if not radialmenuInsurance then
radialmenuInsurance = exports['qb-radialmenu']:AddOption({
id = 'insurance',
title = 'Insurance',
icon = 'briefcase-medical',
type = 'client',
event = 'TCVS:client:insurance',
shouldClose = true
})
end
else
if radialmenuInsurance then
exports['qb-radialmenu']:RemoveOption(radialmenuInsurance)
radialmenuInsurance = nil
end
end
end
end)