Advertisement
Guest User

Untitled

a guest
Jun 1st, 2019
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.61 KB | None | 0 0
  1. local Keys = {
  2. ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  3. ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  4. ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  5. ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  6. ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  7. ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  8. ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  9. ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  10. ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  11. }
  12.  
  13. ---esx
  14. local ESX = nil
  15. local PlayerData = {}
  16.  
  17. ---custom scripts
  18. local cardOpen = false
  19. local snoing = 0
  20. local hasHandcuffs = false
  21. local hasNyckel = false
  22. local hasBlindfold = false
  23. local hasDyrkset = false
  24. local hasBulletproof = false
  25.  
  26.  
  27. -- Servern callback
  28. RegisterNetEvent('jsfour-legitimation:open')
  29. AddEventHandler('jsfour-legitimation:open', function(playerData)
  30. cardOpen = true
  31. SendNUIMessage({
  32. action = "open",
  33. array = playerData
  34. })
  35. end)
  36.  
  37. -- Funktioner
  38. function GetPed() return GetPlayerPed(-1) end
  39. function GetCar() return GetVehiclePedIsIn(GetPlayerPed(-1),false) end
  40.  
  41.  
  42. local isSearching = false
  43. local isBlindfolded = false
  44. local hasEquipped = false
  45. local isDead = false
  46. local playerCars = {}
  47. -- ESX
  48. Citizen.CreateThread(function()
  49. while ESX == nil do
  50. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  51. Citizen.Wait(0)
  52. end
  53. end)
  54.  
  55. RegisterNetEvent('esx:setJob')
  56. AddEventHandler('esx:setJob', function(job)
  57. PlayerData.job = job
  58. end)
  59.  
  60. --för att öppna menyn i andra scripts TriggerEvent('esx_qalle:openMenu')
  61. RegisterNetEvent('esx_qalle:openMenu')
  62. AddEventHandler('esx_qalle:openMenu', function()
  63. openMenu()
  64. end)
  65.  
  66. AddEventHandler('esx:onPlayerDeath', function(data)
  67. isDead = true
  68. end)
  69.  
  70. AddEventHandler('playerSpawned', function(spawn)
  71. isDead = false
  72. end)
  73.  
  74. Citizen.CreateThread(function()
  75. while true do
  76. Citizen.Wait(0)
  77. if IsControlPressed(0, Keys['F9']) and GetEntityHealth() <= 101 then
  78. ClearPedTasksImmediately(GetPlayerPed(-1))
  79. end
  80. end
  81. end)
  82.  
  83. function ShowBillsMenu()
  84. ESX.TriggerServerCallback('esx_billing:getBills', function(bills)
  85. local elements = {}
  86.  
  87. for i=1, #bills, 1 do
  88. table.insert(elements, {label = bills[i].label .. ' ' .. bills[i].amount .. ' SEK', value = bills[i].id})
  89. end
  90.  
  91. ESX.UI.Menu.Open(
  92. 'default', GetCurrentResourceName(), 'billing',
  93. {
  94. title = ('Fakturor'),
  95. align = 'bottom-right',
  96. elements = elements
  97. },
  98. function(data, menu)
  99.  
  100. menu.close()
  101.  
  102. local billId = data.current.value
  103.  
  104. ESX.TriggerServerCallback('esx_billing:payBill', function()
  105. ShowBillsMenu()
  106. end, billId)
  107.  
  108. end,
  109. function(data, menu)
  110. menu.close()
  111. end
  112. )
  113. end)
  114. end
  115.  
  116. --- meny f5
  117. function openMenu()
  118. ESX.UI.Menu.CloseAll()
  119.  
  120. ESX.UI.Menu.Open(
  121. 'default', GetCurrentResourceName(), 'f3_menu',
  122. {
  123. title = 'Personliga Meny',
  124. align = 'top-right',
  125. elements = {
  126. {label = 'Person-Handlingar', value = 'id-card'},
  127. {label = 'Individ-Åtgärder', value = 'citizen'},
  128. {label = 'Fordons-meny', value = 'vehiclemenu'},
  129. {label = 'Fakturor', value = 'my_bills'},
  130. {label = 'Animationer', value = 'animations'},
  131. {label = 'Accessoarer', value = 'mask'},
  132. {label = 'Företags-Meny', value = 'test'},
  133. }
  134. },
  135. function(data, menu)
  136. if data.current.value == 'animations' then
  137. TriggerEvent("esx_animations")
  138. elseif data.current.value == 'pee' then
  139. TriggerEvent('pee')
  140. elseif data.current.value == 'my_bills' then
  141. ShowBillsMenu()
  142. elseif data.current.value == 'vehiclemenu' then
  143. openVehicleMenu()
  144. elseif data.current.value == 'poop' then
  145. TriggerEvent('poop')
  146. elseif data.current.value == 'id-card' then
  147. ESX.UI.Menu.Open(
  148. 'default', GetCurrentResourceName(), 'id_card_menu',
  149. {
  150. title = 'Identitet',
  151. align = 'top-right',
  152. elements = {
  153. --{label = 'Arbete: ' .. PlayerData.job.label .. ' - ' .. PlayerData.job.grade_label, value = 'work'},
  154. --{label = 'Mina nycklar', value = 'keys'},
  155. {label = 'Kolla på ditt ID', value = 'checkID'},
  156. {label = 'Visa ditt ID', value = 'showID'},
  157. {label = 'Kolla på ditt Körkort', value = 'checkDriver'},
  158. {label = 'Visa ditt Körkort', value = 'showDriver'},
  159.  
  160. --{label = 'Mina körkort', value = 'korkort'},
  161. --{label = 'Mina nycklar', value = 'keys'}
  162. -- {label = 'Telefon AV/PÅ', value = 'phone'}
  163. }
  164. },
  165.  
  166. function(data2, menu2)
  167. if data2.current.value == 'checkID' then
  168. TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))
  169. elseif data2.current.value == 'showID' then
  170. local player, distance = ESX.Game.GetClosestPlayer()
  171.  
  172. if distance ~= -1 and distance <= 3.0 then
  173. TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
  174. ESX.ShowNotification('du visar ditt id')
  175. else
  176. ESX.ShowNotification('Ingen i närheten')
  177. end
  178. end
  179. if data2.current.value == 'checkDriver' then
  180. TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver')
  181. elseif data2.current.value == 'showDriver' then
  182. local player, distance = ESX.Game.GetClosestPlayer()
  183.  
  184. if distance ~= -1 and distance <= 3.0 then
  185. TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver')
  186. ESX.ShowNotification('du visar ditt körkort')
  187. else
  188. ESX.ShowNotification('Ingen i närheten')
  189. end
  190. end
  191. end,
  192. function(data2, menu2)
  193. menu2.close()
  194. end
  195. )
  196. elseif data.current.value == 'mask' then
  197. ESX.UI.Menu.Open(
  198.  
  199. 'default', GetCurrentResourceName(), 'asccesories_menu',
  200. {
  201. title = 'Accessoarer',
  202. align = 'top-right',
  203. elements = {
  204. {label = 'Huvudbonad PÅ/AV', value = 'Helmet'},
  205. {label = 'Glasögon PÅ/AV', value = 'Glasses'},
  206. {label = 'Mask PÅ/AV', value = 'Mask'}
  207. }
  208. },
  209. function(data2, menu2)
  210.  
  211. if data2.current.value == 'Helmet' then
  212. menu2.close()
  213. SetUnsetAccessory(data2.current.value)
  214. end
  215.  
  216. if data2.current.value == 'Ears' then
  217. menu2.close()
  218. SetUnsetAccessory(data2.current.value)
  219. end
  220.  
  221. if data2.current.value == 'Glasses' then
  222. menu2.close()
  223. SetUnsetAccessory(data2.current.value)
  224. end
  225.  
  226. if data2.current.value == 'Watches' then
  227. menu2.close()
  228. SetUnsetAccessory(data2.current.value)
  229. end
  230.  
  231. if data2.current.value == 'bulletproof' then
  232. if hasBulletproof and not hasEquipped then
  233. menu2.close()
  234. TriggerEvent('esx_qalle:bulletproof')
  235. hasEquipped = true
  236. elseif hasEquipped then
  237. TriggerEvent('esx_qalle:bulletproofoff')
  238. hasEquipped = false
  239. else
  240. sendNotification('Du har ingen Skottsäkervest', 'error', 2500)
  241. end
  242. end
  243.  
  244. if data2.current.value == 'Mask' then
  245. menu2.close()
  246. SetUnsetAccessory(data2.current.value)
  247. end
  248.  
  249.  
  250. end,
  251. function(data2, menu2)
  252. menu2.close()
  253. end
  254. )
  255. elseif data.current.value == 'citizen' then
  256. ESX.UI.Menu.Open(
  257.  
  258. 'default', GetCurrentResourceName(), 'citizen_menu',
  259. {
  260. title = 'Individåtgärder',
  261. align = 'top-right',
  262. elements = {
  263. {label = 'Genomsök närmsta person', value = 'search'},
  264. {label = ('Sätt PÅ/AV Buntband'), value = 'handcuff'},
  265. {label = ('Bär närmsta person'), value = 'drag'},
  266. }
  267. },
  268. function(data2, menu2)
  269.  
  270. if data2.current.value == 'blind' then
  271. local player, distance = ESX.Game.GetClosestPlayer()
  272. if distance ~= -1 and distance <= 3.0 then
  273. ESX.TriggerServerCallback('blindfold:itemCheck', function( hasItem )
  274. TriggerServerEvent('blindfold', GetPlayerServerId(player), hasItem)
  275. end)
  276. else
  277. sendNotification('Ingen person nära', 'error', 2500)
  278. end
  279. elseif data2.current.value == 'search' then
  280. local player, distance = ESX.Game.GetClosestPlayer()
  281. local target, distance = ESX.Game.GetClosestPlayer()
  282.  
  283. if distance ~= -1 and distance <= 3.0 then
  284. --- kollar ifall spelaren håller upp händerna eller cuffad eller död.
  285. if IsEntityPlayingAnim(GetPlayerPed(player), "random@mugging3", "handsup_standing_base", 3) or IsEntityPlayingAnim(GetPlayerPed(player), "mp_arresting", "idle", 3) or IsPedDeadOrDying(GetPlayerPed(player)) then
  286. OpenBodySearchMenu(target)
  287. end
  288. --- kollar ifall spelaren inte håller upp händerna
  289. if not IsEntityPlayingAnim(GetPlayerPed(player), "random@mugging3", "handsup_standing_base", 3) then
  290. sendNotification('Personen håller inte upp händerna', 'error', 2500)
  291. end
  292. else
  293. sendNotification('Ingen person nära', 'error', 2500)
  294. end
  295.  
  296. elseif data2.current.value == 'handcuff' then
  297. local player, distance = ESX.Game.GetClosestPlayer()
  298.  
  299. if distance ~= -1 and distance <= 3.0 then
  300. if hasHandcuffs then
  301. TriggerServerEvent('esx_qalle:removeInventoryItem','buntband', 1)
  302. TriggerServerEvent('esx_policejob:handcuff', GetPlayerServerId(player))
  303. else
  304. sendNotification('Du har inga buntband', 'error', 2500)
  305. end
  306. else
  307. sendNotification('Ingen person nära', 'error', 2500)
  308. end
  309.  
  310. elseif data2.current.value == 'drag' then
  311.  
  312. local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  313. if closestPlayer == -1 or closestDistance > 4.0 then
  314. ESX.ShowNotification(_U('no_players'))
  315. else
  316. RequestAnimDict('anim@heists@load_box')
  317. while not HasAnimDictLoaded('anim@heists@load_box') do
  318. Wait(1)
  319. end
  320. TaskPlayAnim(GetPlayerPed(-1), 'anim@heists@load_box', 'idle', 8.0, -8, -1, 49, 0, 0, 0, 0)
  321. Citizen.Wait(500)
  322. TriggerServerEvent('esx_ambulancejob:drag', GetPlayerServerId(closestPlayer))
  323. end
  324.  
  325.  
  326.  
  327. elseif data2.current.value == 'death' then
  328. TriggerEvent('esx_damage:check')
  329. end
  330.  
  331. if data2.current.value == 'Mask' then
  332. menu2.close()
  333. SetUnsetAccessory(data2.current.value)
  334. end
  335.  
  336.  
  337. end,
  338. function(data2, menu2)
  339. menu2.close()
  340. end
  341. )
  342.  
  343. elseif data.current.value == 'vehicle' then
  344. ESX.UI.Menu.Open(
  345.  
  346. 'default', GetCurrentResourceName(), 'vehicle_menu',
  347. {
  348. title = 'Fordonåtgärder',
  349. align = 'top-right',
  350. elements = {
  351. {label = 'Lås / Lås upp', value = 'lock'},
  352. {label = 'Stäng av motor', value = 'engine'},
  353. {label = 'Motorhuven', value = 'door_f'},
  354. {label = 'Bakluckan', value = 'door_f2'},
  355. {label = 'Bakdörrarna', value = 'door_f3'},
  356. {label = 'Framdörrarna', value = 'door_f4'},
  357. {label = 'Farthållare', value = 'hastighet'},
  358. }
  359. },
  360. function(data2, menu2)
  361.  
  362. if data.current.value == 'lock' then
  363. OpenCloseVehicle()
  364. end
  365.  
  366. if data2.current.value == 'engine' then
  367. TriggerEvent("engine")
  368. end
  369.  
  370. if data2.current.value == 'door_f' then
  371. TriggerEvent("hood")
  372. end
  373.  
  374. if data2.current.value == 'door_f2' then
  375. TriggerEvent("trunk")
  376. end
  377.  
  378. if data2.current.value == 'door_f3' then
  379. TriggerEvent("rdoors")
  380. end
  381.  
  382. if data2.current.value == 'door_f4' then
  383. TriggerEvent("fdoors")
  384. end
  385.  
  386. if data2.current.value == 'hastighet' then
  387. ESX.UI.Menu.Open(
  388.  
  389. 'default', GetCurrentResourceName(), 'citizen_menu',
  390. {
  391. title = 'Lås Hastighetsmeny',
  392. elements = {
  393. {label = '40', value = '40'},
  394. {label = '60', value = '60'},
  395. {label = '80', value = '80'},
  396. {label = ('100'), value = '100'},
  397. {label = ('120'), value = '120'},
  398. {label = ('Återställ din farthållare'), value = '0'}
  399. }
  400. },
  401. function(data2, menu2)
  402. if data2.current.value == '0' then
  403. local veh = GetVehiclePedIsIn(GetPlayerPed(-1), false)
  404. SetEntityMaxSpeed(veh, 10000/3.65)
  405. else
  406. local veh = GetVehiclePedIsIn(GetPlayerPed(-1), false)
  407. SetEntityMaxSpeed(veh, data2.current.value/3.65)
  408. end
  409.  
  410.  
  411.  
  412. end,
  413. function(data2, menu2)
  414. menu2.close()
  415. end
  416. )
  417. end
  418.  
  419.  
  420. end,
  421. function(data2, menu2)
  422. menu2.close()
  423. end
  424. )
  425. elseif data.current.value == 'test' and PlayerData.job.grade_name == 'boss' then
  426. ESX.UI.Menu.Open(
  427.  
  428. 'default', GetCurrentResourceName(), 'boss_menu',
  429. {
  430. title = 'Direktör meny',
  431. align = 'top-right',
  432. elements = {
  433. {label = 'Företagskassa', value = 'society_money'},
  434. {label = 'Anställ (Närmsta Spelare)', value = 'recruit_player'},
  435. {label = 'Sparka (Närmsta Spelare)', value = 'kick_player'},
  436. {label = 'Höj Position (Närmsta Spelare)', value = 'promote_player'},
  437. {label = 'Sänk Position (Närmsta Spelare)', value = 'demote_player'}
  438. }
  439. },
  440. function(data2, menu2)
  441.  
  442. if data2.current.value == 'society_money' then
  443. money = nil
  444. ESX.TriggerServerCallback('esx_society:getSocietyMoney', function(money)
  445. sendNotification('Ditt företag ligger just nu på ' .. money .. ' SEK', 'success', 5500)
  446. end, PlayerData.job.name)
  447. end
  448.  
  449. if data2.current.value == 'recruit_player' then
  450. if PlayerData.job.grade_name == 'boss' then
  451. local job = PlayerData.job.name
  452. local grade = 0
  453. local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  454. if closestPlayer == -1 or closestDistance > 3.0 then
  455. sendNotification('Ingen person nära', 'error', 2500)
  456. else
  457. TriggerServerEvent('esx_qalle:recruit_player', GetPlayerServerId(closestPlayer), job,grade)
  458. end
  459. else
  460. sendNotification('Du har inte rättigheterna', 'error', 2500)
  461. end
  462. end
  463.  
  464. if data2.current.value == 'kick_player' then
  465. if PlayerData.job.grade_name == 'boss' then
  466. local job = PlayerData.job.name
  467. local grade = 0
  468. local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  469. if closestPlayer == -1 or closestDistance > 3.0 then
  470. sendNotification('Ingen person nära', 'error', 2500)
  471. else
  472. TriggerServerEvent('esx_qalle:kick_player', GetPlayerServerId(closestPlayer))
  473. end
  474. else
  475. sendNotification('Du har inte rättigheterna', 'error', 2500)
  476. end
  477. end
  478.  
  479.  
  480. if data2.current.value == 'promote_player' then
  481. if PlayerData.job.grade_name == 'boss' then
  482. local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  483. if closestPlayer == -1 or closestDistance > 3.0 then
  484. sendNotification('Ingen person nära', 'error', 2500)
  485. else
  486. TriggerServerEvent('esx_qalle:promote_player', GetPlayerServerId(closestPlayer))
  487. end
  488. else
  489. sendNotification('Du har inte rättigheterna', 'error', 2500)
  490. end
  491. end
  492.  
  493. if data2.current.value == 'demote_player' then
  494. if PlayerData.job.grade_name == 'boss' then
  495. local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  496. if closestPlayer == -1 or closestDistance > 3.0 then
  497. sendNotification('Ingen person nära', 'error', 2500)
  498. else
  499. TriggerServerEvent('esx_qalle:demote_player', GetPlayerServerId(closestPlayer))
  500. end
  501. else
  502. sendNotification('Du har inte rättigheterna', 'error', 2500)
  503. end
  504. end
  505.  
  506. end,
  507. function(data2, menu2)
  508. menu2.close()
  509. end
  510. )
  511. elseif data.current.value == 'material' then
  512.  
  513. end
  514.  
  515. end,
  516. function(data, menu)
  517. menu.close()
  518. end
  519. )
  520. end
  521.  
  522. ---sökigenommeny
  523. function OpenBodySearchMenu(player)
  524.  
  525. ESX.TriggerServerCallback('esx_qalle:getOtherPlayerData', function(data)
  526.  
  527. local elements = {}
  528.  
  529. table.insert(elements, {label = '--- Nycklar ---', value = nil})
  530.  
  531.  
  532. --[[if data.nycklar ~= nil then
  533. for i=1, #data.nycklar, 1 do
  534. table.insert(elements, {label = 'Nyckel #' ..data.nycklar[i].kU.. ' ' ..data.nycklar[i].kN, keyName = data.nycklar[i].kN, keyUnit = data.nycklar[i].kU, action = 'take_key'})
  535. end
  536. end]]
  537.  
  538. for i=1, #data.data.inventory, 1 do
  539. if data.data.inventory[i].count > 0 and data.data.inventory[i].name == 'policecard' then
  540. table.insert(elements, {
  541. label = 'Polis Nyckel #' ..math.random(1,10),
  542. value = data.data.inventory[i].name,
  543. itemType = 'item_standard',
  544. amount = data.data.inventory[i].count,
  545. })
  546.  
  547. end
  548. end
  549.  
  550.  
  551. local blackMoney = 0
  552.  
  553. for i=1, #data.data.accounts, 1 do
  554. if data.data.accounts[i].name == 'black_money' then
  555. blackMoney = data.data.accounts[i].money
  556. end
  557. end
  558.  
  559. table.insert(elements, {label = '--- Pengar ---', value = nil})
  560.  
  561. table.insert(elements, {
  562. label = 'Konfiskera Kontanter: ' .. data.data.money .. ' SEK',
  563. value = 'money',
  564. itemType = 'item_money',
  565. amount = data.data.money,
  566. })
  567.  
  568.  
  569. table.insert(elements, {
  570. label = 'Konfiskera Svarta: ' .. blackMoney .. ' SEK',
  571. value = 'black_money',
  572. itemType = 'item_account',
  573. amount = blackMoney
  574. })
  575.  
  576. table.insert(elements, {label = '--- Vapen ---', value = nil})
  577.  
  578. for i=1, #data.data.weapons, 1 do
  579. table.insert(elements, {
  580. label = 'Konfiskera: ' .. ESX.GetWeaponLabel(data.data.weapons[i].name),
  581. value = data.data.weapons[i].name,
  582. itemType = 'item_weapon',
  583. amount = data.data.ammo,
  584. })
  585. end
  586.  
  587. table.insert(elements, {label = '--- Föremål ---', value = nil})
  588.  
  589. for i=1, #data.data.inventory, 1 do
  590. if data.data.inventory[i].count > 0 and data.data.inventory[i].name ~= 'policecard' then
  591. table.insert(elements, {
  592. label = 'Konfiskera: ' .. data.data.inventory[i].count .. 'st ' .. data.data.inventory[i].label,
  593. value = data.data.inventory[i].name,
  594. itemType = 'item_standard',
  595. amount = data.data.inventory[i].count,
  596. })
  597.  
  598. end
  599. end
  600.  
  601.  
  602. ESX.UI.Menu.Open(
  603. 'default', GetCurrentResourceName(), 'body_search',
  604. {
  605. title = 'Söker individ',
  606. align = 'top-right',
  607. elements = elements,
  608. },
  609. function(data, menu)
  610.  
  611. local itemType = data.current.itemType
  612. local itemName = data.current.value
  613. local amount = data.current.amount
  614.  
  615. if data.current.value ~= nil then
  616. local player, distance = ESX.Game.GetClosestPlayer()
  617. if snoing == 0 then
  618. snoing = 1
  619.  
  620. RequestAnimDict("amb@medic@standing@kneel@exit")
  621. RequestAnimDict("anim@gangops@facility@servers@bodysearch@")
  622. RequestAnimDict("amb@medic@standing@kneel@base")
  623. while not HasAnimDictLoaded("amb@medic@standing@kneel@exit") do
  624. Citizen.Wait(0)
  625. end
  626. while not HasAnimDictLoaded("anim@gangops@facility@servers@bodysearch@") do
  627. Citizen.Wait(0)
  628. end
  629. while not HasAnimDictLoaded("amb@medic@standing@kneel@base") do
  630. Citizen.Wait(0)
  631. end
  632. if IsEntityDead(GetPlayerPed(player)) then
  633. TaskPlayAnim(GetPlayerPed(-1), "amb@medic@standing@kneel@base" ,"base" ,8.0, -8.0, -1, 1, 0, false, false, false )
  634. end
  635. TaskPlayAnim(GetPlayerPed(-1), "anim@gangops@facility@servers@bodysearch@" ,"player_search" ,8.0, -8.0, -1, 48, 0, false, false, false )
  636. Citizen.Wait(6200)
  637. snoing = 0
  638. local target, distance = ESX.Game.GetClosestPlayer()
  639. if IsEntityPlayingAnim(GetPlayerPed(-1), "anim@gangops@facility@servers@bodysearch@" ,"player_search", 3) and distance ~= -1 and distance <= 3.0 then
  640. TriggerServerEvent('esx_qalle:confiscatePlayerItem', GetPlayerServerId(target), itemType, itemName, amount)
  641. OpenBodySearchMenu(player)
  642. Citizen.Wait(800)
  643. else
  644. menu.close()
  645. sendNotification('Personen är för långt bort', 'error', 2500)
  646. end
  647. if IsEntityPlayingAnim(GetPlayerPed(-1), "amb@medic@standing@kneel@base" ,"base", 3) then
  648. TaskPlayAnim(GetPlayerPed(-1), "amb@medic@standing@kneel@exit" ,"exit" ,8.0, -8.0, -1, 0, 0, false, false, false )
  649. end
  650. end
  651. else
  652. local player, distance = ESX.Game.GetClosestPlayer()
  653. if snoing == 0 then
  654. snoing = 1
  655.  
  656. RequestAnimDict("amb@medic@standing@kneel@exit")
  657. RequestAnimDict("anim@gangops@facility@servers@bodysearch@")
  658. RequestAnimDict("amb@medic@standing@kneel@base")
  659. while not HasAnimDictLoaded("amb@medic@standing@kneel@exit") do
  660. Citizen.Wait(0)
  661. end
  662. while not HasAnimDictLoaded("anim@gangops@facility@servers@bodysearch@") do
  663. Citizen.Wait(0)
  664. end
  665. while not HasAnimDictLoaded("amb@medic@standing@kneel@base") do
  666. Citizen.Wait(0)
  667. end
  668. if IsEntityDead(GetPlayerPed(player)) then
  669. TaskPlayAnim(GetPlayerPed(-1), "amb@medic@standing@kneel@base" ,"base" ,8.0, -8.0, -1, 1, 0, false, false, false )
  670. end
  671. TaskPlayAnim(GetPlayerPed(-1), "anim@gangops@facility@servers@bodysearch@" ,"player_search" ,8.0, -8.0, -1, 48, 0, false, false, false )
  672. Citizen.Wait(6200)
  673. snoing = 0
  674. local target, distance = ESX.Game.GetClosestPlayer()
  675. if IsEntityPlayingAnim(GetPlayerPed(-1), "anim@gangops@facility@servers@bodysearch@" ,"player_search", 3) and distance ~= -1 and distance <= 3.0 then
  676. TriggerServerEvent('esx-qalle-storage:stealKey', GetPlayerServerId(target), data.current.keyUnit, data.current.keyName)
  677. Citizen.Wait(800)
  678. OpenBodySearchMenu(player)
  679. Citizen.Wait(800)
  680. else
  681. menu.close()
  682. sendNotification('Personen är för långt bort', 'error', 2500)
  683. end
  684. if IsEntityPlayingAnim(GetPlayerPed(-1), "amb@medic@standing@kneel@base" ,"base", 3) then
  685. TaskPlayAnim(GetPlayerPed(-1), "amb@medic@standing@kneel@exit" ,"exit" ,8.0, -8.0, -1, 0, 0, false, false, false )
  686. end
  687. end
  688. end
  689.  
  690. end,
  691. function(data, menu)
  692. menu.close()
  693. end
  694. )
  695.  
  696. end, GetPlayerServerId(player))
  697.  
  698. end
  699.  
  700. function openVehicleMenu()
  701. ESX.UI.Menu.Open(
  702.  
  703. 'default', GetCurrentResourceName(), 'vehicle_menu',
  704. {
  705. title = 'Fordonåtgärder',
  706. align = 'top-right',
  707. elements = {
  708. {label = 'Lås / Lås upp', value = 'lock'},
  709. {label = 'Motor Av / På', value = 'engine'},
  710. {label = 'Huven', value = 'door_f'},
  711. {label = 'Bakluckan', value = 'door_f2'},
  712. {label = 'Bakdörrarna', value = 'door_f3'},
  713. {label = 'Framdörrarna', value = 'door_f4'},
  714. {label = 'Farthållare', value = 'hastighet'},
  715. }
  716. },
  717. function(data, menu)
  718.  
  719. if data.current.value == 'lock' then
  720. OpenCloseVehicle()
  721. end
  722.  
  723. if data.current.value == 'engine' then
  724. TriggerEvent("engine")
  725. end
  726.  
  727. if data.current.value == 'door_f' then
  728. TriggerEvent("hood")
  729. end
  730.  
  731. if data.current.value == 'door_f2' then
  732. TriggerEvent("trunk")
  733. end
  734.  
  735. if data.current.value == 'door_f3' then
  736. TriggerEvent("rdoors")
  737. end
  738.  
  739. if data.current.value == 'door_f4' then
  740. TriggerEvent("fdoors")
  741. end
  742.  
  743. if data.current.value == 'hastighet' then
  744. ESX.UI.Menu.Open(
  745.  
  746. 'default', GetCurrentResourceName(), 'hastighet',
  747. {
  748. title = 'Farthållare',
  749. align = 'top-right',
  750. elements = {
  751. {label = '40', value = '40'},
  752. {label = '60', value = '60'},
  753. {label = '80', value = '80'},
  754. {label = ('100'), value = '100'},
  755. {label = ('120'), value = '120'},
  756. {label = ('Återställ'), value = '0'}
  757. }
  758. },
  759. function(data2, menu2)
  760. if data2.current.value == '0' then
  761. local veh = GetVehiclePedIsIn(GetPlayerPed(-1), false)
  762. SetEntityMaxSpeed(veh, 10000/3.65)
  763. else
  764. local veh = GetVehiclePedIsIn(GetPlayerPed(-1), false)
  765. SetEntityMaxSpeed(veh, data2.current.value/3.65)
  766. end
  767.  
  768.  
  769.  
  770. end,
  771. function(data2, menu2)
  772. menu2.close()
  773. end
  774. )
  775. end
  776.  
  777.  
  778. end,
  779. function(data, menu)
  780. menu.close()
  781. end
  782. )
  783. end
  784.  
  785. --låsa / låsa upp
  786. function OpenCloseVehicle()
  787. local playerPed = GetPlayerPed(-1)
  788. local coords = GetEntityCoords(playerPed)
  789. local coords2 = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 5.0, 0.0)
  790. local vehicle = nil
  791.  
  792.  
  793. if IsPedInAnyVehicle(playerPed, false) then
  794. vehicle = GetVehiclePedIsIn(playerPed, false)
  795. else
  796. vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 7.0, 0, 71 )
  797. end
  798.  
  799. --print(vehicle)
  800.  
  801. if vehicle == 0 then
  802. local coordA = GetEntityCoords(GetPlayerPed(-1), 1)
  803. local coordB = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0.0, 20.0, 0.0)
  804. local targetVehicle = getVehicleInDirection(coordA, coordB)
  805. if targetVehicle ~= nil then
  806. vehicle = targetVehicle
  807. end
  808. end
  809. ESX.TriggerServerCallback('esx_qalle:requestPlayerCars', function(isOwnedVehicle)
  810.  
  811.  
  812. local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
  813. print (vehicleProps.plate)
  814. if isOwnedVehicle or (PlayerData.job.name == 'police' and vehicleProps.plate == 'POLIS' or PlayerData.job.name == 'mecano' and vehicleProps.plate == 'MEKA' or PlayerData.job.name == 'ambulance' and vehicleProps.plate == 'AMBU' or PlayerData.job.name == 'taxi' and vehicleProps.plate == 'TAXI') then
  815. local locked = GetVehicleDoorLockStatus(vehicle)
  816. local heading = GetEntityHeading(playerPed)
  817. if locked == 1 then -- if unlocked
  818. SetVehicleDoorsLocked(vehicle, 2)
  819. PlayVehicleDoorCloseSound(vehicle, 1)
  820. ESX.ShowNotification("Du har LÅST ditt fordon.")
  821. elseif locked == 2 then -- if locked
  822. SetVehicleDoorsLocked(vehicle, 1)
  823. PlayVehicleDoorOpenSound(vehicle, 0)
  824. if not IsPedInAnyVehicle(playerPed, false) then
  825. SetPedIntoVehicle(playerPed, vehicle, -1)
  826. TaskLeaveVehicle(playerPed, vehicle, 16)
  827. SetEntityCoords(playerPed, coords.x, coords.y, coords.z-0.99, 1, 0, 0, 1)
  828. SetEntityHeading(playerPed, heading)
  829. end
  830. ESX.ShowNotification("Du har LÅST UPP ditt fordon.")
  831. end
  832. else
  833. ESX.ShowNotification("Du har inga bilnycklar till denna bil.")
  834. end
  835. end, GetVehicleNumberPlateText(vehicle))
  836. end
  837.  
  838. ---alla grejer
  839. RegisterNetEvent('esx:playerLoaded')
  840. AddEventHandler('esx:playerLoaded', function(xPlayer)
  841. PlayerData = xPlayer
  842.  
  843. TriggerEvent('esx_qalle:hasNotBulletproof')
  844. TriggerEvent('esx_qalle:hasNotHandcuffs')
  845. TriggerEvent('esx_qalle:hasNotNyckel')
  846. TriggerEvent('esx_qalle:hasNotBlindfold')
  847. TriggerEvent('esx_qalle:hasNotDyrkset')
  848. TriggerEvent('esx_qalle:hasNotECM')
  849.  
  850. for i=1, #PlayerData.inventory, 1 do
  851. if PlayerData.inventory[i].name == 'buntband' then
  852. if PlayerData.inventory[i].count > 0 then
  853. TriggerEvent('esx_qalle:hasHandcuffs')
  854. end
  855. end
  856. end
  857.  
  858. for i=1, #PlayerData.inventory, 1 do
  859. if PlayerData.inventory[i].name == 'nyckel' then
  860. if PlayerData.inventory[i].count > 0 then
  861. TriggerEvent('esx_qalle:hasNyckel')
  862. end
  863. end
  864. end
  865.  
  866. for i=1, #PlayerData.inventory, 1 do
  867. if PlayerData.inventory[i].name == 'blindfold' then
  868. if PlayerData.inventory[i].count > 0 then
  869. TriggerEvent('esx_qalle:hasBlindfold')
  870. end
  871. end
  872. end
  873.  
  874. for i=1, #PlayerData.inventory, 1 do
  875. if PlayerData.inventory[i].name == 'bulletproof' then
  876. if PlayerData.inventory[i].count > 0 then
  877. TriggerEvent('esx_qalle:hasBulletproof')
  878. end
  879. end
  880. end
  881.  
  882. for i=1, #PlayerData.inventory, 1 do
  883. if PlayerData.inventory[i].name == 'dyrkset' then
  884. if PlayerData.inventory[i].count > 0 then
  885. TriggerEvent('esx_qalle:hasDyrkset')
  886. end
  887. end
  888. end
  889. end)
  890.  
  891. RegisterNetEvent('esx_qalle:hasNyckel')
  892. AddEventHandler('esx_qalle:hasNyckel', function()
  893. hasNyckel = true
  894. end)
  895.  
  896. RegisterNetEvent('esx_qalle:hasNotNyckel')
  897. AddEventHandler('esx_qalle:hasNotNyckel', function()
  898. hasNyckel = false
  899. end)
  900.  
  901. RegisterNetEvent('esx_qalle:hasHandcuffs')
  902. AddEventHandler('esx_qalle:hasHandcuffs', function()
  903. hasHandcuffs = true
  904. end)
  905.  
  906. RegisterNetEvent('esx_qalle:hasNotHandcuffs')
  907. AddEventHandler('esx_qalle:hasNotHandcuffs', function()
  908. hasHandcuffs = false
  909. end)
  910.  
  911. RegisterNetEvent('esx_qalle:hasBlindfold')
  912. AddEventHandler('esx_qalle:hasBlindfold', function()
  913. hasBlindfold = true
  914. end)
  915.  
  916. RegisterNetEvent('esx_qalle:hasNotBlindfold')
  917. AddEventHandler('esx_qalle:hasNotBlindfold', function()
  918. hasBlindfold = false
  919. end)
  920.  
  921. RegisterNetEvent('esx_qalle:hasDyrkset')
  922. AddEventHandler('esx_qalle:hasDyrkset', function()
  923. hasDyrkset = true
  924. end)
  925.  
  926. RegisterNetEvent('esx_qalle:hasNotDyrkset')
  927. AddEventHandler('esx_qalle:hasNotDyrkset', function()
  928. hasDyrkset = false
  929. end)
  930.  
  931. RegisterNetEvent('esx_qalle:hasBulletproof')
  932. AddEventHandler('esx_qalle:hasBulletproof', function()
  933. hasBulletproof = true
  934. end)
  935.  
  936. RegisterNetEvent('esx_qalle:hasNotBulletproof')
  937. AddEventHandler('esx_qalle:hasNotBulletproof', function()
  938. hasBulletproof = false
  939. end)
  940.  
  941. -- asccesories
  942. function SetUnsetAccessory(accessory)
  943.  
  944. ESX.TriggerServerCallback('esx_accessories:get', function(hasAccessory, accessorySkin)
  945. local _accessory = string.lower(accessory)
  946.  
  947. if hasAccessory then
  948. TriggerEvent('skinchanger:getSkin', function(skin)
  949. local mAccessory = -1
  950. local mColor = 0
  951. if _accessory == "mask" then
  952. mAccessory = 0
  953. end
  954. if skin[_accessory .. '_1'] == mAccessory then
  955. mAccessory = accessorySkin[_accessory .. '_1']
  956. mColor = accessorySkin[_accessory .. '_2']
  957. end
  958. local accessorySkin = {}
  959. accessorySkin[_accessory .. '_1'] = mAccessory
  960. accessorySkin[_accessory .. '_2'] = mColor
  961. TriggerEvent('skinchanger:loadClothes', skin, accessorySkin)
  962. end)
  963. else
  964. sendNotification('Du har ingen ' .. _accessory, 'error', 2500)
  965. end
  966.  
  967. end, accessory)
  968.  
  969. end
  970.  
  971. -- C O N F I G --
  972. interactionDistance = 9.5 --The radius you have to be in to interact with the vehicle.
  973. lockDistance = 25 --The radius you have to be in to lock your vehicle.
  974.  
  975. -- V A R I A B L E S --
  976. engineoff = false
  977. saved = false
  978. controlsave_bool = false
  979.  
  980. -- E N G I N E --
  981. IsEngineOn = true
  982. RegisterNetEvent('engine')
  983. AddEventHandler('engine',function()
  984. local player = GetPlayerPed(-1)
  985.  
  986. if (IsPedSittingInAnyVehicle(player)) then
  987. local vehicle = GetVehiclePedIsIn(player,false)
  988.  
  989. if IsEngineOn == true then
  990. IsEngineOn = false
  991. SetVehicleEngineOn(vehicle,false,false,false)
  992. else
  993. IsEngineOn = true
  994. SetVehicleUndriveable(vehicle,false)
  995. SetVehicleEngineOn(vehicle,true,false,false)
  996. end
  997.  
  998. while (IsEngineOn == false) do
  999. SetVehicleUndriveable(vehicle,true)
  1000. Citizen.Wait(0)
  1001. end
  1002. end
  1003. end)
  1004.  
  1005. -- T R U N K --
  1006. RegisterNetEvent('trunk')
  1007. AddEventHandler('trunk',function()
  1008. local player = GetPlayerPed(-1)
  1009. if controlsave_bool == true then
  1010. vehicle = saveVehicle
  1011. else
  1012. vehicle = GetVehiclePedIsIn(player,true)
  1013. end
  1014.  
  1015. local isopen = GetVehicleDoorAngleRatio(vehicle,5)
  1016. local distanceToVeh = GetDistanceBetweenCoords(GetEntityCoords(player), GetEntityCoords(vehicle), 1)
  1017.  
  1018. if distanceToVeh <= interactionDistance then
  1019. if (isopen == 0) then
  1020. SetVehicleDoorOpen(vehicle,5,0,0)
  1021. else
  1022. SetVehicleDoorShut(vehicle,5,0)
  1023. end
  1024. else
  1025.  
  1026. end
  1027. end)
  1028.  
  1029. RegisterNetEvent('fdoors')
  1030. AddEventHandler('fdoors',function()
  1031. local player = GetPlayerPed(-1)
  1032. if controlsave_bool == true then
  1033. vehicle = saveVehicle
  1034. else
  1035. vehicle = GetVehiclePedIsIn(player,true)
  1036. end
  1037. local isopen = GetVehicleDoorAngleRatio(vehicle,0) and GetVehicleDoorAngleRatio(vehicle,1)
  1038. local distanceToVeh = GetDistanceBetweenCoords(GetEntityCoords(player), GetEntityCoords(vehicle), 1)
  1039.  
  1040. if distanceToVeh <= interactionDistance then
  1041. if (isopen == 0) then
  1042. SetVehicleDoorOpen(vehicle,0,0,0)
  1043. SetVehicleDoorOpen(vehicle,1,0,0)
  1044. else
  1045. SetVehicleDoorShut(vehicle,0,0)
  1046. SetVehicleDoorShut(vehicle,1,0)
  1047. end
  1048. else
  1049.  
  1050. end
  1051. end)
  1052. -- R E A R D O O R S --
  1053. RegisterNetEvent('rdoors')
  1054. AddEventHandler('rdoors',function()
  1055. local player = GetPlayerPed(-1)
  1056. if controlsave_bool == true then
  1057. vehicle = saveVehicle
  1058. else
  1059. vehicle = GetVehiclePedIsIn(player,true)
  1060. end
  1061. local isopen = GetVehicleDoorAngleRatio(vehicle,2) and GetVehicleDoorAngleRatio(vehicle,3)
  1062. local distanceToVeh = GetDistanceBetweenCoords(GetEntityCoords(player), GetEntityCoords(vehicle), 1)
  1063.  
  1064. if distanceToVeh <= interactionDistance then
  1065. if (isopen == 0) then
  1066. SetVehicleDoorOpen(vehicle,2,0,0)
  1067. SetVehicleDoorOpen(vehicle,3,0,0)
  1068. else
  1069. SetVehicleDoorShut(vehicle,2,0)
  1070. SetVehicleDoorShut(vehicle,3,0)
  1071. end
  1072. else
  1073.  
  1074. end
  1075. end)
  1076.  
  1077. -- H O O D --
  1078. RegisterNetEvent('hood')
  1079. AddEventHandler('hood',function()
  1080. local player = GetPlayerPed(-1)
  1081. if controlsave_bool == true then
  1082. vehicle = saveVehicle
  1083. else
  1084. vehicle = GetVehiclePedIsIn(player,true)
  1085. end
  1086.  
  1087. local isopen = GetVehicleDoorAngleRatio(vehicle,4)
  1088. local distanceToVeh = GetDistanceBetweenCoords(GetEntityCoords(player), GetEntityCoords(vehicle), 1)
  1089.  
  1090. if distanceToVeh <= interactionDistance then
  1091. if (isopen == 0) then
  1092. SetVehicleDoorOpen(vehicle,4,0,0)
  1093. else
  1094. SetVehicleDoorShut(vehicle,4,0)
  1095. end
  1096. else
  1097.  
  1098. end
  1099. end)
  1100.  
  1101.  
  1102.  
  1103. -- notification
  1104. function sendNotification(message, messageType, messageTimeout)
  1105. TriggerEvent("pNotify:SendNotification", {
  1106. text = message,
  1107. type = messageType,
  1108. queue = "qalle",
  1109. timeout = messageTimeout,
  1110. layout = "bottomCenter"
  1111. })
  1112. end
  1113.  
  1114. -- Key events
  1115. Citizen.CreateThread(function()
  1116. while true do
  1117. Wait(0)
  1118. if IsControlPressed(0, Keys['F5']) then
  1119. openMenu()
  1120. end
  1121. end
  1122. end)
  1123.  
  1124. function drawTxt(x,y ,width,height,scale, text, r,g,b,a)
  1125. SetTextFont(4)
  1126. SetTextProportional(0)
  1127. SetTextScale(scale, scale)
  1128. SetTextColour(r, g, b, a)
  1129. SetTextDropShadow(0, 0, 0, 0,255)
  1130. SetTextEdge(2, 0, 0, 0, 255)
  1131. SetTextDropShadow()
  1132. SetTextOutline()
  1133. SetTextEntry("STRING")
  1134. AddTextComponentString(text)
  1135. DrawText(x - width/2, y - height/2 + 0.005)
  1136. end
  1137.  
  1138. function drawRct(x,y,width,height,r,g,b,a)
  1139. DrawRect(x + width/2, y + height/2, width, height, r, g, b, a)
  1140. end
  1141.  
  1142.  
  1143. -- Bälte
  1144.  
  1145.  
  1146. local speedBuffer = {}
  1147. local velBuffer = {}
  1148. local beltOn = false
  1149. local wasInCar = false
  1150.  
  1151. IsCar = function(veh)
  1152. local vc = GetVehicleClass(veh)
  1153. return (vc >= 0 and vc <= 7) or (vc >= 9 and vc <= 12) or (vc >= 17 and vc <= 20)
  1154. end
  1155.  
  1156. Fwv = function (entity)
  1157. local hr = GetEntityHeading(entity) + 90.0
  1158. if hr < 0.0 then hr = 360.0 + hr end
  1159. hr = hr * 0.0174533
  1160. return { x = math.cos(hr) * 2.0, y = math.sin(hr) * 2.0 }
  1161. end
  1162.  
  1163. Citizen.CreateThread(function()
  1164. Citizen.Wait(500)
  1165. while true do
  1166.  
  1167. local ped = GetPlayerPed(-1)
  1168. local car = GetVehiclePedIsIn(ped)
  1169.  
  1170. if car ~= 0 and (wasInCar or IsCar(car)) then
  1171.  
  1172. wasInCar = true
  1173.  
  1174. if beltOn then DisableControlAction(0, 75) end
  1175.  
  1176. -- if beltOn and IsControlJustReleased(29)
  1177. -- TriggerEvent("pNotify:SendNotification", {text = "Du har bälte på dig!", type = "error", queue = "belt", timeout = 700, layout = "bottomCenter"})
  1178. -- end
  1179.  
  1180. speedBuffer[2] = speedBuffer[1]
  1181. speedBuffer[1] = GetEntitySpeed(car)
  1182.  
  1183. if speedBuffer[2] ~= nil
  1184. and not beltOn
  1185. and GetEntitySpeedVector(car, true).y > 1.0
  1186. and speedBuffer[1] > 19.25
  1187. and (speedBuffer[2] - speedBuffer[1]) > (speedBuffer[1] * 0.255) then
  1188.  
  1189. local co = GetEntityCoords(ped)
  1190. local fw = Fwv(ped)
  1191. SetEntityCoords(ped, co.x + fw.x, co.y + fw.y, co.z - 0.47, true, true, true)
  1192. SetEntityVelocity(ped, velBuffer[2].x, velBuffer[2].y, velBuffer[2].z)
  1193. Citizen.Wait(1)
  1194. SetPedToRagdoll(ped, 1000, 1000, 0, 0, 0, 0)
  1195. end
  1196.  
  1197. velBuffer[2] = velBuffer[1]
  1198. velBuffer[1] = GetEntityVelocity(car)
  1199.  
  1200. if IsControlJustReleased(0, 29) then
  1201. beltOn = not beltOn
  1202. if beltOn then TriggerEvent("pNotify:SendNotification", {text = _U('seatbelt_on'), type = "success", queue = "belt", timeout = 700, layout = "bottomCenter"})
  1203. else TriggerEvent("pNotify:SendNotification", {text = _U('seatbelt_off'), type = "error", queue = "belt", timeout = 700, layout = "bottomCenter"}) end
  1204. end
  1205.  
  1206. elseif wasInCar then
  1207. wasInCar = false
  1208. beltOn = false
  1209. speedBuffer[1], speedBuffer[2] = 0.0, 0.0
  1210. end
  1211. Citizen.Wait(0)
  1212. end
  1213. end)
  1214.  
  1215.  
  1216. local disableShuffle = true
  1217. function disableSeatShuffle(flag)
  1218. disableShuffle = flag
  1219. end
  1220.  
  1221. function getVehicleInDirection(coordFrom, coordTo)
  1222. local rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, GetPlayerPed(-1), 0)
  1223. local a, b, c, d, vehicle = GetRaycastResult(rayHandle)
  1224. return vehicle
  1225. end
  1226.  
  1227. Citizen.CreateThread(function()
  1228. while true do
  1229. Citizen.Wait(0)
  1230. if IsPedInAnyVehicle(GetPlayerPed(-1), false) and disableShuffle then
  1231. if GetPedInVehicleSeat(GetVehiclePedIsIn(GetPlayerPed(-1), false), 0) == GetPlayerPed(-1) then
  1232. if GetIsTaskActive(GetPlayerPed(-1), 165) then
  1233. SetPedIntoVehicle(GetPlayerPed(-1), GetVehiclePedIsIn(GetPlayerPed(-1), false), 0)
  1234. end
  1235. end
  1236. end
  1237. end
  1238. end)
  1239.  
  1240. RegisterNetEvent("SeatShuffle")
  1241. AddEventHandler("SeatShuffle", function()
  1242. if IsPedInAnyVehicle(GetPlayerPed(-1), false) then
  1243. disableSeatShuffle(false)
  1244. Citizen.Wait(5000)
  1245. disableSeatShuffle(true)
  1246. else
  1247. CancelEvent()
  1248. end
  1249. end)
  1250.  
  1251. RegisterCommand("shuff", function(source, args, raw) --change command here
  1252. TriggerEvent("SeatShuffle")
  1253. end, false) --False, allow everyone to run it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement