Guest User

Untitled

a guest
Jan 21st, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. local itemsSell = {
  2.     ["wpr shield"] = {itemId = 5931, idMoeda = 3911, custo = 100}, -- [nome do item] = id do item que ira vender, id da moeda que sera cobrada, quantidade de moeda que sera removida.
  3.     ["wpr legs"] = {itemId = 4545, idMoeda = 7532, custo = 200},
  4.     ["wpr helmet"] = {itemId = 7432, idMoeda = 1234, custo = 777},
  5.     ["wpr boots"] = {itemId = 3456, idMoeda = 2323, custo = 898},
  6.     ["wpr sword"] = {itemId = 5452, idMoeda = 4343, custo = 1},
  7.     ["wpr wand"] = {itemId = 1243, idMoeda = 2160, custo = 10000}
  8. }
  9.  
  10. function onSay(cid, words, param, channel)
  11. if param == "" then
  12.     doPlayerSendCancel(cid, "Paremetro invalido!")
  13. return true
  14. end
  15. param = string.lower(param)
  16. if itemsSell[param] then
  17.     if doPlayerRemoveItem(cid, itemsSell[param].idMoeda, itemsSell[param].custo) then
  18.         doPlayerAddItem(cid, itemsSell[param].itemId, 1)
  19.         doPlayerSendTextMessage(cid,4, "Parabéns você adquiriu um ".. getItemNameById(itemsSell[param].itemId) ..".")
  20.     else
  21.         doPlayerSendTextMessage(cid, 4, "São necessarios ".. itemsSell[param].custo .." ".. getItemNameById(itemsSell[param].idMoeda) .." para comprar este item.")
  22.     end
  23. else
  24.     doPlayerSendCancel(cid, "Este não é um item válido!")
  25. end
  26. return true
  27. end
Add Comment
Please, Sign In to add comment