Advertisement
Guest User

Caixa Eletrônico

a guest
Nov 18th, 2012
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.09 KB | None | 0 0
  1. <?xml version="1.0" encoding="ISO-8859-1"?>  
  2. <mod name="Caixa Eletronico System" version="1.0" author="LuckOake" contact="none" enabled="yes">
  3. <config name="caixa"><![CDATA[
  4. stor = 41319
  5. caixa_id = 1354
  6. bank_pos = {x = 78, y = 39, z = 7}
  7. msgs = {
  8.         [1] = "'balance' ou 'saldo' para ver seu saldo em conta.",
  9.         [2] = "'deposit' ou 'depositar' para depositar dinheiro em sua conta.",
  10.         [3] = "'withdraw' ou 'sacar' para sacar dinheiro de sua conta.",
  11.         [4] = "'transfer' ou 'transferir' para transferir dinheiro para uma outra conta. Comando: transfer,quantia,nome",
  12.         [5] = "'trocar gold' para trocar suas gold coins por platinum coins. Comando: trocar gold,número de platinum coins",
  13.         [6] = "'trocar platinum' para trocar suas platinum coins por gold coins ou crystal coins. Comando: trocar platinum,gold ou crystal,número",
  14.         [7] = "'trocar crystal' para trocar suas crystal coins por platinum coins. Comando: trocar crystal,número de platinum coins",
  15.         [8] = "'sair' ou 'exit' para sair.",
  16.         }
  17. ]]></config>
  18. <action itemid="2556" event="script"><![CDATA[
  19. domodlib('caixa')
  20.         if getPlayerStorageValue(cid, stor) ~= -1 then return true
  21.         elseif itemEx.itemid ~= caixa_id then
  22.                 doPlayerSendCancel(cid, "Você só pode usar esse item em um caixa eletrônico.") return true
  23.         end
  24.  
  25.                 setPlayerStorageValue(cid, stor, 1)
  26.                 doPlayerSetNoMove(cid, true)
  27.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Caixa Eletrônico: Olá! Digite !caixa + um dos parâmetros abaixo:")
  28.         for a, b in ipairs(msgs) do
  29.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Caixa Eletrônico: "..b.."")
  30.         end
  31. return true
  32. ]]></action>
  33. <talkaction words="!caixa" event="buffer"><![CDATA[
  34. domodlib('caixa')
  35.         t = string.explode(param, ",")
  36.        
  37.         if getPlayerStorageValue(cid, stor) ~= 1 then return true end
  38.         if t[1] == "balance" or t[1] == "saldo" then
  39.                 if t[2] then return true end
  40.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Caixa Eletrônico: Você possui "..getPlayerBalance(cid).." gold coins em sua conta bancária.")
  41.         elseif t[1] == "deposit" or t[1] == "depositar" then
  42.                 if not t[2] or not tonumber(t[2]) or t[3] then
  43.                         doPlayerSendCancel(cid, "Incorrect params.") return true
  44.                 elseif not doPlayerDepositMoney(cid, tonumber(t[2])) then
  45.                         doPlayerSendCancel(cid, "Você não possui essa quantia em dinheiro.") return true
  46.                 end
  47.                
  48.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Caixa Eletrônico: Você depositou "..t[2].." gold coins em sua conta. Seu saldo agora é de "..getPlayerBalance(cid).." gold coins.")
  49.         elseif t[1] == "withdraw" or t[1] == "sacar" then
  50.                 if not t[2] or not tonumber(t[2]) or t[3] then
  51.                         doPlayerSendCancel(cid, "Incorrect params.") return true
  52.                 elseif getPlayerBalance(cid) < tonumber(t[2]) then
  53.                         doPlayerSendCancel(cid, "Você não possui essa quantia de dinheiro em sua conta.") return true
  54.                 end
  55.                
  56.                         doPlayerWithdrawMoney(cid, tonumber(t[2]))
  57.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Caixa Eletrônico: Você sacou "..t[2].." gold coins de sua conta. Seu saldo agora é de "..getPlayerBalance(cid).." gold coins.")
  58.         elseif t[1] == "transfer" or t[1] == "transferir" then
  59.                 if not t[2] or not tonumber(t[2]) or not t[3] or not tostring(t[3]) or t[4] then
  60.                         doPlayerSendCancel(cid, "Incorrect params.") return true
  61.                 elseif getPlayerBalance(cid) < tonumber(t[2]) then
  62.                         doPlayerSendCancel(cid, "Você não possui essa quantia de dinheiro em sua conta.") return true
  63.                 elseif not playerExists(t[3]) then
  64.                         doPlayerSendCancel(cid, "O player "..t[3].." não existe.") return true
  65.                 end
  66.                
  67.                         doPlayerTransferMoneyTo(cid, t[3], tonumber(t[2]))
  68.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Caixa Eletrônico: Você transferiu "..t[2].." gold coins de sua conta para "..t[3]..". Seu saldo agora é de "..getPlayerBalance(cid).." gold coins.")
  69.         elseif t[1] == "trocar gold" then
  70.                 if not t[2] or not tonumber(t[2]) or t[3] then
  71.                         doPlayerSendCancel(cid, "Incorrect params. Specify the number of platinum coins you want to get.") return true
  72.                 elseif not doPlayerRemoveItem(cid, 2148, (t[2]*100)) then
  73.                         doPlayerSendCancel(cid, "Você não possui "..(t[2]*100).." gold coins.") return true
  74.                 end
  75.                
  76.                         doPlayerAddItem(cid, 2152, t[2])
  77.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Caixa Eletrônico: Você trocou "..(t[2]*100).." gold coins por "..t[2].." platinum coins.")
  78.         elseif t[1] == "trocar platinum" then
  79.                 if t[2] == "gold" then
  80.                         if not t[3] or not tonumber(t[3]) or t[4] then
  81.                                 doPlayerSendCancel(cid, "Incorrect params. Specify the number of platinum coins you want to change to gold coins.") return true
  82.                         elseif not doPlayerRemoveItem(cid, 2152, tonumber(t[3])) then
  83.                                 doPlayerSendCancel(cid, "Você não possui "..t[3].." platinum coins.") return true
  84.                         end
  85.                
  86.                                 doPlayerAddItem(cid, 2148, tonumber(t[3]*100))
  87.                                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Caixa Eletrônico: Você trocou "..t[3].." platinum coins por "..(t[3]*100).." gold coins.")
  88.                 elseif t[2] == "crystal" then
  89.                         if not t[3] or not tonumber(t[3]) or t[4] then
  90.                                 doPlayerSendCancel(cid, "Incorrect params. Specify the number of crystal coins you want to get.") return true
  91.                         elseif not doPlayerRemoveItem(cid, 2152, tonumber(t[3]*100)) then
  92.                                 doPlayerSendCancel(cid, "Você não possui "..(t[3]*100).." platinum coins.") return true
  93.                         end
  94.                
  95.                                 doPlayerAddItem(cid, 2160, tonumber(t[3]))
  96.                                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Caixa Eletrônico: Você trocou "..(t[3]*100).." platinum coins por "..t[3].." crystal coins.")
  97.                 else
  98.                         return doPlayerSendCancel(cid, "Incorrect params. Utilize o comando assim: trocar platinum,gold ou crystal,quantia")
  99.                 end
  100.         elseif t[1] == "trocar crystal" then
  101.                 if not t[2] or not tonumber(t[2]) or t[3] then
  102.                         doPlayerSendCancel(cid, "Incorrect params. Specify the number of crystal coins you want to change to platinum coins.") return true
  103.                 elseif not doPlayerRemoveItem(cid, 2160, tonumber(t[2])) then
  104.                         doPlayerSendCancel(cid, "Você não possui "..t[2].." crystal coins.") return true
  105.                 end
  106.                
  107.                         doPlayerAddItem(cid, 2152, tonumber(t[2]*100))
  108.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Caixa Eletrônico: Você trocou "..t[2].." crystal coins por "..(t[2]*100).." platinum coins.")
  109.         elseif t[1] == "sair" or t[1] == "exit" then
  110.                 doTeleportThing(cid, bank_pos)
  111.                 setPlayerStorageValue(cid, stor, -1)
  112.                 doPlayerSetNoMove(cid, false)
  113.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Caixa Eletrônico: Obrigado pela visita!")
  114.         else return doPlayerSendCancel(cid, "Incorrect Params.") end
  115. return true
  116. ]]></talkaction>
  117. </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement