Ir para conteúdo

Featured Replies

Postado

Comando

!balance

!deposit

!withdraw

 

Instalando

balance.lua

function onSay(cid, words, param) 
    if getTilePzInfo(getPlayerPosition(cid)) == TRUE then 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your account balance is ".. getPlayerBalance(cid) .." gold.") 
    else 
        doPlayerSendCancel(cid, "You can only use this command in PZ.") 
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) 
    end 
end 

deposit.lua

function onSay(cid, words, param) 
    if getPlayerTown(cid) == 24 then --------- ID DA CIDADE
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot deposit money being in Rookgaard.") 
        return 
    end 
     
    if isPlayer(cid) == TRUE and param ~= "" then 
        if getTilePzInfo(getPlayerPosition(cid)) == TRUE then 
                if    doPlayerRemoveMoney(cid, param) == TRUE then 
                    doPlayerSetBalance(cid, param) 
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have added the amount of ".. param .." gold to your balance. You can withdraw your money anytime you want to.") 
                else 
                    doPlayerSendCancel(cid, "You do not have enough money.") 
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) 
                end 
        else 
            doPlayerSendCancel(cid, "You can only use this command in PZ.") 
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) 
        end 
    end 
end

withdraw.lua

function onSay(cid, words, param) 
    if getPlayerTown(cid) == 24 then 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot withdraw money being in Rookgaard.") 
        return 
    end 
     
    if isPlayer(cid) == TRUE and param ~= "" then 
        if getTilePzInfo(getPlayerPosition(cid)) == TRUE then 
                if getPlayerBalance(cid) >= param then 
                    doPlayerSetBalance(cid, getPlayerBalance(cid) - param) 
                    doPlayerAddMoney(cid, param) 
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Here you are, ".. param .." gold.") 
                else 
                    doPlayerSendCancel(cid, "You do not have enough money.") 
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) 
                end 
        else 
            doPlayerSendCancel(cid, "You can only use this command in PZ.") 
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) 
        end 
    end 
end

talkactions.xml

<talkaction words="!balance" script="balance.lua" />
<talkaction words="!deposit" script="deposit.lua" />
<talkaction words="!withdraw" script="withdraw.lua" />

Créditos

  • Rurouni
Postado
if getTilePzInfo(getPlayerPosition(cid)) == TRUE then

Não precisa do TRUE, alias, é uma gambiarra do TFS esse TRUE em maiúscula! Existem varios casos do TRUE nos 3 scripts.

 

if getPlayerTown(cid) == 24 then --------- ID DA CIDADE


Ficaria melhor ser editável esse id de cidade, pois rook pode ser outro town id em alguns ots!
if doPlayerRemoveMoney(cid, param) == TRUE then

Espaçamento incorreto!

 

Tópico aprovado, obrigado por compartilhar! :D

 

Este tópico foi movido: Para: "OTServScriptingActions e TalkActions"

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo