Ir para conteúdo

Ajudemm?


Bababoom

Posts Recomendados

Boa noite galera do Xtibia,

venho aqui para lhes fazer um pedido creio eu que seja cumprido pelos excelentes membros do Xtibia.

______________________________________________________________________________

O script é o seguinte,é um Bank Sistem só que em vez de sacar e depositar GOLD, depositará e sacará "Bababoom Moedas" do ID 9971(gold ingot). O comando e por Talkaction... ficaria assim:

!sacar

!depositar

Quem me ajudar do REP++.

Conto com a ajuda de vocês.

Grato {ADM} Bababoom.

Link para o comentário
Compartilhar em outros sites

function onSay(cid, words, param)
local moneyID = 9971
local bankStorage = 23815
local param = string.explode(param, ",")

if getPlayerStorageValue(cid, bankStorage) == -1 then
setPlayerStorageValue(cid, bankStorage, 0)
doPlayerSendTextMessage(cid, 18, "Oh, I see this is your first time using our bank system. Here you are, your first bank account.")
return TRUE
end

if words == "!balance" then
doPlayerSendTextMessage(cid, 18, getPlayerStorageValue(cid, bankStorage) < 1 and "You don\'t have any "..getItemNameById(moneyID).." in your bank account." or "You have "..getPlayerStorageValue(cid, bankStorage).." "..getItemNameById(moneyID).." in your bank account.")
return TRUE
end

if not param[1] then
doPlayerSendCancel(cid, "Command requires param.")
return TRUE
end

if not tonumber(param[1]) and param[1] ~= "all" then
doPlayerSendCancel(cid, "Command requires numeric param or \'all\'.")
return TRUE
end

if words == "!deposit" then
if param[1] == "all" then
if getPlayerItemCount(cid, moneyID) >= 1 then
doPlayerSendTextMessage(cid, 18, "You\'ve deposited "..getPlayerItemCount(cid, moneyID).." "..getItemNameById(moneyID).." in your bank account, you have now "..getPlayerItemCount(cid, moneyID)+getPlayerStorageValue(cid, bankStorage).." "..getItemNameById(moneyID).." in your bank account.")
setPlayerStorageValue(cid, bankStorage, getPlayerStorageValue(cid, bankStorage)+getPlayerItemCount(cid, moneyID))
doPlayerRemoveItem(cid, moneyID, getPlayerItemCount(cid, moneyID))
else
doPlayerSendCancel(cid, "You don\'t have any "..getItemNameById(moneyID).." in your bag to deposit.")
end
return TRUE
end

if getPlayerItemCount(cid, moneyID) >= tonumber(param[1]) then
setPlayerStorageValue(cid, bankStorage, getPlayerStorageValue(cid, bankStorage)+param[1])
doPlayerRemoveItem(cid, moneyID, param[1])
doPlayerSendTextMessage(cid, 18, "You\'ve deposited "..param[1].." "..getItemNameById(moneyID).." to your bank account, you have now "..getPlayerStorageValue(cid, bankStorage).." "..getItemNameById(moneyID).." in your bank account.")
else
doPlayerSendCancel(cid, "You don\'t have enough money in your bag.")
end
elseif words == "!withdraw" then
if param[1] == "all" then
if getPlayerStorageValue(cid, bankStorage) >= 1 then
doPlayerSendTextMessage(cid, 18, "You\'ve withdrawned "..getPlayerStorageValue(cid, bankStorage).." "..getItemNameById(moneyID).." from your bank account, you have now 0 "..getItemNameById(moneyID).." in your bank account.")
doPlayerAddItem(cid, moneyID, getPlayerStorageValue(cid, bankStorage))
setPlayerStorageValue(cid, bankStorage, 0)
else
doPlayerSendCancel(cid, "You don\'t have any "..getItemNameById(moneyID).." in your bag to deposit.")
end
return TRUE
end
if getPlayerStorageValue(cid, bankStorage) >= tonumber(param[1]) then
doPlayerAddItem(cid, moneyID, param[1])
setPlayerStorageValue(cid, bankStorage, getPlayerStorageValue(cid, bankStorage)-param[1])
doPlayerSendTextMessage(cid, 18, "You\'ve withdrawned "..param[1].." "..getItemNameById(moneyID).." from your bank account, you have now "..getPlayerStorageValue(cid, bankStorage).." "..getItemNameById(moneyID).." in your bank account.")
else
doPlayerSendCancel(cid, "You don\'t have enough money in your bank account.")
end
elseif words == "!transfer" then
if not isPlayer(getPlayerByName(param[2])) then
doPlayerSendCancel(cid, "Player with name "..param[2].." doesn\'t exists or is offline.")
return TRUE
end
player = getPlayerByName(tostring(param[2]))
if getPlayerItemCount(cid, moneyID) >= tonumber(param[1]) then
if getPlayerStorageValue(player, bankStorage) == -1 then
setPlayerStorageValue(player, bankStorage, 0)
doPlayerSendTextMessage(player, 18, "Your new bank account has been created.")
end
setPlayerStorageValue(player, bankStorage, getPlayerStorageValue(player, bankStorage)+param[1])
doPlayerRemoveItem(cid, moneyID, param[1])
doPlayerSendTextMessage(cid, 18, "You\'ve transfered "..param[1].." "..getItemNameById(moneyID).." from your bag to "..param[2].."\'s bank account.")
doPlayerSendTextMessage(player, 18, "You\'ve received "..param[1].." "..getItemNameById(moneyID).." from "..getCreatureName(cid)..", it was deposited to your bank account. You have now "..getPlayerStorageValue(player, bankStorage).." "..getItemNameById(moneyID).." in your bank account.")
elseif getPlayerStorageValue(cid, bankStorage) >= tonumber(param[1]) then
if getPlayerStorageValue(player, bankStorage) == -1 then
setPlayerStorageValue(player, bankStorage, 0)
doPlayerSendTextMessage(player, 18, "Your new bank account has been created.")
end
setPlayerStorageValue(player, bankStorage, getPlayerStorageValue(player, bankStorage)+param[1])
setPlayerStorageValue(cid, bankStorage, getPlayerStorageValue(cid, bankStorage)-param[1])
doPlayerSendTextMessage(cid, 18, "You\'ve transfered "..param[1].." "..getItemNameById(moneyID).." from your bank account to "..param[2].."\'s bank account, you have now "..getPlayerStorageValue(cid, bankStorage).." "..getItemNameById(moneyID).." in your bank account.")
doPlayerSendTextMessage(player, 18, "You\'ve received "..param[1].." "..getItemNameById(moneyID).." from "..getCreatureName(cid)..", it was deposited to your bank account. You have now "..getPlayerStorageValue(player, bankStorage).." "..getItemNameById(moneyID).." in your bank account.")
else
doPlayerSendCancel(cid, "You don\'t have enough money in your bag or bank account.")
end
end

return TRUE
end

 

Tags:

<talkaction words="!deposit;!withdraw;!transfer;!balance" event="script" value="bankSystem.lua"/>

Funcionando 100%, qualquer erro que tenha dado poste aqui.

Editado por Byerne
Link para o comentário
Compartilhar em outros sites

  • 3 weeks later...
×
×
  • Criar Novo...