Ir para conteúdo
  • 0

[Pedido] Novo Bank System.


Marcelo96

Pergunta

Tipo do script: Talkaction

Protocolo: 8.60

Servidor utilizado: Styller Yourots 0.8

Nível de experiência: Médio

 

Preciso de um Bank system que enves de ser com dinheiro normal, ser com o item " ID -> 9971 "

 

Se ajudar, tenho estes scripts com dinheiro normal:

 

Balance.lua

 

function onSay(cid, words, param)

 

local config = {

bankSystemEnabled = getBooleanFromString(getConfigInfo('bankSystem')),

playerIsFighting = hasCondition(cid, CONDITION_INFIGHT)

}

 

if config.bankSystemEnabled == TRUE then

if config.playerIsFighting == FALSE then

 

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your account balance is " .. getPlayerBalance(cid) .. ".")

return TRUE

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bank can not be used in fight.")

return TRUE

end

else

return FALSE

end

end

 

 

Deposit.lua

 

function onSay(cid, words, param)

 

local config = {

bankSystemEnabled = getBooleanFromString(getConfigInfo('bankSystem')),

playerIsFighting = hasCondition(cid, CONDITION_INFIGHT)

}

 

if config.bankSystemEnabled == TRUE then

if config.playerIsFighting == FALSE then

 

if(param == "") then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command requires param.")

return TRUE

end

 

local m = tonumber(param)

 

if(not m) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command requires numeric param.")

return TRUE

end

 

m = math.abs(m)

if m <= getPlayerMoney(cid) then

doPlayerDepositMoney(cid, m)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Alright, you have added the amount of " .. m .. " gold to your balance. You can withdraw your money anytime you want to. Your account balance is " .. getPlayerBalance(cid) .. ".")

 

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You do not have enough money.")

end

return TRUE

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bank can not be used in fight.")

return TRUE

end

else

return FALSE

end

end

 

 

 

withdraw.lua

 

 

function onSay(cid, words, param)

 

local config = {

bankSystemEnabled = getBooleanFromString(getConfigInfo('bankSystem')),

playerIsFighting = hasCondition(cid, CONDITION_INFIGHT)

}

 

if config.bankSystemEnabled == TRUE then

if config.playerIsFighting == FALSE then

 

local m = tonumber(param)

 

if(param == "") then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command requires param.")

return TRUE

end

 

if(not m) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command requires numeric param.")

return TRUE

end

 

m = math.abs(m)

if m <= getPlayerBalance(cid) then

doPlayerWithdrawMoney(cid, m)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Here you are, " .. m .. " gold. Your account balance is " .. getPlayerBalance(cid) .. ".")

 

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "There is not enough gold on your account.")

end

return TRUE

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bank can not be used in fight.")

return TRUE

end

else

return FALSE

end

end

 

+Reputação Para quem ajudar (:

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

Ta ae:

Copie um arquivo, renomei-e ele para BankSystem.lua e em dentro bote:

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

 

Agora abra o talkactions.xml na pasta data/talkactions.

 

E coloque:

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

 

Espero ter ajudado.

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

×
×
  • Criar Novo...