1
0
Fork 0
forked from Simnation/Main
Main/resources/[carscripts]/fh_detailer/functions.lua
2025-07-09 15:06:30 +02:00

260 lines
No EOL
7.9 KiB
Lua

-- This is for notifications when all goes according to plan. (i.e. vehicle is cleaned)
RegisterNetEvent("fh_detailer:client:InfoNotification", function(notificationText)
-- You can change this to your prefered notification System --
--exports['mythic_notify']:DoHudText('inform', notificationText)
--exports['okokNotify']:Alert('Detailer', notificationText, Time, 'info', false)
end)
-- This is for notifications when something goes wrong. (i.e. you don't have money)
RegisterNetEvent("fh_detailer:client:WarningNotification", function(notificationText)
-- You can change this to your prefered notification System --
--exports['mythic_notify']:DoHudText('error', notificationText)
--exports['okokNotify']:Alert('Detailer', notificationText, Time, 'error', false)
end)
-- You can add stuff you want to happen when the car is completely cleaned here. E. g. getting rid of evidence fingerprints and such.
RegisterNetEvent("fh_detailer:client:vehicleCleaned", function(licensePlate, vehicleServerID)
print('Vehicle cleaned: licensePlate ' .. licensePlate .. ' vehicleServerID ' .. vehicleServerID)
end)
-- Function for removing decals (dirt, scratches, blood). This can remove stickers if you are using such a script.
-- You can disable the removal of the decals or add you custom code here:
RegisterNetEvent("fh_detailer:client:removeDecals", function(vehicle)
RemoveDecalsFromVehicle(vehicle)
end)
-- ox-target / qb-target exports here
if not Config.qbtarget then
exports.ox_target:addGlobalVehicle({
event = 'washVehicle',
icon = 'fa-solid fa-soap',
label = Lang:t("info.wash_vehicle"),
canInteract = function(entity, distance, coords, name)
if holdingBucket then makeEntityFaceEntity(playerPed, entity) end
return holdingBucket and not IsPedBusy()
end,
distance = Config.WashDistance,
})
else
exports['qb-target']:AddGlobalVehicle({
options = {
{
type = 'client',
event = 'washVehicle',
icon = 'fa-solid fa-soap',
label = Lang:t("info.wash_vehicle"),
canInteract = function(entity, distance, data)
if holdingBucket then makeEntityFaceEntity(playerPed, entity) end
return holdingBucket and not IsPedBusy()
end,
}
},
distance = Config.WashDistance,
})
end
if Config.JobRestriction then
if not Config.qbtarget then
exports.ox_target:addModel(GetHashKey(Config.HoseModel),
{
event = 'takeHose',
icon = 'fa-solid fa-soap',
label = Lang:t("info.take_hose"),
groups = Config.AllowedJobs,
}
)
exports.ox_target:addModel(GetHashKey(Config.BucketModel),
{
event = 'UseBucket',
icon = 'fa-solid fa-soap',
label = Lang:t("info.label_bucket"),
groups = Config.AllowedJobs,
}
)
exports.ox_target:addGlobalVehicle({
event = 'waxVehicle',
icon = 'fa-solid fa-soap',
label = Lang:t("info.wax_vehicle"),
item = {'car_wax'},
anyItem = true,
canInteract = function(entity, distance, coords, name)
if not holdingBucket and not holdingHose and not IsPedBusy() then
makeEntityFaceEntity(playerPed, entity)
return true
end
end,
groups = Config.AllowedJobs,
distance = Config.WashDistance,
})
else
exports['qb-target']:AddTargetModel(Config.HoseModel, {
options = {
{
type = "client",
event = 'takeHose',
icon = 'fa-solid fa-soap',
label = Lang:t("info.take_hose"),
job = Config.AllowedJobs,
}
},
})
exports['qb-target']:AddTargetModel(Config.BucketModel, {
options = {
{
type = "client",
event = 'UseBucket',
icon = 'fa-solid fa-soap',
label = Lang:t("info.label_bucket"),
job = Config.AllowedJobs,
}
},
})
end
exports['qb-target']:AddGlobalVehicle({
options = {
{
type = 'client',
event = 'waxVehicle',
icon = 'fa-solid fa-soap',
label = Lang:t("info.wax_vehicle"),
canInteract = function(entity, distance, data)
if not holdingBucket and not holdingHose and not IsPedBusy() then
makeEntityFaceEntity(playerPed, entity)
return true
end
end,
job = Config.AllowedJobs,
}
},
distance = Config.WashDistance,
})
else
if not Config.qbtarget then
exports.ox_target:addGlobalVehicle({
event = 'waxVehicle',
icon = 'fa-solid fa-soap',
label = Lang:t("info.wax_vehicle"),
item = {'car_wax'},
anyItem = true,
canInteract = function(entity, distance, coords, name)
if not holdingBucket and not holdingHose and not IsPedBusy() then
makeEntityFaceEntity(playerPed, entity)
return true
end
end,
distance = Config.WashDistance,
})
exports.ox_target:addModel(GetHashKey(Config.HoseModel),
{
event = 'takeHose',
icon = 'fa-solid fa-soap',
label = Lang:t("info.take_hose"),
})
exports.ox_target:addModel(GetHashKey(Config.BucketModel),
{
event = 'UseBucket',
icon = 'fa-solid fa-soap',
label = Lang:t("info.label_bucket"),
})
else
exports['qb-target']:AddTargetModel(Config.HoseModel, {
options = {
{
type = "client",
event = 'takeHose',
icon = 'fa-solid fa-soap',
label = Lang:t("info.take_hose"),
}
},
})
exports['qb-target']:AddTargetModel(Config.BucketModel, {
options = {
{
type = "client",
event = 'UseBucket',
icon = 'fa-solid fa-soap',
label = Lang:t("info.label_bucket"),
}
},
})
exports['qb-target']:AddGlobalVehicle({
options = {
{
type = 'client',
event = 'waxVehicle',
icon = 'fa-solid fa-soap',
label = Lang:t("info.wax_vehicle"),
canInteract = function(entity, distance, data)
if not holdingBucket and not holdingHose and not IsPedBusy() then
makeEntityFaceEntity(playerPed, entity)
return true
end
end,
}
},
distance = Config.WashDistance,
})
end
end
if not Config.qbtarget then
exports.ox_target:addModel(GetHashKey(Config.HoseModel2),
{
event = 'takeHose',
icon = 'fa-solid fa-soap',
label = Lang:t("info.take_hose"),
}
)
exports.ox_target:addModel(GetHashKey(Config.BucketModel2),
{
event = 'UseBucket',
icon = 'fa-solid fa-soap',
label = Lang:t("info.label_bucket"),
}
)
else
exports['qb-target']:AddTargetModel(Config.HoseModel2, {
options = {
{
type = "client",
event = 'takeHose',
icon = 'fa-solid fa-soap',
label = Lang:t("info.take_hose"),
}
},
})
exports['qb-target']:AddTargetModel(Config.BucketModel2, {
options = {
{
type = "client",
event = 'takeHose',
icon = 'fa-solid fa-soap',
label = Lang:t("info.take_hose"),
}
},
})
end
-- End of ox-target / qb-target exports