Advertisement
marcinhuUu

m-Investigation/config_functions

Sep 17th, 2022
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. local QBCore = exports[Config.Utility.CoreName]:GetCoreObject()
  2.  
  3. function GiveKeys(veh)
  4. TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(veh))
  5. -- You can change the event to your own give keys trigger
  6. end
  7.  
  8. function TrunkItems(veh)
  9. TriggerServerEvent("inventory:server:addTrunkItems", QBCore.Functions.GetPlate(veh), Config.CarItems)
  10. -- You can change the event to your own add trunk items trigger
  11. end
  12.  
  13. function Fuel(veh)
  14. exports["LegacyFuel"]:SetFuel(veh, 100.0)
  15. -- You can change the event to your own fuel trigger
  16. end
  17.  
  18. function SpawnCar(vehicleInfo)
  19. local coords = Config.SpawnCar
  20. if coords then
  21. QBCore.Functions.SpawnVehicle(vehicleInfo, function(veh)
  22. SetCarItemsInfo()
  23. SetVehicleNumberPlateText(veh, "INVS"..tostring(math.random(1000, 9999)))
  24. SetEntityHeading(veh, coords.w)
  25. Fuel(veh)
  26. TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1)
  27. GiveKeys(veh)
  28. TrunkItems(veh)
  29. SetVehicleEngineOn(veh, true, true)
  30. end, coords, true)
  31. end
  32. end
  33.  
  34. function DeleteCar()
  35. local playerPed = PlayerPedId()
  36. local veh = GetVehiclePedIsIn(playerPed, false)
  37. if veh then
  38. DeleteVehicle(GetVehiclePedIsIn(PlayerPedId()))
  39. end
  40. -- You can change the event to delete cars
  41. end
  42.  
  43. function RepairVehicle()
  44. local playerPed = PlayerPedId()
  45. local veh = GetVehiclePedIsIn(playerPed, false)
  46. if veh then
  47. QBCore.Functions.Progressbar("RepairVehicle", Language["ProgressBars"].Repair, 5000, false, true, {
  48. disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, {}, {}, {},
  49. function()
  50. FreezeEntityPosition(veh, true)
  51. SetVehicleFixed(veh)
  52. SetVehicleEngineHealth(veh, 1000.0)
  53. SetVehicleBodyHealth(veh, 1000.0)
  54. SetVehiclePetrolTankHealth(veh, 1000.0)
  55. SetVehicleDirtLevel(veh, 0)
  56. SetVehicleOnGroundProperly(veh)
  57. FreezeEntityPosition(veh, false)
  58. Notify(Language["Notify"].Repaired, "success", 5000)
  59. end)
  60. end
  61. end
  62.  
  63. function Duty()
  64. TriggerServerEvent("QBCore:ToggleDuty")
  65. -- You can change the event to your duty
  66. end
  67.  
  68. function FadeElevator() -- Animation when you use elevators
  69. DoScreenFadeOut(1000)
  70. Wait(1000)
  71. DoScreenFadeIn(1000)
  72. end
  73.  
  74. function Notify(msg, type)
  75. if type == "primary" then
  76. QBCore.Functions.Notify(msg, "primary")
  77. end
  78. if type == "success" then
  79. QBCore.Functions.Notify(msg, "success")
  80. end
  81. if type == "error" then
  82. QBCore.Functions.Notify(msg, "error")
  83. end
  84. end
  85.  
  86. function DrawText3D(x, y, z, text)
  87. SetTextScale(0.35, 0.35)
  88. SetTextFont(4)
  89. SetTextProportional(1)
  90. SetTextColour(255, 255, 255, 215)
  91. SetTextEntry('STRING')
  92. SetTextCentre(true)
  93. AddTextComponentString(text)
  94. SetDrawOrigin(x,y,z, 0)
  95. DrawText(0.0, 0.0)
  96. local factor = (string.len(text)) / 370
  97. DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75)
  98. ClearDrawOrigin()
  99. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement