Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Bastante pessoa quer o sistema de Bank,que a maioria sempre ta bugada,então vou postar uma aqui,que está sem BUG.

1.Primeiramente vá na pasta talkactions crie uma pasta chamada Bank.Dentro da pasta Bank faça arquivos (.lua) chamados...

Balance

Deposit

Deposit_All

Transfer

Transfer_All

Withdraw

Withdraw_All

Spoiler

(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

divisoriap.png(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

divisoriap.png(deposit_all.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, "Alright, you have added the amount of " .. getPlayerMoney(cid) .. " gold to your balance. You can withdraw your money anytime you want to.")

doPlayerDepositAllMoney(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

divisoriap.png(transfer.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 == TRUE then

if(param == "") then

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

return TRUE

end

local t = string.explode(param, ",")

local m = tonumber(t[2])

local tmp = string.explode(t[2], ",")

if(not m) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "No money specified.")

return TRUE

end

m = math.abs(m)

if m <= getPlayerBalance(cid) then

if playerExists(t[1]) then

doPlayerTransferMoneyTo(cid, t[1], m)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have transferred " .. m .. " gold to " .. t[1] .. ". Your account balance is " .. getPlayerBalance(cid) .. " gold.")

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Player " .. t[1] .. " does not exist.")

end

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "There is not enough gold on your account. Your account balance is " .. getPlayerBalance(cid) .. ". Please tell the amount of gold coins you would like to transfer.")

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

divisoriap.png(transfer_all)

 

 function onSay(cid, words, param)

local config = {

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

playerIsFighting = hasCondition(cid, CONDITION_INFIGHT)

}

if config.bankSystemEnabled == TRUE then

if(param == "") then

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

return TRUE

end

local t = string.explode(param, ",")

if playerExists(param) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have transferred " .. getPlayerBalance(cid) .. " gold to " .. param .. ".")

doPlayerTransferAllMoneyTo(cid, param)

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Player " .. param .. " does not exist.")

return TRUE

end

else

return FALSE

end

end

divisoriap.png(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

divisoriap.png(withdraw_all.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, "Here you are, " .. getPlayerBalance(cid) .. " gold.")

doPlayerWithdrawAllMoney(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
Agora vá em talkactions.lua e coloque isso...deixando separado dos outros.
 
<!-- Bank -->

<talkaction log="yes" words="!balance" script="bank\balance.lua">

<talkaction log="yes" words="!deposit" script="bank\deposit.lua">

<talkaction log="yes" words="!withdraw" script="bank\withdraw.lua">

<talkaction log="yes" words="!transfer" script="bank\transfer.lua">

<talkaction log="yes" words="!depositall" script="bank\deposit_all.lua">

<talkaction log="yes" words="!withdrawall" script="bank\withdraw_all.lua">

<talkaction log="yes" words="!transferall" script="bank\transfer_all.lua">

O Tutorial foi esse,espero que tenham gostado. e por ultimo : Comandos,e para que servem.

 
!balance ,Para você ver quanto você tem na sua conta bancaria.

!deposit ,Para você depositar certa quantia Ex:!deposit 100.

!withdraw ,Para você Retirar certa quantia Ex:!withdraw 100.

!transfer ,Para você transferir certa quantia para outro player.

!depositall ,Para você depositar tudo o que tem na Backpack.

!withdrawall ,Para você retirar tudo o que tem na sua conta.

!transferall ,Para você transferir tudo o que tem para outro player.

Obrigado,

Abraços.

separa10.png

husl5cs.png



click.gif

Link para o post
Compartilhar em outros sites
  • 2 years later...

O tópico foi movido para a área correta, preste mais atenção da próxima vez!

Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680

Este tópico foi movido:

De: "OTServScriptingTutoriais de Scripting"

Para: "OTServScriptingActions e TalkActions"

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Link para o post
Compartilhar em outros sites
  • 3 weeks later...
  • 11 months later...
  • 2 months later...
  • 3 years later...

estou tentando fazer pra versã 7.4 e não está funcionando,
o Script a cima tem um erro no arquivo .xml

ao final do 

<talkaction log="yes" words="!balance" script="bank\balance.lua">

adicione uma "/" e ficará assim:

<talkaction log="yes" words="!balance" script="bank\balance.lua"/>

Assim o serv irá abrir, porém ainda não funcionou

image.thumb.png.9e4b7ef58c791445f19cbfcddfa88ed0.png

 

Fica aparecendo esse erro agora.

 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por looktsx
      Salve Rapaziada tudo bom .
      queria ajuda pra cria um teleport ou uma alavanca com tempo ..
      depois do player usa o teleport ou a lavanca ele so poderá usa depois de tal determinado tempo.
       
      SERVIDOR 12.91
      Se alguem poder me ajuda vou fica grato ,
      des de ja agradeço a todos.
      ..
    • Por willian646
      O evento é totalmente baseado no Foxy Quiz proveniente do GLA, no entanto é apenas uma base para vocês alterarem como acharem melhor.
      Para começar será necessario que você crie um arquivo em talkactions>scripts para entrar no evento, como por exemplo : participar.lua
      e entao colocar sua tag em talkactions.xml, como por exemplo: 
      <talkaction words="!participar;/participar" script="!participar.lua"/> Tendo feito isso você irá colar esse codigo dentro desse arquivo: 
      function onSay(cid, words, param)pos = {x=1236, y=1125, z=15} --POSIÇAO QUE O PLAYER IRÁ COM O COMANDO if getGlobalStorageValue(88788) == 1 then doSendMagicEffect(getPlayerPosition(cid),19) doTeleportThing(cid,pos) else doPlayerSendCancel(cid, "Desculpe mas o evento esta fechado !") end return true end Agora iremos para o script principal, vá em global events>scripts e crie o arquivo pokequiz.lua em seguida coloque sua tag em globalevents.xml como por exemplo: 
      <globalevent name="Pokequiz" interval="10" event="script" value="pokequiz.lua"/> Lembrando que o intervalo de inicio do evento é com vcs, Tendo feito isso abra o arquivo e cole o  seguinte código dentro : 
      quizstrg = 88788 local wave = 0 local CPpos = {x=1051, y=1047, z=7} --POSIÇAO QUE O PLAYER IRÁ SE ERRAR function wave_acresc() wave = wave + 1 addEvent(Quiz, 5000) end function Quiz() if wave == 1 then doBroadcastMessage("Na serie pokemon RAYQUAZA possui mega evolucao ?", RED) addEvent(Resposta, 10000) elseif wave == 2 then doBroadcastMessage("Na serie pokemon ARCEUS e considerado um pokemon RARO ?", RED) addEvent(Resposta, 10000) elseif wave == 3 then doBroadcastMessage("Na serie pokemon MEW criou os 3 caes lendarios ?", RED) addEvent(Resposta, 10000) elseif wave == 4 then doBroadcastMessage("Na serie pokemon ARCEUS tem o poder de mudar de tipo livremente ?", RED) addEvent(Resposta, 10000) elseif wave == 5 then doBroadcastMessage("Na serie pokemon GIRATINA possui 2 formas sendo elas alterada e fantasma ?", RED) addEvent(Resposta, 10000) elseif wave == 6 then doBroadcastMessage("Na serie pokemon DIALGA e PALKIA sao rivais ?", RED) addEvent(Resposta, 10000) elseif wave == 7 then doBroadcastMessage("Na serie pokemon CELEBI possui a habilidade de viajar entre dimensoes ?", RED) addEvent(Resposta, 10000) elseif wave == 8 then doBroadcastMessage("Na serie pokemon SOLGALEO e a primeira evolucao de cosmog ?", RED) addEvent(Resposta, 10000) elseif wave == 9 then doBroadcastMessage("Na serie pokemon MAGEARNA e uma das ultra beasts ?", RED) addEvent(Resposta, 10000) elseif wave == 10 then doBroadcastMessage("Na serie pokemon a cor original de MAGEARNA e laranja ?", RED) addEvent(Resposta, 10000) elseif wave == 11 then doBroadcastMessage("O evento Quiz terminou !", RED) addEvent(winPlayers, 5000) end end function Resposta() if wave == 1 then addEvent(TPFalso, 5000) elseif wave == 2 then addEvent(TPVerdadeiro, 5000) elseif wave == 3 then addEvent(TPVerdadeiro, 5000) elseif wave == 4 then addEvent(TPFalso, 5000) elseif wave == 5 then addEvent(TPVerdadeiro, 5000) elseif wave == 6 then addEvent(TPFalso, 5000) elseif wave == 7 then addEvent(TPVerdadeiro, 5000) elseif wave == 8 then addEvent(TPVerdadeiro, 5000) elseif wave == 9 then addEvent(TPVerdadeiro, 5000) elseif wave == 10 then addEvent(TPFalso, 5000) end end function TPFalso() for _, sid in ipairs(getPlayersOnline()) do local posi = {x=1236, y=1122, z=15} local posf = {x=1243, y=1128, z=15} local pos = getPlayerPosition(sid) if isInArea(pos, posi, posf) then doTeleportThing(sid,CPpos) end addEvent(wave_acresc, 5000) end end function TPVerdadeiro() for _, sid in ipairs(getPlayersOnline()) do local posi = {x=1228, y=1122, z=15} local posf = {x=1235, y=1128, z=15} local pos = getPlayerPosition(sid) if isInArea(pos, posi, posf) then doTeleportThing(sid,CPpos) end addEvent(wave_acresc, 5000) end end function winPlayers() for _, sid in ipairs(getPlayersOnline()) do local posi = {x=1228, y=1122, z=15} local posf = {x=1243, y=1128, z=15} local pos = getPlayerPosition(sid) if isInArea(pos, posi, posf) then doTeleportThing(sid,CPpos) doPlayerAddItem(sid,2159, 10) end wave = 0 setGlobalStorageValue(88788, 0) end end --AVISOS DE INICIO function finalEventWarning() if getGlobalStorageValue(quizstrg) == 1 then setGlobalStorageValue(88788, 2) doBroadcastMessage("O evento Quiz fechou, a primeira pergunta surgira em 30 segundos.", RED) addEvent(wave_acresc, 30000) end end function secondEventWarning() if getGlobalStorageValue(quizstrg) == 1 then doBroadcastMessage("O evento Quiz ira iniciar em 1 minuto, usem o comando !participar ou /participar.", RED) addEvent(finalEventWarning, 60000) end end function firstEventWarning() if getGlobalStorageValue(quizstrg) == 1 then doBroadcastMessage("O evento Quiz ira iniciar em 3 minutos, usem o comando !participar ou /participar.", RED) addEvent(secondEventWarning, 120000) end end function onThink(interval, lastExecution) if getGlobalStorageValue(quizstrg) == 0 then setGlobalStorageValue(88788, 1) doBroadcastMessage("O evento Quiz ira iniciar em 5 minutos, usem o comando !participar ou /participar.", RED) addEvent(firstEventWarning, 120000) end return true end Já ia me esquecendo, a unica coisa ao qual vocês devem mudar de acordo com as coordenadas do seu mapa e área do evento são as funções TPVerdadeiro , TPFalso, winPlayers , elas servem para indicar qual área é a errada e teleportar quem tiver nessa área pro cp, caso o lado errado seja o esquerdo então será usado a função  TPVerdadeiro, e é a msm coisa para o outro lado, no caso da winPlayers é toda a área do evento.
       
      Aqui vai um exemplo: 
       
      E é isso rapaziada, não sei se já possui algum evento parecido por essas bandas, mas eu não encontrei ,então fiz  e resolvi contribuir com a comunidade, peço que se for repostar em algum outro lugar dê os devidos créditos, obg e até a próxima.
    • Por Ghaz
      Fala pessoal tudo bem?
       
      Estou com dificuldades em um script e preciso da ajuda dos magos do LUA rs.
       
      Tenho um script que quando o player morre (onDeath), ele faz algumas coisas e depois ele chama uma função que deveria retornar uma table (array) para eu fazer o for com o ipairs certinho. Segue abaixo o código:
       
       
      Segue abaixo a função getPlayersInArea:
       
       
      Acontece que no código de cima (do primeiro spoiler) eu dou um print no retorno da função getPlayersInArea, porém ela não tá me retornando a table, tá me retornando só: 2
       
       
       
      Alguém consegue me ajudar em, como raios eu faço a função retornar a lista de players ao invés da quantidade? Acredito que ta retornando o count da table, e não os itens do array.
       
       
      Agradeço desde já, valeu tchurma!
    • Por sannn
      --[[ /////////////////////////////////////////////////////////////////////////////////////////////////////// Discord: San#7791 -- Loja System 2.0 -- TFS 0.3.6 -- para adicionar qualquer item na loja: basta adicionar na tabelinha, seguindo o exemplo do vip! valor = quantidade de DIAMOND a ser cobrada; itemID = item a ser recebido; quantidade = quantidade de itens a ser recebidos; msg = mensagem que o player vai receber após comprar! Feito por San Discord: San#7791 exemplo de como comprar: !loja vip podendo ser adicionado a modules também. tag talkactions.xml // <talkaction words="!loja" case-sensitive="no" event="script" value="Loja System 2.0.lua"/> ////////////////////////////////////////////////////////////////////////////////////////////////////// depois de tantos sistemas com mil elseifs, vim trazer esta contribuição simples, para facilitar a vida de muitos adms! Contribuição pra comunidade =D ]]-- LOJA_CANCEL = "Você não possui diamantes o suficiente." LOJA_INVALID = "Não temos este item a venda na loja!" INVALID = "Comando incorreto" DIAMOND = 2145 -- item que será cobrado; tabelinha = { ["vip"] = {valor = 5, itemID = 2160, quantidade = 1, msg = "Obrigado por comprar um VIP em nossa loja!"}, -- coloque sempre minusculo o nome ! ["vip"]... etc } function onSay(cid, words, param, channel) local msg = string.lower(param) -- Não mexa! if msg == "" then doPlayerSendTextMessage(cid, 22, INVALID) return true end -- verificação if tabelinha[msg] == nil then doPlayerSendTextMessage(cid, 22, INVALID) return true end -- verificação if tabelinha[msg].valor then if getPlayerItemCount(cid, DIAMOND) >= tabelinha[msg].valor then doPlayerRemoveItem(cid, DIAMOND, tabelinha[msg].valor) doPlayerAddItem(cid, tabelinha[msg].itemID, tabelinha[msg].quantidade) doPlayerSendTextMessage(cid, 20, tabelinha[msg].msg) else doPlayerSendTextMessage(cid, 22, LOJA_CANCEL) return true end else doPlayerSendTextMessage(cid, 22, LOJA_INVALID) end return true end  
    • Por Scorpiondaniel
      Quero que o balance do bank do personagem apareça na conta do cara no site

      Script usado:
       
       
       

      NPC BANKMAN
      <?xml version="1.0" encoding="UTF-8"?> <npc name="BankMan" script="data/npc/scripts/bank.lua" walkinterval="25" floorchange="0" access="5" > <health now="150" max="150"/> <look type="132" head="115" body="0" legs="114" feet="0" addons="3" corpse="2212"/> <parameters> <parameter key="message_greet" value="Welcome |PLAYERNAME|! Here, you can {deposit}, {withdraw} or {transfer} your money from your bank account. I can change your coins too."/> <parameter key="message_alreadyfocused" value="You are drunked ? I talk with you."/> <parameter key="message_farewell" value="Goodbye. I wanna see your money... oh you again."/> </parameters> </npc>  
       
       
      bank.lua
      local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid --------------------MESSAGES------------------------------------------------------------------------------ if msgcontains(msg, 'deposit') then selfSay('Please tell me how much gold it is you would like to deposit.', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'withdraw') then selfSay('Please tell me how much gold you would like to withdraw.', cid) talkState[talkUser] = 3 elseif msgcontains(msg, 'transfer') then selfSay('Please tell me the amount of gold coins you would like to transfer.', cid) talkState[talkUser] = 5 elseif msgcontains(msg, 'change gold') then selfSay('How many platinum coins do you want to get?', cid) talkState[talkUser] = 8 elseif msgcontains(msg, 'change platinum') then selfSay('Do you want to change your platinum coins to gold or crystal?', cid) talkState[talkUser] = 10 elseif msgcontains(msg, 'change crystal') then selfSay('How many crystal coins do you want to change to platinum?', cid) talkState[talkUser] = 15 elseif msgcontains(msg, 'balance') then n = getPlayerBalance(cid) selfSay('Your balance are '..n..' golds.', cid) talkState[talkUser] = 0 ----------------------DEPOSIT------------------------------------------------------- elseif talkState[talkUser] == 1 then if msgcontains(msg, 'all') then n = getPlayerMoney(cid) selfSay('Do you want deposit '..n..' golds ?', cid) talkState[talkUser] = 2 else n = getNumber(msg) selfSay('Do you want deposit '..n..' golds ?', cid) talkState[talkUser] = 2 end elseif talkState[talkUser] == 2 then if msgcontains(msg, 'yes') then if getPlayerMoney(cid) >= n then doPlayerDepositMoney(cid,n) selfSay('Sucessfull. Now your balance account is ' ..getPlayerBalance(cid)..' golds.', cid) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) end else selfSay('Ok then', cid) end ----------------------WITHDRAW------------------------------------------------------------------------------------- elseif talkState[talkUser] == 3 then if msgcontains(msg, 'all') then n = getPlayerBalance(cid) selfSay('Do you want withdraw '..n..' golds ?', cid) talkState[talkUser] = 4 else n = getNumber(msg) selfSay('Do you want withdraw '..n..' golds ?', cid) talkState[talkUser] = 4 end elseif talkState[talkUser] == 4 then if msgcontains(msg, 'yes') then if getPlayerBalance(cid) >= n then doPlayerWithdrawMoney(cid, n) selfSay('Here you are, '..n..' gold. Now your balance account is ' ..getPlayerBalance(cid)..' golds.', cid) talkState[talkUser] = 0 else selfSay('There is not enough gold on your account', cid) end else selfSay('Ok then', cid) end ----------------------TRANSFER---------------------------------------------------------------------------------------- elseif talkState[talkUser] == 5 then if msgcontains(msg, 'all') then n = getPlayerBalance(cid) selfSay('Who would you like transfer '..n..' gold to?', cid) talkState[talkUser] = 6 else n = getNumber(msg) selfSay('Who would you like transfer '..n..' gold to?', cid) talkState[talkUser] = 6 end elseif talkState[talkUser] == 6 then p = msg selfSay('So you would like to transfer '..n..' gold to '..p..'?', cid) talkState[talkUser] = 7 elseif talkState[talkUser] == 7 then if msgcontains(msg, 'yes') then if getPlayerBalance(cid) >= n then if doPlayerTransferMoneyTo(cid, p, n) == TRUE then selfSay('You have transferred '..n..' gold to '..p..' and your account balance is '..getPlayerBalance(cid)..' golds.', cid) talkState[talkUser] = 0 else selfSay('This player does not exist. Please tell me a valid name!', cid) talkState[talkUser] = 0 end else selfSay('There is not enough gold on your account', cid) talkState[talkUser] = 0 end else selfSay('Ok then', cid) talkState[talkUser] = 0 end ----------------------CHANGE GOLD--------------------------------------------------------------------------------- elseif talkState[talkUser] == 8 then n = getNumber(msg) b = n * 100 selfSay('So I should change '..b..' of your gold coins to '..n..' platinum coins for you?', cid) talkState[talkUser] = 9 elseif talkState[talkUser] == 9 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2148, b) == TRUE then doPlayerAddItem(cid, 2152, n) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) talkState[talkUser] = 0 end else selfSay('Ok. We cancel.', cid) talkState[talkUser] = 0 end ---------------------CHANGE PLATINUM------------------------------------------------------------------------- elseif talkState[talkUser] == 10 then if msgcontains(msg, 'gold') then selfSay('How many platinum coins do you want to change to gold?', cid) talkState[talkUser] = 11 elseif msgcontains(msg, 'crystal') then selfSay('How many crystal coins do you want to get?', cid) talkState[talkUser] = 13 end elseif talkState[talkUser] == 11 then n = getNumber(msg) b = n * 100 selfSay('So I should change '..n..' of your platinum coins to '..b..' gold coins for you?', cid) talkState[talkUser] = 12 elseif talkState[talkUser] == 12 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2152, n) == TRUE then doPlayerAddItem(cid, 2148, b) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) talkState[talkUser] = 0 end else selfSay('Ok. We cancel.', cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 13 then n = getNumber(msg) b = n * 100 selfSay('So I should change '..b..' of your platinum coins to '..n..' crystal coins for you?', cid) talkState[talkUser] = 14 elseif talkState[talkUser] == 14 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2152, b) == TRUE then doPlayerAddItem(cid, 2160, n) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) talkState[talkUser] = 0 end else selfSay('Ok. We cancel.', cid) talkState[talkUser] = 0 end ---------------------CHANGE CRYSTAL------------------------------------------------------------------------------- elseif talkState[talkUser] == 15 then n = getNumber(msg) b = n * 100 selfSay('So I should change '..n..' of your crystal coins to '..b..' platinum coins for you?', cid) talkState[talkUser] = 16 elseif talkState[talkUser] == 16 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2160, n) == TRUE then doPlayerAddItem(cid, 2152, b) talkState[talkUser] = 0 else selfSay('You don\'t have money.', cid) talkState[talkUser] = 0 end else selfSay('Ok. We cancel.', cid) talkState[talkUser] = 0 end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) -- function maded by Gesior-- function getNumber(txt) --return number if its number and is > 0, else return 0 x = string.gsub(txt,"%a","") x = tonumber(x) if x ~= nill and x > 0 then return x else return 0 end end
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo