-
Quem Está Navegando 0 membros estão online
Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
Por davidguimaraesdrum
Eu uso o NPC BANK para deposito, transferências etc.. ele funciona corretamente, porem eu criei um novo gold (ID: 9971, Name: gold ingot, equivalente a 1kk cada barra) eu queria que os NPC trabalha-se também com essa gold, aonde eu consegui-se comprar itens e depositar essa moeda.
Alguem pode me ajudar?
NPC:
<?xml version="1.0" encoding="UTF-8"?> <npc name="Bradesco" script="data/npc/scripts/bankeiro.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="151" 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> Script:
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local moneyTo = {} local playerTo = {} 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 local function isValidMoney(money) if isNumber(money) == TRUE and money > 0 and money < 999999999 then return TRUE end return FALSE end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, 'help') or msgcontains(msg, 'offer') then selfSay("You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.", cid) talkState[cid] = 0 ----------------------------------------------------------------- ---------------------------- Balance ---------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'balance') or msgcontains(msg, 'Balance') then selfSay('Your account balance is '..getPlayerBalance(cid)..' gold.', cid) talkState[cid] = 0 ----------------------------------------------------------------- ---------------------------- Help ------------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'basic functions') then selfSay('You can check the {balance{ of your bank account, Pdeposit{ money or Pwithdraw{ it. You can also {transfer} money to othercharacters, provided that they have a vocation.', cid) talkState[cid] = 0 elseif msgcontains(msg, 'advanced functions') then selfSay('Renting a house has never been this easy. Simply make a bid for an auction. We will check immediately if you haveenough money.', cid) talkState[cid] = 0 ----------------------------------------------------------------- ---------------------------- Deposit ---------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'deposit all') then moneyTo[cid] = getPlayerMoney(cid) if moneyTo[cid] < 1 then selfSay('You don\'t have any money to deposit in you inventory..', cid) talkState[cid] = 0 else selfSay('Would you really like to deposit '..moneyTo[cid]..' gold?', cid) talkState[cid] = 2 end elseif msgcontains(msg, 'deposit') then selfSay("Please tell me how much gold it is you would like to deposit.", cid) talkState[cid] = 1 elseif talkState[cid] == 1 then moneyTo[cid] = tonumber(msg) if isValidMoney(moneyTo[cid]) == TRUE then selfSay('Would you really like to deposit '..moneyTo[cid]..' gold?', cid) talkState[cid] = 2 else selfSay('Is isnt valid amount of gold to deposit.', cid) talkState[cid] = 0 end elseif talkState[cid] == 2 then if msgcontains(msg, 'yes') then if doPlayerDepositMoney(cid, moneyTo[cid], 1) ~= TRUE then selfSay('You do not have enough gold.', cid) else selfSay('Alright, we have added the amount of '..moneyTo[cid]..' gold to your balance. You can withdraw your money anytime you want to. Your account balance is ' .. getPlayerBalance(cid) .. '.', cid) end elseif msgcontains(msg, 'no') then selfSay('As you wish. Is there something else I can do for you?', cid) end talkState[cid] = 0 ----------------------------------------------------------------- ---------------------------- Withdraw --------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'withdraw') then selfSay("Please tell me how much gold you would like to withdraw.", cid) talkState[cid] = 6 elseif talkState[cid] == 6 then moneyTo[cid] = tonumber(msg) if isValidMoney(moneyTo[cid]) == TRUE then selfSay('Are you sure you wish to withdraw '..moneyTo[cid]..' gold from your bank account?', cid) talkState[cid] = 7 else selfSay('Is isnt valid amount of gold to withdraw.', cid) talkState[cid] = 0 end elseif talkState[cid] == 7 then if msgcontains(msg, 'yes') then if doPlayerWithdrawMoney(cid, moneyTo[cid]) ~= TRUE then selfSay('There is not enough gold on your account. Your account balance is '..getPlayerBalance(cid)..'. Please tell me the amount of gold coins you would like to withdraw.', cid) else selfSay('Here you are, ' .. moneyTo[cid] .. ' gold. Please let me know if there is something else I can do for you.', cid) talkState[cid] = 0 end elseif msgcontains(msg, 'no') then selfSay('As you wish. Is there something else I can do for you?', cid) talkState[cid] = 0 end ----------------------------------------------------------------- ---------------------------- Transfer --------------------------- ----------------------------------------------------------------- elseif msgcontains(msg, 'transfer') then selfSay("Please tell me the amount of gold you would like to transfer.", cid) talkState[cid] = 11 elseif talkState[cid] == 11 then moneyTo[cid] = tonumber(msg) if isValidMoney(moneyTo[cid]) == TRUE then selfSay('Who would you like transfer '..moneyTo[cid]..' gold to?', cid) talkState[cid] = 12 else selfSay('Is isnt valid amount of gold to transfer.', cid) talkState[cid] = 0 end elseif talkState[cid] == 12 then playerTo[cid] = msg if getCreatureName(cid) == playerTo[cid] then selfSay('Ehm, You want transfer money to yourself? Its impossible!', cid) talkState[cid] = 0 return TRUE end if playerExists(playerTo[cid]) then selfSay('So you would like to transfer ' .. moneyTo[cid] .. ' gold to "' .. playerTo[cid] .. '" ?', cid) talkState[cid] = 13 else selfSay('Player with name "' .. playerTo[cid] .. '" doesnt exist.', cid) talkState[cid] = 0 end elseif talkState[cid] == 13 then if msgcontains(msg, 'yes') then if getPlayerBalance(cid) < moneyTo[cid] then selfSay('You dont have enought money on your bank account.', cid) return TRUE end if doPlayerTransferMoneyTo(cid, playerTo[cid], moneyTo[cid]) ~= TRUE then selfSay('This player does not exist on this world or have no vocation.', cid) else selfSay('You have transferred ' .. moneyTo[cid] .. ' gold to "' .. playerTo[cid] ..' ".', cid) playerTo[cid] = nil end elseif msgcontains(msg, 'no') then selfSay('As you wish. Is there something else I can do for you?', cid) end talkState[cid] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
Por Henrique Gaudard
Olá pessoal, primeiramente quero dizer que acho muito complicado mecher em monsters, poís qualquer erro, é fatal!! não sei porque quando fasso algumas modficações nos monsters/npcs que é quando eu modfico algumas coisas.., não entendo, só edito os nomes tipo assim;
name "sfdsdfds" eu ponho "dhfudshgusopofkpsdakfgjid" (obs: não é no nome do arquivo lua mais sim o nome do monster mesmo já na edição) e dá erro. Se eu meche-se nas parada lá nos código todo doido de scripting tudo bem mais eu só quero editar e quando eu vou colocá-lo no mapa acontece o seguinte:
Quando ligo aparece: "[Spawn : : addMonster] Cannot find "Ninja Star"" (ele está no presente no mapa e é um script obviamente). Falo!!
Sistema Operacional: Windows 10
-
Por telefonesemfio
Olá estou tentando fazer o ot funcionar, é tibia versão 7.6
TFS 0.3
GOD Tryller: hi Eva: Welcome GOD Tryller! What can I do for you? GOD Tryller: deposit 30 GOD Tryller: deposit =( ela não responde a nenhum comando até de contas normais. esse é o script:
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, '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('a', 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) end else selfSay('There is not enough gold on your account', cid) end else selfSay('Ok then', cid) 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
-