SHARE
TWEET

Untitled

a guest Sep 21st, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -----------------------------------------------------------------------------------------------------------------------------------------
  2. -- CALL
  3. -----------------------------------------------------------------------------------------------------------------------------------------
  4. local blips = {}
  5. RegisterCommand('chamar',function(source,args,rawCommand)
  6.     local source = source
  7.     local answered = false
  8.     local user_id = vRP.getUserId(source)
  9.     if user_id then
  10.         local players = {}
  11.         if args[1] == "911" then
  12.             players = vRP.getUsersByPermission("policia.permissao")
  13.         elseif args[1] == "112" then
  14.             players = vRP.getUsersByPermission("paramedico.permissao")
  15.         elseif args[1] == "mec" then
  16.             players = vRP.getUsersByPermission("mecanico.permissao")
  17.         elseif args[1] == "adm" then
  18.             players = vRP.getUsersByPermission("chamado.permissao")
  19.         elseif args[1] == "taxi" then
  20.             players = vRP.getUsersByPermission("taxista.permissao")
  21.         else
  22.             TriggerClientEvent("Notify",source,"negado","Serviço inexistente.")
  23.             return
  24.         end
  25.  
  26.         local descricao = vRP.prompt(source,"Descrição:","")
  27.         if descricao == "" then
  28.             return
  29.         end
  30.  
  31.         local identitys = vRP.getUserIdentity(user_id)
  32.         TriggerClientEvent("Notify",source,"sucesso","Chamado enviado com sucesso.")
  33.         for l,w in pairs(players) do
  34.             local player = vRP.getUserSource(parseInt(w))
  35.             local nuser_id = vRP.getUserId(player)
  36.             local x,y,z = vRPclient.getPosition(source)
  37.             local uplayer = vRP.getUserSource(user_id)
  38.             if player and player ~= uplayer then
  39.                 async(function()
  40.                     vRPclient.playSound(player,"Out_Of_Area","DLC_Lowrider_Relay_Race_Sounds")
  41.                     TriggerClientEvent('chatMessage',player,"CHAMADO",{19,197,43},"Enviado por ^1"..identitys.name.." "..identitys.firstname.."^0, "..descricao)
  42.                     local ok = vRP.request(player,"Aceitar o chamado de <b>"..identitys.name.." "..identitys.firstname.."</b>?",30)
  43.                     if ok then
  44.                         if not answered then
  45.                             answered = true
  46.                             local identity = vRP.getUserIdentity(nuser_id)
  47.                             TriggerClientEvent("Notify",source,"importante","Chamado atendido por <b>"..identity.name.." "..identity.firstname.."</b>, aguarde no local.")
  48.                             vRPclient.playSound(source,"Event_Message_Purple","GTAO_FM_Events_Soundset")
  49.                             vRPclient._setGPS(player,x,y)
  50.                         else
  51.                             TriggerClientEvent("Notify",player,"negado","Chamado ja foi atendido por outra pessoa.")
  52.                             vRPclient.playSound(player,"CHECKPOINT_MISSED","HUD_MINI_GAME_SOUNDSET")
  53.                         end
  54.                     end
  55.                     local id = idgens:gen()
  56.                     blips[id] = vRPclient.addBlip(player,x,y,z,358,71,"Chamado",0.6,false)
  57.                     SetTimeout(300000,function() vRPclient.removeBlip(player,blips[id]) idgens:free(id) end)
  58.                 end)
  59.             end
  60.         end
  61.     end
  62. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top