Bom galerinha, esse e um sistema de banco por comando :]
Como esse é meu segundo script aki do Xtibia pode haver erros , se ouver algo errado me fale.
Script feito por : IgorROOX2010
Versão que funciona : De 7.92 á 8.60
Bom então vamos la :happy:
Primeiro de tudo vá em talkactions.xml
E Coloque isso:
<!-- Sistema Banco -->
<talkaction words="!deposit" script="deposit.lua" />
<talkaction words="!withdraw" script="withdraw.lua" />
<talkaction words="!balance" script="balance.lua" />
<!-- Fim -->
Bom agora vamos ao primeiro script que é o deposit.lua
Pegue 1 arquivo lua nomeie para withdraw apague tudo e coloque isso:
function onSay(cid, words, param)setPlayerStorageValue(cid, 9224, param)
local count = getPlayerStorageValue(cid,9224)
playerpos = getPlayerPosition(cid)
msg = '$ $ $ $'
if param == 'all' then
count = getPlayerMoney(cid)
end
if count >= 1 then
if math.max(math.abs(playerpos.x-23), math.abs(playerpos.y-30)) < 9999 then
local control = getPlayerStorageValue(cid,9983)
if doPlayerRemoveMoney(cid,count) == TRUE then
setPlayerStorageValue(cid,9983,getPlayerStorageVal ue(cid,9983)+count)
doPlayerSay(cid,'Depositado '.. count .. ' a sua conta.',16)
doSendAnimatedText(playerpos, count, TEXTCOLOR_YELLOW)
else
doPlayerSay(cid,'Voçê Não possue dinheiro suficiente para depositar.',16)
doSendAnimatedText(playerpos, count, TEXTCOLOR_YELLOW)
end
end
end
return 1
end
Prontinho..
Agora vamos ao segundo script que é o withdraw.lua
Pegue 1 arquivo lua, nomeie para withdraw, apague tudo e coloque isso:
function onSay(cid, words, param)
setPlayerStorageValue(cid, 9224, param)
local count = getPlayerStorageValue(cid,9224)
ej = getPlayerSkull(cid)
playerpos = getPlayerPosition(cid)
msg = '$ $ $ $'
doSendAnimatedText(playerpos, count, TEXTCOLOR_YELLOW)
if count >= 1 then
if ej == 0 then
if math.max(math.abs(playerpos.x-23), math.abs(playerpos.y-30)) < 9999 then
local control = getPlayerStorageValue(cid,9983)
if control >= count then
setPlayerStorageValue(cid,9983,getPlayerStorageVal ue(cid,9983)-count)
doPlayerAddMoney(cid, count)
doPlayerSay(cid,'Retirado '.. count ..' de sua conta.',16)
else
doPlayerSay(cid,'voçê Não possue dinheiro suficiente! Escreva !balance para saber seu saldo.',16)
end
else
doPlayerSay(cid,'Pk Não tem direito a depositar nada!',17)
end
end
end
return 1
end
Prontinho..
Agora vamos para o ultimo script que é o balance.lua
Pegue 1 arquivo lua, nomeie para balance , apague tudo e coloque isso:
function onSay(cid, words, param)local control = getPlayerStorageValue(cid,9983)
doPlayerSay(cid,'Voçê possue: '.. control ..' gps em sua conta',17)
end
E prontinho, o sistema de banco via talkaction já esta funcionando em seu OTserver
Obrigado
Script By: IgorROOX2010