Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. -- TRASPORTATORI SOLDI
  2. for perm,mission in pairs(self.cfg.soldi) do -- self.cfg.soldi
  3. -- Notifica Missione
  4. local users = vRP.EXT.Group:getUsersByPermission(perm)
  5. for _, user in pairs(users) do
  6. if user.spawns > 0 and not user:hasMission() then -- check spawned without mission
  7. if math.random(1,mission.chance) == 1 then -- chance check
  8. local mdata = {}
  9. mdata.name = self.lang.soldi({mission.title})
  10. mdata.steps = {}
  11.  
  12. -- Creazione Missione
  13. for i=1,mission.steps do
  14. local step = {
  15. text = self.lang.soldi({mission.title}).."<br />"..self.lang.reward({mission.reward}),
  16. onenter = function(user)
  17. for fullid,amount in pairs(soldi_items) do
  18. if amount > 0 then -- check if not done
  19. if user:tryTakeItem(fullid,amount) then
  20. local reward = mission.items[fullid][3]*amount
  21. user:giveWallet(reward)
  22. vRP.EXT.Base.remote._notify(user.source,lang.money.received({reward}))
  23. todo = todo-1
  24. soldi_items[fullid] = 0
  25. if todo == 0 then -- Fine Missione
  26. user:nextMissionStep()
  27. end
  28. end
  29. end
  30. end
  31. end
  32. end
  33. end
  34. end
  35. end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement