Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <mod name="Aura" version="1.0" author="Kaegipt" contact="facebook.com/eitor.laba" enabled="yes">
- <config name="auralib"><![CDATA[
- auras = {
- ["fogo"] = {36,1500000,11350},
- ["gelo"] = {41,1500000,11351},
- ["pedras"] = {44,1250000,11352},
- ["energia"] = {37,1250000,11353},
- ["tornado"] = {42,15000000,11354},
- }
- function converterKK(num)
- len = tostring(num):len()
- result = ""
- if len < 4 then
- result = result.."g"
- else
- len = len - 3
- quant = math.ceil(len/3)
- for x = 1, quant do
- result = result.."k"
- num = num / 1000
- end
- end
- return num..result
- end
- function maiuscular(str)
- result = ""
- local p = 1
- for x,i in pairs(str:explode(" ")) do
- if p ~= #str:explode(" ") then
- result = result..i:sub(0,1):upper()..i:sub(2,i:len()):lower().." "
- else
- result = result..i:sub(0,1):upper()..i:sub(2,i:len()):lower()
- end
- p = p + 1
- end
- return result
- end
- aurast = 30112]]></config>
- <event type="login" name="Registering" event="script"><![CDATA[
- domodlib('auralib')
- function onLogin(cid)
- registerCreatureEvent(cid, "Aura")
- return true
- end]]></event>
- <event type="think" name="Aura" event="script"><![CDATA[
- domodlib('auralib')
- function onThink(cid, interval)
- local ticks = 21963
- if getPlayerStorageValue(cid,aurast) ~= 0 then
- local aura = auras[getPlayerStorageValue(cid,aurast)]
- if aura ~= nil then
- if getPlayerStorageValue(cid,ticks) <= -1 then
- setPlayerStorageValue(cid,ticks,2)
- doSendMagicEffect(getThingPos(cid),aura[1])
- end
- end
- setPlayerStorageValue(cid,ticks,getPlayerStorageValue(cid,ticks)-1)
- end
- return true
- end]]></event>
- <talkaction words="!aura" event="script"><![CDATA[
- domodlib('auralib')
- function onSay(cid, words, param, channel)
- param = param:lower()
- print(param)
- if param == "" then
- str = "Auras disponíveis: "
- for x,i in pairs(auras) do
- str = str.."\n<"..maiuscular(x).."> - "..converterKK(i[2]).." "..(getPlayerStorageValue(cid,auras[x][3]) ~= -1 and "[Obtido]" or "")
- end
- doShowTextDialog(cid,8304, str.."\n\nUse !aura \"nome da aura\" para comprar uma aura! Exemplo: \"!aura Fogo\".")
- elseif param == "off" then
- setPlayerStorageValue(cid,aurast,0)
- doPlayerSendCancel(cid,"Aura desligada.")
- elseif auras[param] ~= nil then
- local delay = 29110
- if getPlayerStorageValue(cid,auras[param][3]) == -1 then
- if doPlayerRemoveMoney(cid,auras[param][2]) then
- setPlayerStorageValue(cid,auras[param][3],1)
- doPlayerSendTextMessage(cid,22,"Você comprou a aura: "..maiuscular(param).."!")
- doSendMagicEffect(getThingPos(cid),12)
- else
- doPlayerSendCancel(cid,"Você não tem dinheiro de suficiente. Esta aura custa "..converterKK(auras[param][2])..".")
- doSendMagicEffect(getThingPos(cid),2)
- end
- else
- if getPlayerStorageValue(cid,delay) <= os.time() then
- doPlayerSendCancel(cid,"Aura escolhida: "..maiuscular(param).."!")
- setPlayerStorageValue(cid,aurast,param)
- doSendMagicEffect(getThingPos(cid),auras[param][1])
- doCreatureSay(cid,"Aura \""..maiuscular(param).."\"!",TALKTYPE_ORANGE_1)
- setPlayerStorageValue(cid,delay,os.time()+5)
- else
- doPlayerSendCancel(cid,"Aguarde "..getPlayerStorageValue(cid,delay)-os.time().." segundos para trocar de Aura novamente.")
- doSendMagicEffect(getThingPos(cid),2)
- end
- end
- else
- doPlayerSendCancel(cid,"Aura não existente. Digite !aura para saber mais.")
- doSendMagicEffect(getThingPos(cid),2)
- end
- return true
- end]]></talkaction>
- </mod>
Advertisement
Add Comment
Please, Sign In to add comment