Postado Abril 23, 2020 5 anos Em 04/02/2018 em 02:20, tataboy67 disse: 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 : Mostrar conteúdo oculto 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: Mostrar conteúdo oculto <action actionid="22100" script="compra_modal.lua"/> Em data/creaturescripts/scripts Crie um arquivo com o nome de potions.lua e coloque isso dentro : Mostrar conteúdo oculto --[[ 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: Mostrar conteúdo oculto <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 ! Obrigado por disponibilizar, deu tudo certo.
Postado Agosto 8, 2020 4 anos Em 04/02/2018 em 02:20, tataboy67 disse: 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 : Ocultar conteúdo 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: Mostrar conteúdo oculto <action actionid="22100" script="compra_modal.lua"/> Em data/creaturescripts/scripts Crie um arquivo com o nome de potions.lua e coloque isso dentro : Ocultar conteúdo --[[ 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: Ocultar conteúdo <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 ! mano como eu faço pra trocar o money por uma moeda propria? pelo id dela "32255"
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.