Jump to content

Recommended Posts

Podem reparar que ao utilizarem a função doPlayerWithdrawMoney no console aparece um erro e o dinheiro não é transferido...

 

Como arrumar:

 

Abra o arquivo 050-function da pasta data/lib e reparem esta parte:

 

function doPlayerWithdrawMoney(cid, amount)

if(not getBooleanFromString(getConfigInfo('bankSystem'))) then

return false

end

local balance = getPlayerBalance(cid)

if ((amount > balance) or not (doPlayerAddMoney(cid, amount))) then

return false

end

 

doPlayerSetBalance(cid, balance - amount)

return true

end

 

Problema: O server interpreta o amount como uma string(tipo texto) e não consegue fazer a comparação com o balance que é do tipo number(número), então usamos a função tonumber() para transformar a string em number, ou seja, substitua a parte de vermelho por tonumber(amount) ficando assim:

 

function doPlayerWithdrawMoney(cid, amount)

if(not getBooleanFromString(getConfigInfo('bankSystem'))) then

return false

end

local balance = getPlayerBalance(cid)

if ((tonumber(amount) > balance) or not (doPlayerAddMoney(cid, amount))) then

return false

end

 

doPlayerSetBalance(cid, balance - amount)

return true

end

 

 

E voalá... funciona =D

 

 

Se postarem em outros lugares postem os créditos ¬¬

Link to comment
https://xtibia.com/forum/topic/128809-removendo-erro-withdraw-tfs-e-tcs/
Share on other sites

  • 3 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...