Postado Fevereiro 4, 2018 7 anos Este é um post popular. Opa galera beleza? Eu estava aqui olhando outros fóruns e percebi que postaram esse sistema, porém os links estavam todos off Resolvi desenvolver o sistema pra vocês TFS usado: 1.2 (Não testado em versões anteriores)* Bom o sistema funciona basicamente assim: Ao clicar na alavanca, abrirá um Modal com todas as opções de compra na tela do jogador ! O jogador poderá selecionar entre a compra de 1x / 50x / 100x itens ! Adicionado venda só para player que possuírem ''Cap'' na bag. * Foto: Simples não? Então vamos ao que interessa ! Em data/actions/scripts Crie um arquivo com o nome de compra_modal.lua e coloque isso dentro : Spoiler function onUse(cid, item, fromPosition, target, toPosition, isHotkey) cid:registerEvent("potions_lever") local title = "Potions" local message = "choose your potion you want to buy." local window = ModalWindow(1000, title, message) window:addButton(101, "Buy 50") window:addButton(102, "Buy 100") window:addButton(103, "Buy 1") window:addButton(104, "Cancel") window:addChoice(1, "Mana Potion") -- nome do item que deseja vender window:addChoice(2, "Health Potion") window:addChoice(3, "Strong Mana Potion") window:addChoice(4, "Strong Health Potion") window:addChoice(5, "Great Mana Potion") window:addChoice(6, "Great Health Potion") window:addChoice(7, "Great Spirit Potion") window:addChoice(8, "Ultimate Mana Potion") window:addChoice(9, "Ultimate Health Potion") window:addChoice(10, "Ultimate Spirit Potion") window:addChoice(11, "Supreme Health Potion") window:setDefaultEscapeButton(104) window:sendToPlayer(cid) return true end Em data/actions adicione a linha: Spoiler <action actionid="22100" script="compra_modal.lua"/> Em data/creaturescripts/scripts Crie um arquivo com o nome de potions.lua e coloque isso dentro : Spoiler --[[ TABELA DE PREÇOS DAS POTIONS NOME----------------------/ID----------/PRICE-------/CAP------- mana potion; ID: 7620; Price: 50; Cap: 2.70; health potion; ID: 7618; Price: 45; Cap: 2.70; strong mana potion; ID: 7589; Price: 80; Cap: 2.90; strong health potion; ID: 7588; Price: 100; Cap: 2.90; great mana potion; ID: 7590; Price: 120; Cap: 3.10; great health potion; ID: 7591; Price: 190; Cap: 3.10; great spirit potion; ID: 8472; Price: 190; Cap: 3.10; ultimate mana potion; ID: 26029; Price: 350; Cap: 3.10; ultimate health potion; ID: 8473; Price: 310; Cap: 3.10; ultimate spirit potion; ID: 26030; Price: 350; Cap: 3.10; supreme health potion; ID: 26031; Price: 500; Cap: 3.50; Creditos ao script: tataboy67 (TIBIAKING) ]]-- function onModalWindow(cid, modalWindowId, buttonId, choiceId) cid:unregisterEvent("potions_lever") local id_Potions = {7620, 7618, 7589, 7588, 7590, 7591, 8472, 26029, 8473, 26030, 26031} -- id das potions local price = {50, 45, 80, 100, 120, 190, 190, 350, 310, 350, 500} -- price 1x local cap = {2.70, 2.70, 2.90, 2.90, 3.10, 3.10, 3.10, 3.10, 3.10, 3.10, 3.50} -- capacity if modalWindowId == 1000 then if buttonId == 103 then -- botão de compra de 1 item (potion) if cid:getMoney() >= price[choiceId] then if cid:getFreeCapacity() >= cap[choiceId] then cid:removeMoney(price[choiceId]) cid:addItem(id_Potions[choiceId],1) cid:getPosition():sendMagicEffect(15) cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You bought a potion.") else cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "you do not have enough capacity.") cid:getPosition():sendMagicEffect(10) end else cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "you do not have enough money.") end end if buttonId == 101 then -- botão de compra de 1 item (potion) if cid:getMoney() >= price[choiceId]*50 then if cid:getFreeCapacity() >= cap[choiceId]*50 then cid:removeMoney(price[choiceId]*50) cid:addItem(id_Potions[choiceId],1*50) cid:getPosition():sendMagicEffect(15) cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You bought 50x potions") else cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "you do not have enough capacity.") cid:getPosition():sendMagicEffect(10) end else cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "you do not have enough money.") end end if buttonId == 102 then -- botão de compra de 1 item (potion) if cid:getMoney() >= price[choiceId]*100 then if cid:getFreeCapacity() >= cap[choiceId]*100 then cid:removeMoney(price[choiceId]*100) cid:addItem(id_Potions[choiceId],1*100) cid:getPosition():sendMagicEffect(15) cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You bought 100x potions") else cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "you do not have enough capacity.") cid:getPosition():sendMagicEffect(10) end else cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "you do not have enough money.") end end end end Em data/creaturescripts/creaturescripts.xml adicione a linha: Spoiler <event type="modalwindow" name="potions_lever" script="potions.lua"/> Créditos: EU (100% pelo script)Strutz (Pela ideia do sistema)Rep+ para me motivar Obs: Testem o Script antes da aprovação pois estou sem PC agora e a verificação de cap foi feita sem teste ! Meus trabalhos: [Movements] TFS 1.1+ Area Hardcore [Movements] TFS 1.1+ Tile Party [Action] TFS 1.1+ Bau diário [Action] TFS 1.1+ Guild Dungeon Lever [Talkactions] TFS 0.3.6 / 0.4 Quest Hunt por Tempo Contato: Discord: Tataboy67#4934
Postado Fevereiro 5, 2018 7 anos Parabéns, seu tópico de conteúdo foi aprovado! Muito obrigado pela sua contribuição, nós do Tibia King agradecemos. Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP. Spoiler Congratulations, your content has been approved! Thank you for your contribution, we of Tibia King we are grateful. Your content will help many other users, you received +1 REP. Entenda tudo sobre VPS, DEDICADOS & HOSPEDAGENS. => Clique aqui Global Full Download 10.9x - TFS 1.2/FERUMBRAS/KRAILOS. => Clique aqui Muitos querem aquilo que você tem, mas vão desistir quando souberem o preço que você pagou. lu.lukinha [email protected]
Postado Fevereiro 17, 2018 7 anos Aqui deu este erro [18:7:28.037] [Error - CreatureEvent::configureEvent] No valid type for creature event.modalwindow [18:7:28.039] [Warning - BaseEvents::loadFromXml] Cannot configure an event
Postado Fevereiro 25, 2018 7 anos Autor Em 17/02/2018 em 18:09, Thenew disse: Aqui deu este erro [18:7:28.037] [Error - CreatureEvent::configureEvent] No valid type for creature event.modalwindow [18:7:28.039] [Warning - BaseEvents::loadFromXml] Cannot configure an event Você registrou o evento em login.lua? Vá em login.lua na pasta data/creaturescript/others e adicione o evento lá: Spoiler 'potions_lever', :D rep+ vlw Meus trabalhos: [Movements] TFS 1.1+ Area Hardcore [Movements] TFS 1.1+ Tile Party [Action] TFS 1.1+ Bau diário [Action] TFS 1.1+ Guild Dungeon Lever [Talkactions] TFS 0.3.6 / 0.4 Quest Hunt por Tempo Contato: Discord: Tataboy67#4934
Postado Fevereiro 28, 2018 7 anos Olá é possível você colocar para comprar tipo por 1 talkaction, eu falo "comprarpotion e abre a janela modal mais apenas para quem estiver em protectzone.
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.