Advertisement
Guest User

Caixa Eletrônico System

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