Advertisement
fox1759

Untitled

Mar 26th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. function onUse(cid, item, fromposition, itemEx, toposition)
  2.  
  3. local config ={
  4.  
  5. ["1-400"] = {items = 8298, text = "SUCESSO", colortext = 139, msg = "Você adquiriu 1 pedra(s) de refinamento nível 1"},
  6. ["400-700"] = {items = 8299, text = "SUCESSO", colortext = TEXTCOLOR_GREY, msg = "Você adquiriu 1 pedra(s) de refinamento nível 2"},
  7. ["700-850"] = {items = 8301, text = "SUCESSO", colortext = 210, msg = "Você adquiriu 1 pedra(s) de refinamento nível 3"},
  8. ["850-925"] = {items = 8302, text = "SUCESSO", colortext = 64,msg = "Você adquiriu 1 pedra(s) de refinamento nível 4"},
  9. ["925-999"] = {items = 8303, text = "SUCESSO", colortext = TEXTCOLOR_PURPLE , msg = "Você adquiriu 1 pedra(s) de refinamento nível 5"},
  10. ["999-1000"] = {items = 9971, text = "G-INGOT!", colortext = 208, ,msg = "Você adquiriu 1 gold ingot(s)"},
  11. }
  12. local rand = math.random(1, 1005)
  13.  
  14.  
  15. if getPlayerLevel(cid) <= 124 then
  16. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você não tem nível 125+ para ter acesso a mineração!")
  17. return true
  18. end
  19.  
  20. if getPlayerStorageValue(cid,8749) < 1 then
  21. return true
  22. end
  23.  
  24. if itemEx.itemid >= 1353 and itemEx.itemid <= 1354 or itemEx.itemid == 1355 then
  25. for chance, v in pairs(config) do
  26.  
  27. local c = string.explode(string:lower(chance), "-")
  28.  
  29. if rand >= tonumber(c[1]) and rand <= tonumber(c[2]) then
  30. doSendAnimatedText(toposition, v.text , v.colortext)
  31. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, v.msg)
  32. doSendMagicEffect(toposition,12)
  33. doPlayerAddItem(cid, v.items, 1)
  34. break
  35. else
  36. doSendAnimatedText(toposition,'FALHOU!', TEXTCOLOR_RED)
  37. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sua mineração falhou. Tente novamente ")
  38. doSendMagicEffect(toposition,2)
  39. end
  40. end
  41. end
  42. return true
  43. endd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement