Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.82 KB | None | 0 0
  1. -- modules/police.lua
  2. RegisterServerEvent('handcuff:checkjob')
  3. AddEventHandler('handcuff:checkjob', function()
  4.     local source = source
  5.     local user_id = vRP.getUserId(source)
  6.  
  7.     if vRP.hasPermission(user_id,"police.handcuff") then
  8.           TriggerClientEvent('cuff', source)
  9.     end
  10. end)
  11.  
  12. RegisterServerEvent('handcuff:cuffHim')
  13. AddEventHandler('handcuff:cuffHim', function()
  14.     local source = source
  15.     local user_id = vRP.getUserId({source})
  16.    
  17.     vRPclient.getNearestPlayer(source,{1.5},function(cplayer)
  18.     if cplayer ~= nil then
  19.       vRPclient.isHandcuffed(cplayer,{}, function(handcuffed)
  20.         print(handcuffed)
  21.         if handcuffed then
  22.           print("off")
  23.           vRPclient.toggleHandcuff(cplayer,{})
  24.           TriggerClientEvent("pNotify:SendNotification", source,{text = {"Personen fik l�snet sine h�ndjern."}, type = "info", queue = "global", timeout = 3000, layout = "centerLeft",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"}})
  25.         else
  26.           print("arrest")
  27.           vRPclient.getArrested(cplayer,{})
  28.           vRPclient.arrestAnim(source,{}, function(done)
  29.             while not done do
  30.               Wait(100)
  31.             end
  32.             print("done")
  33.             vRPclient.toggleHandcuff(cplayer,{})
  34.             TriggerClientEvent("pNotify:SendNotification", source,{text = {"Personen blev sat i h�ndjern."}, type = "info", queue = "global", timeout = 3000, layout = "centerLeft",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"}})
  35.           end)
  36.                 end
  37.             end)
  38.         else
  39.             TriggerClientEvent("pNotify:SendNotification", source,{text = {lang.common.no_player_near()}, type = "error", queue = "global", timeout = 4000, layout = "centerLeft",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"}})
  40.         end
  41.     end)
  42. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement