Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.55 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. local PoliceGUI = false
  14. local PlayerData = {}
  15.  
  16. ESX = nil
  17. Citizen.CreateThread(function()
  18. while ESX == nil do
  19. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  20. Citizen.Wait(0)
  21. end
  22.  
  23. Citizen.Wait(5000)
  24. PlayerData = ESX.GetPlayerData()
  25. end)
  26.  
  27. RegisterNetEvent('xlem0n_exile:mandatnotify')
  28. AddEventHandler('xlem0n_exile:mandatnotify', function(fine, id, powod, przedrostek)
  29.  
  30. ESX.TriggerServerCallback('esx_policejob:getOtherPlayerData', function(data)
  31.  
  32. local name = data.firstname .. ' ' .. data.lastname
  33. TriggerEvent('chat:addMessage', { args = { przedrostek .. ': ^5^*' .. name .. ' ^7^*otrzymał mandat w wysokości: ^2^*' .. fine .. '$ ^7^*Powód: ^3^*' .. powod}, color = { 147, 196, 109 } })
  34.  
  35. end, id)
  36.  
  37. end)
  38.  
  39. RegisterNetEvent('esx:playerLoaded')
  40. AddEventHandler('esx:playerLoaded', function(xPlayer)
  41. PlayerData = xPlayer
  42. end)
  43.  
  44. RegisterNetEvent('esx:setJob')
  45. AddEventHandler('esx:setJob', function(job)
  46. PlayerData.job = job
  47. end)
  48.  
  49. Citizen.CreateThread(function()
  50. while true do
  51. Citizen.Wait(1)
  52. if PlayerData.job ~= nil and (PlayerData.job.name == 'police' or PlayerData.job.name == 'offpolice') then
  53. if IsControlJustPressed(0, Keys["DELETE"]) then
  54. if PlayerData.job.name == 'police' then
  55. if not PoliceGUI then
  56. SetNuiFocus(true, true)
  57. SendNUIMessage({type = 'open'})
  58. PoliceGUI = true
  59. PhonePlayAnim('text')
  60. end
  61. else
  62. ESX.ShowNotification("~r~Nie jesteś na służbie!")
  63. end
  64. end
  65. end
  66. end
  67. end)
  68.  
  69. RegisterNUICallback('NUIFocusOff', function()
  70. SetNuiFocus(false, false)
  71. SendNUIMessage({type = 'close'})
  72. PoliceGUI = false
  73. PhonePlayAnim('out')
  74. end)
  75.  
  76. RegisterNUICallback('mandat', function(data, cb)
  77. local sender = GetPlayerServerId(player)
  78. local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  79. if closestPlayer ~= -1 and closestDistance <= 3.0 then
  80. TriggerServerEvent("xlem0n_exile:mandat", GetPlayerServerId(closestPlayer), tonumber(data.mandatamount), data.mandatreason)
  81. ESX.ShowNotification('Wpłacono ~g~' .. data.mandatamount * 0.25 .. '$ ~s~na twoje konto w banku.')
  82. TriggerServerEvent("xlem0n_exile:mandathajs", tonumber(data.mandatamount) / 2)
  83. end
  84. end)
  85.  
  86. RegisterNUICallback('jail', function(data, cb)
  87. local sender = GetPlayerServerId(player)
  88. local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  89. if closestPlayer ~= -1 and closestDistance <= 3.0 then
  90. TriggerServerEvent("xlem0n_exile:wiezienie", GetPlayerServerId(closestPlayer), data.jailtime * 60, data.jailreason, tonumber(data.jailgrzywna))
  91. ESX.ShowNotification('Wpłacono ~g~' .. data.jailgrzywna * 0.5 .. '$ ~s~na twoje konto w banku.')
  92. TriggerServerEvent("xlem0n_exile:mandathajs", tonumber(data.jailgrzywna) / 2)
  93. end
  94. end)
  95.  
  96. local myPedId = nil
  97.  
  98. local phoneProp = 0
  99. local phoneModel = "prop_cs_tablet"
  100. -- OR "prop_npc_phone"
  101. -- OR "prop_npc_phone_02"
  102. -- OR "prop_cs_phone_01"
  103.  
  104. local currentStatus = 'out'
  105. local lastDict = nil
  106. local lastAnim = nil
  107. local lastIsFreeze = false
  108.  
  109. local ANIMS = {
  110. ['cellphone@'] = {
  111. ['out'] = {
  112. ['text'] = 'cellphone_text_in',
  113. ['call'] = 'cellphone_call_listen_base',
  114.  
  115. },
  116. ['text'] = {
  117. ['out'] = 'cellphone_text_out',
  118. ['call'] = 'cellphone_text_to_call',
  119. },
  120. ['call'] = {
  121. ['out'] = 'cellphone_call_out',
  122. ['text'] = 'cellphone_call_to_text',
  123. }
  124. },
  125. ['anim@cellphone@in_car@ps'] = {
  126. ['out'] = {
  127. ['text'] = 'cellphone_text_in',
  128. ['call'] = 'cellphone_call_in',
  129. },
  130. ['text'] = {
  131. ['out'] = 'cellphone_text_out',
  132. ['call'] = 'cellphone_text_to_call',
  133. },
  134. ['call'] = {
  135. ['out'] = 'cellphone_horizontal_exit',
  136. ['text'] = 'cellphone_call_to_text',
  137. }
  138. }
  139. }
  140.  
  141. function newPhoneProp()
  142. deletePhone()
  143. --(phoneModel)
  144. --while not HasModelLoaded(phoneModel) do
  145. --Citizen.Wait(1)
  146. --end
  147. phoneProp = CreateObject(GetHashKey('prop_cs_tablet'), 1.0, 1.0, 1.0, 1, 1, 0)
  148. local bone = GetPedBoneIndex(myPedId, 28422)
  149. AttachEntityToEntity(phoneProp, myPedId, bone, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0, 0, 2, 1)
  150. end
  151.  
  152. function deletePhone ()
  153. if phoneProp ~= 0 then
  154. Citizen.InvokeNative(0xAE3CBE5BF394C9C9 , Citizen.PointerValueIntInitialized(phoneProp))
  155. phoneProp = 0
  156. end
  157. end
  158.  
  159.  
  160. function PhonePlayAnim (status, freeze)
  161. if currentStatus == status then
  162. return
  163. end
  164. myPedId = GetPlayerPed(-1)
  165. local freeze = freeze or false
  166.  
  167. local dict = "cellphone@"
  168. if IsPedInAnyVehicle(myPedId, false) then
  169. dict = "anim@cellphone@in_car@ps"
  170. end
  171. loadAnimDict(dict)
  172.  
  173. local anim = ANIMS[dict][currentStatus][status]
  174. if currentStatus ~= 'out' then
  175. StopAnimTask(myPedId, lastDict, lastAnim, 1.0)
  176. end
  177. local flag = 50
  178. if freeze == true then
  179. flag = 14
  180. end
  181. TaskPlayAnim(myPedId, dict, anim, 3.0, -1, -1, flag, 0, false, false, false)
  182.  
  183. if status ~= 'out' and currentStatus == 'out' then
  184. Citizen.Wait(380)
  185. newPhoneProp()
  186. end
  187.  
  188. lastDict = dict
  189. lastAnim = anim
  190. lastIsFreeze = freeze
  191. currentStatus = status
  192.  
  193. if status == 'out' then
  194. Citizen.Wait(180)
  195. deletePhone()
  196. StopAnimTask(myPedId, lastDict, lastAnim, 1.0)
  197. end
  198.  
  199. end
  200.  
  201. function PhonePlayOut ()
  202. PhonePlayAnim('out')
  203. end
  204.  
  205. function PhonePlayText ()
  206. PhonePlayAnim('text')
  207. end
  208.  
  209. function PhonePlayCall (freeze)
  210. PhonePlayAnim('call', freeze)
  211. end
  212.  
  213. function PhonePlayIn ()
  214. if currentStatus == 'out' then
  215. PhonePlayText()
  216. end
  217. end
  218.  
  219. function loadAnimDict(dict)
  220. RequestAnimDict(dict)
  221. while not HasAnimDictLoaded(dict) do
  222. Citizen.Wait(1)
  223. end
  224. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement