Postado Janeiro 23, 2017 8 anos Fala galera, peguei um comando aqui no TK, de !withdraw tirar dinheiro do banco, mais não esta funcionando está dando erro em linha 9! Citar [Error - TalkAction Interface] data/talkactions/scripts/withdraw.lua:onSay Description: data/talkactions/scripts/withdraw.lua:9: attempt to compare string with number stack traceback: data/talkactions/scripts/withdraw.lua:9: in function Scripts 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 -----------> ERRO NESSA LINHA 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
Postado Janeiro 23, 2017 8 anos Tenta 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 Editado Janeiro 23, 2017 8 anos por Noob II (veja o histórico de edições)
Postado Janeiro 23, 2017 8 anos Autor 7 minutos atrás, Noob II disse: Tenta 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 Testei ta acusando que o meu player nao tem money! 00:12 Your account balance is 3616 gold.
Postado Janeiro 23, 2017 8 anos Solução 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 testa ai
Postado Janeiro 23, 2017 8 anos Autor 28 minutos atrás, brendoonh disse: 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 testa ai Obrigado @brendoonh ajudo muito!!
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.