Guest User

Aura System 8.6

a guest
May 1st, 2015
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.49 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <mod name="Aura" version="1.0" author="Kaegipt" contact="facebook.com/eitor.laba" enabled="yes">  
  3. <config name="auralib"><![CDATA[
  4. auras = {
  5.     ["fogo"] = {36,1500000,11350},
  6.     ["gelo"] = {41,1500000,11351},
  7.     ["pedras"] = {44,1250000,11352},
  8.     ["energia"] = {37,1250000,11353},
  9.     ["tornado"] = {42,15000000,11354},
  10. }
  11.  
  12. function converterKK(num)
  13.     len = tostring(num):len()
  14.     result = ""
  15.     if len < 4 then
  16.         result = result.."g"
  17.     else
  18.         len = len - 3
  19.         quant = math.ceil(len/3)
  20.         for x = 1, quant do
  21.             result = result.."k"
  22.             num = num / 1000
  23.         end
  24.     end
  25.     return num..result
  26. end
  27.  
  28. function maiuscular(str)
  29.     result = ""
  30.     local p = 1
  31.     for x,i in pairs(str:explode(" ")) do
  32.         if p ~= #str:explode(" ") then
  33.             result = result..i:sub(0,1):upper()..i:sub(2,i:len()):lower().." "
  34.         else
  35.             result = result..i:sub(0,1):upper()..i:sub(2,i:len()):lower()
  36.         end
  37.         p = p + 1
  38.     end
  39.     return result
  40. end
  41. aurast = 30112]]></config>
  42. <event type="login" name="Registering" event="script"><![CDATA[
  43. domodlib('auralib')
  44. function onLogin(cid)
  45.     registerCreatureEvent(cid, "Aura")
  46.     return true
  47. end]]></event>
  48. <event type="think" name="Aura" event="script"><![CDATA[
  49. domodlib('auralib')
  50. function onThink(cid, interval)
  51.     local ticks = 21963
  52.     if getPlayerStorageValue(cid,aurast) ~= 0 then
  53.         local aura = auras[getPlayerStorageValue(cid,aurast)]
  54.         if aura ~= nil then
  55.             if getPlayerStorageValue(cid,ticks) <= -1 then
  56.                 setPlayerStorageValue(cid,ticks,2)
  57.                 doSendMagicEffect(getThingPos(cid),aura[1])
  58.             end
  59.         end
  60.         setPlayerStorageValue(cid,ticks,getPlayerStorageValue(cid,ticks)-1)
  61.     end
  62.    return true
  63. end]]></event>
  64. <talkaction words="!aura" event="script"><![CDATA[
  65. domodlib('auralib')
  66. function onSay(cid, words, param, channel)
  67.     param = param:lower()
  68.     print(param)
  69.     if param == "" then
  70.         str = "Auras disponíveis: "
  71.         for x,i in pairs(auras) do
  72.             str = str.."\n<"..maiuscular(x).."> - "..converterKK(i[2]).." "..(getPlayerStorageValue(cid,auras[x][3]) ~= -1 and "[Obtido]" or "")
  73.         end
  74.         doShowTextDialog(cid,8304, str.."\n\nUse !aura \"nome da aura\" para comprar uma aura! Exemplo: \"!aura Fogo\".")
  75.     elseif param == "off" then
  76.         setPlayerStorageValue(cid,aurast,0)
  77.         doPlayerSendCancel(cid,"Aura desligada.")
  78.     elseif auras[param] ~= nil then
  79.         local delay = 29110
  80.         if getPlayerStorageValue(cid,auras[param][3]) == -1 then
  81.             if doPlayerRemoveMoney(cid,auras[param][2]) then
  82.                 setPlayerStorageValue(cid,auras[param][3],1)
  83.                 doPlayerSendTextMessage(cid,22,"Você comprou a aura: "..maiuscular(param).."!")
  84.                 doSendMagicEffect(getThingPos(cid),12)
  85.             else
  86.                 doPlayerSendCancel(cid,"Você não tem dinheiro de suficiente. Esta aura custa "..converterKK(auras[param][2])..".")
  87.                 doSendMagicEffect(getThingPos(cid),2)
  88.             end
  89.         else
  90.             if getPlayerStorageValue(cid,delay) <= os.time() then
  91.                 doPlayerSendCancel(cid,"Aura escolhida: "..maiuscular(param).."!")
  92.                 setPlayerStorageValue(cid,aurast,param)
  93.                 doSendMagicEffect(getThingPos(cid),auras[param][1])
  94.                 doCreatureSay(cid,"Aura \""..maiuscular(param).."\"!",TALKTYPE_ORANGE_1)
  95.                 setPlayerStorageValue(cid,delay,os.time()+5)
  96.             else
  97.                 doPlayerSendCancel(cid,"Aguarde "..getPlayerStorageValue(cid,delay)-os.time().." segundos para trocar de Aura novamente.")
  98.                 doSendMagicEffect(getThingPos(cid),2)
  99.             end
  100.         end
  101.     else
  102.         doPlayerSendCancel(cid,"Aura não existente. Digite !aura para saber mais.")
  103.         doSendMagicEffect(getThingPos(cid),2)
  104.     end
  105.     return true
  106. end]]></talkaction>
  107. </mod>
Advertisement
Add Comment
Please, Sign In to add comment