Advertisement
Guest User

server.lua

a guest
Aug 17th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1.  
  2. local Tunnel = module("vrp", "lib/Tunnel")
  3. local Proxy = module("vrp", "lib/Proxy")
  4. local Lang = module("vrp", "lib/Lang")
  5. local cfg = module("vrp_basic_mission", "cfg/missions")
  6.  
  7. -- load global and local languages
  8. local glang = Lang.new(module("vrp", "cfg/lang/"..cfg.lang) or {})
  9. local lang = Lang.new(module("vrp_basic_mission", "cfg/lang/"..cfg.lang) or {})
  10.  
  11. vRP = Proxy.getInterface("vRP")
  12. vRPclient = Tunnel.getInterface("vRP","vRP_basic_mission")
  13.  
  14. ----------------------------- FUNCION AUMENTAR
  15. aux = 0
  16.  
  17. function aumentar(min, max)
  18. local numero = 0
  19.  
  20. if numero <= max then
  21. numero = min + aux
  22. end
  23.  
  24. aux = aux + 1
  25.  
  26. return numero
  27. end
  28. ------------------------
  29.  
  30. --------------------------------PIZZERIA BUENA----------------------
  31. Citizen.CreateThread(function()
  32. Citizen.Wait(100000) -- start
  33.  
  34. while true do
  35. Citizen.Wait(60000)
  36.  
  37. for k,v in pairs(cfg.pizzeria) do -- each repair perm def
  38. -- add missions to users
  39. local users = vRP.getUsersByPermission({k})
  40. for l,w in pairs(users) do
  41. local user_id = w
  42. local player = vRP.getUserSource({user_id})
  43. if not vRP.hasMission({player}) then
  44. if math.random(1,v.chance+1) == 1 then -- chance checkvRPclient.playAnim(player,{false,{{"amb@prop_human_atm@male@exit","exit"}},false})
  45. -- build mission
  46. local mdata = {}
  47. mdata.name = lang.Entregas({v.title})
  48. mdata.steps = {}
  49.  
  50. -- build steps
  51. for i=1,v.steps do
  52. local step = {
  53. text = lang.Ruta({v.title}).."<br />"..lang.reward({v.reward}),
  54. onenter = function(player, area)
  55. if vRP.tryGetInventoryItem({user_id,"pizza",1,true}) then
  56. vRPclient.playAnim(player,{false,{{task="anim@heists@box_carry@","idle"}},false})
  57. SetTimeout(1000, function()
  58. vRP.nextMissionStep({player})
  59. vRPclient.stopAnim(player,{false})
  60.  
  61. -- last step
  62. if i == v.steps then
  63. vRP.giveMoney({user_id,v.reward})
  64. vRPclient.notify(player,{glang.money.received({v.reward})})
  65. end
  66. end)
  67. end
  68. end,
  69. --position = v.positions[math.random(1,#v.positions)] CAMBIADO EL MATH.RANDOM POR AUMENTAR
  70. position = v.positions[aumentar(1,#v.positions)]
  71. }
  72.  
  73. table.insert(mdata.steps, step)
  74. end
  75.  
  76. vRP.startMission({player,mdata})
  77. end
  78. end
  79. end
  80. end
  81. end
  82. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement