Ir para conteúdo

Featured Replies

Postado

Olá galera a Pouco tempo fiz um pedido pra vender vocações sem precisar comprar um item e usar em seu personagem para ganhar um vocação exclusiva do server e Outfit.

Então um amigo do Fórum que ajuda muita gente e ele me ajudou a Desenvolver esse Script pra Fazer essa entrega.

Testado em Modern Aac, Servidor Derivado, Versão 8.60!

Bom Vamos Ao Tutorial:

 

Primeiramente voce Precisará de sua Database abra-o Com algum editor de Texto:

Procure por:

CREATE TABLE IF NOT EXISTS `shop_offer` (

Substitua toda essa parte por essa:

CREATE TABLE IF NOT EXISTS `shop_offer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `points` int(11) NOT NULL DEFAULT '0',
  `category` int(11) NOT NULL DEFAULT '1',
  `type` int(11) NOT NULL DEFAULT '1',
  `item` int(11) NOT NULL DEFAULT '0',
  `vocation` int(11) NOT NULL DEFAULT '0',
  `looktype` int(11) NOT NULL DEFAULT '0',
  `count` int(11) NOT NULL DEFAULT '0',
  `description` text NOT NULL,
  `name` varchar(256) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=51 ;

Abaixo deve Haver algo assim:

INSERT INTO `shop_offer`

Substitua Toda essa parte de INSERT INTO `shop_offer` por essa:

INSERT INTO `shop_offer` (`id`, `points`, `category`, `type`, `item`, `vocation`, `looktype`, `count`, `description`, `name`) VALUES
(39, 10, 1, 1, 0, 0, 0, 30, 'Premium Account\n30 Dias.', 'Premium Account'),
(40, 5, 1, 4, 0, 0, 0, 0, 'Mudar o nome do seu personagem.', 'Mudar NickName'),
(41, 5, 1, 2, 0, 0, 0, 0, 'Remove RedSkull do personagem.', 'Remove RedSkull'),
(42, 10, 2, 5, 2388, 0, 0, 1, 'Atk: (Atk:3000)', 'slayer gloves'),
(43, 10, 2, 5, 2659, 0, 0, 1, 'Atk: (Atk:3000)', 'Kage Shuriken'),
(44, 15, 2, 5, 7408, 0, 0, 1, 'All Skills aumentado em 20+ Speed+250 Chakra/Hp 5000/s', 'Yondaime tunic'),
(45, 10, 2, 5, 2431, 0, 0, 1, 'Recovery Chakra/Hp 2500/s', 'Sennin legs'),
(46, 5, 2, 5, 7402, 0, 0, 1, 'All Taijutsu +5 Ninjutsu +5 Speed +350 Chakra/Hp 1500/s', 'Vital boots'),
(47, 5, 2, 5, 7380, 0, 0, 1, 'All Skills aumentado em 10+', 'obito war mask'),
(48, 10, 2, 5, 11586, 0, 0, 1, 'rikudou cetre (Atk:4000)', 'rikudou cetre'),
(49, 5, 2, 5, 11590, 0, 0, 1, 'All Skills aumentado em 20+ Speed+250', 'obito broke mask'),
(50, 15, 2, 5, 11592, 0, 0, 1, 'All Skills aumentado em 20+ Speed+250 Chakra/Hp 8000/s', 'Rikudou naruto armor');

Prontinho agora se quiser editar o id e descrições dos items fique a vontade mais cuidado para que não apague Números pra não dar erro.

 

agora vá em seu server e em data/globalevents/script/shop.lua

voce apagará tudo que está neste arquivo e trocará por este para que a entrega seja feita.

 

Script shop.lua:

Spoiler

function onThink(interval, lastExecution, thinkInterval)
    local result = db.getResult("SELECT * FROM shop_history WHERE `processed` = 0;")
    
        if(result:getID() ~= -1) then
            while(true) do
                cid = getCreatureByName(tostring(result:getDataString("player")))
                product = tonumber(result:getDataInt("product"))
                itemr = db.getResult("SELECT * FROM shop_offer WHERE `id` = "..product..";")
                    if isPlayer(cid) then
                        local id = tonumber(itemr:getDataInt("item"))
                        local tid = tonumber(result:getDataInt("id"))
                        local count = tonumber(itemr:getDataInt("count"))
                        local tipe = tonumber(itemr:getDataInt("type"))
                        local productn = tostring(itemr:getDataString("name"))
                        local voc = tonumber(itemr:getDataInt("vocation"))
                        local look = tonumber(itemr:getDataInt("looktype"))
                        local outfit = {lookType = look}
                            if isInArray({5,8},tipe) then
                                if(voc == 0) then
                                    if getPlayerFreeCap(cid) >= getItemWeightById(id, count) then
                                        if isContainer(getPlayerSlotItem(cid, 3).uid) then
                                            received = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, id,count)
                                            if received then
                                                doPlayerSendTextMessage(cid,19, "Você Recebeu Uma | "..productn.." | que comprou no Shop, Obrigado e Bom Uso da "..productn.." ")
                                                db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")                                          
                                            else
                                                doPlayerSendTextMessage(cid,19, "Desculpa, Você não tem espaço para receber o item >> "..productn.." <<")
                                            end
                                        else
                                            doPlayerSendTextMessage(cid,19, "Desculpa, Você não tem espaço para receber >> "..productn.." <<")
                                        end
                                    else
                                        doPlayerSendTextMessage(cid,19, "Desculpa, você não tem cap para receber >> "..productn.." << (You need: "..getItemWeightById(id, count).." Capacity)")
                                    end
                                else
                                    doPlayerSendTextMessage(cid,19, "Você Recebeu Uma | "..productn.." | que comprou no Shop, Obrigado e Bom Uso da "..productn.." ")
                                    db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";") 
                                    doCreatureChangeOutfit(cid, outfit)
                                    doPlayerSetVocation(cid, voc)
                                end
                            elseif isInArray({6,7},tipe) then
                                    if tipe == 6 then
                                        bcap = 8
                                        bid = 1987
                                    elseif tipe == 7 then
                                        bcap = 20
                                        bid = 1988
                                    end
                                    if isItemRune(id) then
                                        count = 1
                                    end
                                    if getPlayerFreeCap(cid) >= (getItemWeightById(1987, 1) + getItemWeightById(id,count * bcap)) then
                                        local bag = doCreateItemEx(bid, 1)
                                            for i = 1,bcap do
                                                doAddContainerItem(bag, id, count)
                                            end
                                        received = doPlayerAddItemEx(getPlayerSlotItem(cid, 3).uid, bag)
                                        if received == RETURNVALUE_NOERROR then
                                            doPlayerSendTextMessage(cid,19, "You have received >> "..productn.." << from our shop system")
                                            db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
                                        else
                                            doPlayerSendTextMessage(cid,19, "Sorry, you don't have enough space to receive >> "..productn.." <<")
                                        end
                                    else
                                        doPlayerSendTextMessage(cid,19, "Sorry, you don't have enough capacity to receive >> "..productn.." << (You need: "..getItemWeightById(id, count).." Capacity)")
                                    end
                            end
                    end
                itemr:free()
                if not(result:next()) then
                    break
                end
            end
            result:free()
        end
    return true
end

 

Prontinho!

Na hora de editar no site ou na database deve ficar como no exemplo:

Sem título.png

id, pontos, categoria, type(nao mexa), item(zero), id da vocação, id da roupa, quantia(deixa 1),descrição,Nome do Produto

Credito a @Hastafaru por postar a parte da database e por criar o tutorial

Credito a  @Rusherzin por Editar a Script Para que desse Certo.

 

Qualquer Coisa Comentem Aqui!

Editado por Hastafaru
revisao (veja o histórico de edições)

Conteúdos Tragos Por Mim ao Fórum:

Venda de Vocações [Modern Aac] •

• Comando !Saga 

• [Modern Aac] DragonBall 

• Esconder •

• Naruto 2018

• • •

• •

'NtoProject - Breve'

[Show OFF] Disponível

  • Respostas 9
  • Visualizações 2.5k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • D i M i T r E s C u
    D i M i T r E s C u

    Não estou podendo dar suport por está muito ausente quando eu puder eu posto um video Completo.

Posted Images

Postado

Hey brother, não entendi como isso funciona, mais pelo que eu vi ele faz a entrega de vocações do diretamente do site por pontos ok ? Se sim explique como fazer para adicionar a vocação no site para então vender, só fazendo alteração na database não adiantaria, também notei que você pede que faça alteração na db antes de ser importada, no entanto, porque você não usa um ALTER TABLE, para alterá a tabela no banco de dados e adicionar as colunas, vocation e looktype na tabela sem precisa fazer tal alteração fazendo que com outros percam seus itens no shop já editado e prontos para a venda ? (Só uma opinião a parte da db, não entenda mal. Hahaha).

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Postado
  • Autor

Eu não entendo muito de database eu fui editando ate chegar esse resultado ja que ninguem me ajudava foi a melhor maneira que consegui passar pra vocês.

e a maneira de colocar as vocations pra vender e simples e igual você colocar um item a venda so que voce vai colocar o id da vocação pra vender e a roupa que vai ganhar.

 

vou editar um pouco mais o topico.

Conteúdos Tragos Por Mim ao Fórum:

Venda de Vocações [Modern Aac] •

• Comando !Saga 

• [Modern Aac] DragonBall 

• Esconder •

• Naruto 2018

• • •

• •

'NtoProject - Breve'

[Show OFF] Disponível

Postado

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.

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Postado
[20:25:34.961] [Error - GlobalEvent Interface]
[20:25:34.962] data/globalevents/scripts/shop.lua:onThink
[20:25:34.963] Description:
[20:25:34.964] data/globalevents/scripts/shop.lua:25: attempt to call field 'executeQuery' (a nil value)
[20:25:34.965] stack traceback:
[20:25:34.965]  data/globalevents/scripts/shop.lua:25: in function <data/globalevents/scripts/shop.lua:1>
[20:25:34.966] [Error - GlobalEvents::think] Couldn't execute event: Shop
[20:25:38.079] Error during getDataInt(vocation).
[20:25:38.112] Error during getDataInt(looktype).

[20:25:38.113] [Error - GlobalEvent Interface]
[20:25:38.114] data/globalevents/scripts/shop.lua:onThink
[20:25:38.115] Description:
[20:25:38.117] data/globalevents/scripts/shop.lua:25: attempt to call field 'executeQuery' (a nil value)
[20:25:38.118] stack traceback:
[20:25:38.119]  data/globalevents/scripts/shop.lua:25: in function <data/globalevents/scripts/shop.lua:1>
[20:25:38.124] [Error - GlobalEvents::think] Couldn't execute event: Shop

@Hastafaru

O rei de seu proprio destino é aquele que luta pela gloria do amanhã!
Discord : ZoR#9373


 

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo