Advertisement
Guest User

Untitled

a guest
Jun 17th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. -- REPAIR
  2. for k,v in pairs(cfg.repair) do -- each repair perm def
  3. -- add missions to users
  4. local users = vRP.getUsersByPermission({k})
  5. for l,w in pairs(users) do
  6. local user_id = w
  7. local player = vRP.getUserSource({user_id})
  8. if not vRP.hasMission({player}) then
  9. if vRP.hasInventoryItem({user_id,"repairkit"}) then
  10. if math.random(1,v.chance+1) == 1 then -- chance check
  11. -- build mission
  12. local mdata2 = {}
  13. mdata.name = lang.repair({v.title})
  14. mdata.steps2 = {}
  15.  
  16. -- build steps
  17. for i2=1,v.steps2 do
  18. local step2 = {
  19. text = lang.repair({v.title}).."<br />"..lang.reward({v.reward}),
  20. onenter = function(player, area)
  21. if vRP.tryGetInventoryItem({user_id,"repairkit",1,true}) then
  22. vRPclient.playAnim(player,{false,{task="WORLD_HUMAN_WELDING"},false})
  23. SetTimeout(15000, function()
  24. vRP.nextMissionStep({player})
  25. vRPclient.stopAnim(player,{false})
  26.  
  27. -- last step
  28. if i2 == v.steps2 then
  29. vRP.giveMoney({user_id,v.reward})
  30. vRPclient.notify(player,{glang.money.received({v.reward})})
  31. end
  32. end)
  33. end
  34. end,
  35. position2 = v.positions2[math.random(1,#v.positions2)]
  36. }
  37.  
  38. table.insert(mdata.steps2, step2)
  39. end
  40.  
  41. vRP.startMission({player,mdata2})
  42. else
  43. if not vRP.hasMission({player}) then
  44. if math.random(1,v.chance+1) == 1 then -- chance check
  45. -- build mission
  46. local mdata1 = {}
  47. mdata.name = "Mechanic"
  48. mdata.steps1 = {}
  49.  
  50. -- build steps
  51. for i1=1,v.steps1 do
  52. local step1 = {
  53. text = "You need to get a repair kit, follow my directions",
  54. onenter = function(player, area)
  55. vRPclient.notify(player,{"Buy a repair kit here"})
  56. SetTimeout(15000, function()
  57. vRP.nextMissionStep({player})
  58. vRPclient.stopAnim(player,{false})
  59. -- last step
  60. if i1 == v.steps1 then
  61. vRPclient.notify(player,{"Buy a repair kit here"})
  62. end
  63. end)
  64. end,
  65. position1 = v.positions1[math.random(1,#v.positions1)]
  66. }
  67.  
  68. table.insert(mdata.steps1, step1)
  69. end
  70.  
  71. vRP.startMission({player,mdata1})
  72. end
  73. end
  74. end
  75. end
  76. end
  77. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement