Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local QBCore = exports[Config.Utility.CoreName]:GetCoreObject()
- function GiveKeys(veh)
- TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(veh))
- -- You can change the event to your own give keys trigger
- end
- function TrunkItems(veh)
- TriggerServerEvent("inventory:server:addTrunkItems", QBCore.Functions.GetPlate(veh), Config.CarItems)
- -- You can change the event to your own add trunk items trigger
- end
- function Fuel(veh)
- exports["LegacyFuel"]:SetFuel(veh, 100.0)
- -- You can change the event to your own fuel trigger
- end
- function SpawnCar(vehicleInfo)
- local coords = Config.SpawnCar
- if coords then
- QBCore.Functions.SpawnVehicle(vehicleInfo, function(veh)
- SetCarItemsInfo()
- SetVehicleNumberPlateText(veh, "INVS"..tostring(math.random(1000, 9999)))
- SetEntityHeading(veh, coords.w)
- Fuel(veh)
- TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1)
- GiveKeys(veh)
- TrunkItems(veh)
- SetVehicleEngineOn(veh, true, true)
- end, coords, true)
- end
- end
- function DeleteCar()
- local playerPed = PlayerPedId()
- local veh = GetVehiclePedIsIn(playerPed, false)
- if veh then
- DeleteVehicle(GetVehiclePedIsIn(PlayerPedId()))
- end
- -- You can change the event to delete cars
- end
- function RepairVehicle()
- local playerPed = PlayerPedId()
- local veh = GetVehiclePedIsIn(playerPed, false)
- if veh then
- QBCore.Functions.Progressbar("RepairVehicle", Language["ProgressBars"].Repair, 5000, false, true, {
- disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, {}, {}, {},
- function()
- FreezeEntityPosition(veh, true)
- SetVehicleFixed(veh)
- SetVehicleEngineHealth(veh, 1000.0)
- SetVehicleBodyHealth(veh, 1000.0)
- SetVehiclePetrolTankHealth(veh, 1000.0)
- SetVehicleDirtLevel(veh, 0)
- SetVehicleOnGroundProperly(veh)
- FreezeEntityPosition(veh, false)
- Notify(Language["Notify"].Repaired, "success", 5000)
- end)
- end
- end
- function Duty()
- TriggerServerEvent("QBCore:ToggleDuty")
- -- You can change the event to your duty
- end
- function FadeElevator() -- Animation when you use elevators
- DoScreenFadeOut(1000)
- Wait(1000)
- DoScreenFadeIn(1000)
- end
- function Notify(msg, type)
- if type == "primary" then
- QBCore.Functions.Notify(msg, "primary")
- end
- if type == "success" then
- QBCore.Functions.Notify(msg, "success")
- end
- if type == "error" then
- QBCore.Functions.Notify(msg, "error")
- end
- end
- function DrawText3D(x, y, z, text)
- SetTextScale(0.35, 0.35)
- SetTextFont(4)
- SetTextProportional(1)
- SetTextColour(255, 255, 255, 215)
- SetTextEntry('STRING')
- SetTextCentre(true)
- AddTextComponentString(text)
- SetDrawOrigin(x,y,z, 0)
- DrawText(0.0, 0.0)
- local factor = (string.len(text)) / 370
- DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75)
- ClearDrawOrigin()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement