Ir para conteúdo
  • Cadastre-se

Orientalz

Membro
  • Total de itens

    52
  • Registro em

  • Última visita

Posts postados por Orientalz

  1. Em 25/05/2019 em 20:31, Vodkart disse:

    Explicação:

     

    Este sistema proporciona ao jogador a compra de determinada cave por "X" tempo, cada conta poderá comprar somente 1 cave por vez... Lá o jogador poderá upar livremente.

     

    Também poderá chamar um amigo para upar na sua cave!!

     

    O sistema é o mais completo do mercado, vou estar falando do mesmo abaixo.

     

    OBS: Não esqueça de executar a query para funcionar!!

     

     

    Exclusive Cave System Features

     

    •  Dentro do pacote terá duas versões:

     

    versão 1 : É para vendar as caves em money(Gold's)


    Versão 2: É para vender as caves por items, por exemplo por moedas especiais como scarab coins(ID 2159)

     

    •   O sistema é feito por banco de dados

     

    • O tempo da cave é mostrado em tempo real

     

    • Você poderá chamar um amigo para sua cave e também remove-lo quando quiser.

     

    • Existe um globalevents especifico para mostrar no default quando uma cave ficou disponível para venda! (Irá informar o nome da cave o preço dela!)

     

    • Você poderá configurar a cave para vender por exemplo:

     

                     - Level minimo e máximo!

                     - Tempo de duração da cave

                     - Se precisa ser premium account para comprar a cave!

     

     

    • Quando o tempo da cave expira tanto o dono da cave como o friend invitado são removidos da cave, mesmo estando offline ou online!

     

    • Comandos exclusivos:

     

    Comando para dono da cave:

     

        /mycave - Mostra informações da sua cave, como:

     

          - Nome da cave

          - Nome do seu amigo de cave(caso tiver invitado)

          - Quando tempo falta para expirar o tempo da sua cave

     

    /addcavefriend - Adiciona um amigo seu para que ele possa entrar e sai da sua cave quando quiser... Obs: Tem um exhausted de 1 hora(configurável) para não ficar toda hora tirando e colocando amigo na cave.

     

    /removecavefriend - Remove o seu amigo da sua cave(caso ele esteja dentro da cave tanto offline quanto online, ele é removido)

     

    /cavetime - Mostra quando tempo falta para expirar a sua cave

     

     

    Comando para amigo invitado da cave:

     

    /cavefriendtime - Mostra quando tempo falta para expirar a cave que ele invitado.

     

    /caveleave - Comando para ele se kikar da cave que está invitado.

     

     

    Comandos adicionais importante para todos:

     


     /cavelist -- Mostra em uma janela todas as caves do servidor

     

     

    /cave ID -- Neste comando você terá que usar o ID da cave que deseja saber as infor,ações, por exemplo:

     

    /cave 1  -- Irá mostrar em uma janela todas as informações desta cave, como:

     

    -Nome da cave

    -Preço da cave

    -Level Minimo e Level Maximo para comprar a cave

    -Se nesta cave precisa ser Premium Account para comprar ou não.

     

    /cavepurchase -- Filtra em uma janela somente as caves que estão disponíveis para compra.

     

     

     

    ----------------------------------------------------------------------------------------------------------------------------------------------------

     

    Configurações:

     

    Vá na lib e irá se deparar com duas tabelas...

     

     

    Esta primeira tabela é onde você irá adicionar novas caves e atribuir as configurações, exemplo:

    
    exclusives_caves_areas = { -- adicionar as caves
                           [1] = {name = "Demon Hunter", price = 1000, level = {min = 8, max =30}, time = 4, premium = false, enter = {x = 284, y = 223, z = 7}, from = {x = 275, y = 219, z = 5}, to = {x = 302, y = 240, z = 7}},
                           [2] = {name = "Hydras Thow", price = 2000, level = {min = 10, max = 1000}, time = 3, premium = true, enter = {x = 148, y = 218, z = 7}, from = {x = 137, y = 217, z = 7}, to = {x = 161, y = 234, z = 7}}
                           }

     

     

    [1] -- Entre os colchetes é o ID da cave, favor colocar e ordem.

     

    name = "Demon Hunter" -- Entre as aspas "" Você atribui o nome da cave

     

    price = 1000 -- Preço em gps da sua cave(caso use a versão que vende em gps)

     

    level = {min = 8, max =30} -- Aqui voce coloca o level min e max que o jogador tem que ser para comprar a cave

     

    time = 4 -- Tempo em horas que o jogador poderá ficar na cave

     

    premium = false -- Se para comprar a cave terá que ser premium (false ou true)

     

    enter = {x = 284, y = 223, z = 7} -- Pos de entrada da cave

     

    from = {x = 275, y = 219, z = 5}, -- Aqui você deverá pegar a pos do começa da cave

     

    to = {x = 302, y = 240, z = 7} - - -- Aqui você deverá pegar a pos final da cave!(como se fosse um quadrado.

     

    e como adicionar mais caves por exemplo? Assim:

     

    
    exclusives_caves_areas = { -- adicionar as caves
                           [1] = {name = "Demon Hunter", price = 1000, level = {min = 8, max =30}, time = 4, premium = false, enter = {x = 284, y = 223, z = 7}, from = {x = 275, y = 219, z = 5}, to = {x = 302, y = 240, z = 7}},
                           [2] = {name = "Hydras Thow", price = 2000, level = {min = 10, max = 1000}, time = 3, premium = true, enter = {x = 148, y = 218, z = 7}, from = {x = 137, y = 217, z = 7}, to = {x = 161, y = 234, z = 7}},
                           [3] = {name = "Ciclops Cave", price = 5000, level = {min = 20, max = 50}, time = 2, premium = true, enter = {x = 198, y = 320, z = 7}, from = {x = 200, y = 340, z = 7}, to = {x = 250, y = 390, z = 7}}
                           }
                           

     

     

    ----------------------------------------------------------------------------------------------------------------------------------------------------

     

    explicando a segunda tabela:

     

     

    
    exclusives_caves_config = {
                            storage = 547575,
                            check =  547576,
                            comand_add_exaust = {hours = 1, storage = 547577}, -- tempo para nao ficar toda hora tirando e colocando amigo
                            mensagem = "[Exclusive Cave System] Você foi removido ou o tempo da %s cave expirou!",
                            serve_mensagem = "[Exclusive Cave System] A cave %s acabou de ficar liberada para venda por %d Gold's, aproveitem para compra-la no NPC!"
                            }

     

     

    storage -- nao mexer!

    check -- não mexer!!

     

    comand_add_exhausted -- é o tempo que jogador poderá voltar a invitar outro jogador, está configurado para 1 hora!!

     

    mensagem -- não mexa

     

    serve_mensagem -- não mexa tbm kkk

     

     

    Só baixar e executar as querys!!

     

     

    Cave System.rar 17 kB · 107 downloads

     

    Screenshot_7.png

  2. Modern

    Bom eu tenho 2 pedidos:

    1- Quando eu logo no site e aperto no X para deletar o personagem ele é deletado do do jogo e nenhuma informação sobra dele, gostaria de resolver esse problema, para quando apertasse o X alem de ter uma confirmação se deseja realmente apagar o personagem, ele ainda se mantenha na database mas no site apareceria [DELETADO]image.png.373363d12166c1fc3094e3b619d7d7af.png

    2- Quando se procurar o personagem as skills do jogador serem vistas no site sem precisar abrir os highscore:

    image.png.84330e2f0b6270d27fd339f59262b754.png

     

     

  3. 21 horas atrás, Kyle Bellini disse:

    E aí,

    Testa assim:

      Ocultar conteúdo
    
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
                    ULTIMATE SURVIVAL - Codigo feito por Omega / Pedido por vinnevinne
    -->
     
    <mod name="Ultimate Survival" version="1.0" author="Omega" enabled="yes">
    <config name="ultimatelib"><![CDATA[
    USurvival = {
        posi = {x=110, y=151, z=11},
        posf = {x=121, y=162, z=11},
        posc = {x=116, y=159, z=11},
        
        waves = {
        [1] = {monsters = {"wolf","wolf beast"}, count = 30, reward = {exp = 0, item = 3956, amount = 5, money = 100}},
        [2] = {monsters = {"shadow beast","shadow lion","shadow skeleton","shadow prisioner","shadow tombler"}, count = 40, reward = {exp = 0, item = 3956, amount = 10, money = 1000}},
        [3] = {monsters = {"raditz","nappa","turles","bardock","broly","gotenks","vegeta","king vegeta","goku","gogeta","vegetto"}, count = 50, reward = {exp = 0, item = 3956, amount = 15, money = 10000}},
        },
        exhaust = 1 * 24 * 60 * 60, -- Tempo em segundos ate poder entrar novamente na arena (1 * 24 * 60 * 60 = 1 dia)
        
        final_reward = {item = 2160, amount = 100, exp = 300000, money = 500000},
        
        storage_ex = 607069,
        storage_wave = 607089,
    }
    
    function isWalkable(pos)-- by Nord / editado por Omega
        if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
            return false
        elseif isCreature(getTopCreature(pos).uid) then
            return false
        elseif getTileInfo(pos).protection then
            return false
        elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then
            return false
        end
    return true
    end
    
    function doSpawnMonsters(monsters, pos, radius, limit)
        if not pos.x or not pos.y or not pos.z or not type(monsters) == 'table' then
            return false
        end
            local radius = tonumber(radius)
        if radius > 5 then
            radius = 5
        elseif radius < 2 then
            radius = 2
        end
        if not limit or limit < 1 then
            limit = 1
        elseif limit > radius ^ 2 then
            limit = math.floor((radius*1.5) ^ 2)
        end
        
        local k = 0
        local tries = 0
        repeat
            for x = pos.x - radius, pos.x + radius do
                for y = pos.y - radius, pos.y + radius do
                    if isWalkable({x=x, y=y, z=pos.z}) then
                        local monster = monsters[math.random(1, #monsters)]
                        local chance = math.random(1, 30)
                        if k == limit then
                            break
                        elseif chance <= 8 and doCreateMonster(monster, {x=x, y=y, z=pos.z}) then
                            k = k + 1
                        end
                    end
                end
            end
            tries = tries + 1
        until k >= limit or tries >= 500
        return k >= limit and true or false
    end
    
    function getPlayersInArea(pos1,pos2)
        local players = {}
        if pos1.x and pos1.y and pos2.x and pos2.y and pos1.z == pos2.z then
            for a = pos1.x, pos2.x do
                for b = pos1.y,pos2.y do
                    local pos = {x=a,y=b,z=pos1.z}
                    if isPlayer(getTopCreature(pos).uid) then
                        table.insert(players,getTopCreature(pos).uid)
                    end
                end
            end
            return players
        else
            return false
        end
    end    
    
    function getMonstersInArea(pos1,pos2)
        local players = {}
        if pos1.x and pos1.y and pos2.x and pos2.y and pos1.z == pos2.z then
            for a = pos1.x, pos2.x do
                for b = pos1.y,pos2.y do
                    local pos = {x=a,y=b,z=pos1.z}
                    if isMonster(getTopCreature(pos).uid) then
                        table.insert(players,getTopCreature(pos).uid)
                    end
                end
            end
            return players
        else
            return false
        end
    end
    
    function doCleanArena()
        local monsters = getMonstersInArea(USurvival.posi, USurvival.posf)
        for _, cid in pairs(monsters) do
            doRemoveCreature(cid)
        end
    end
    
    function doStartWave(waveID, cid)
        if not isCreature(cid) then return false end
        if USurvival.waves[waveID] then
            wave = USurvival.waves[waveID]
            doSpawnMonsters(wave.monsters, USurvival.posc, 5, wave.count)
            doPlayerSendTextMessage(cid, 21, 'Wave '..waveID..' has started! FIGHT!')
        end
    end
    ]]></config>
    
    <action actionid="4599" event="script" override="yes"><![CDATA[
    domodlib('ultimatelib')
    function onUse(cid, item)
    
        local config = {
            checkItem = 1547, <!-- ID do item que deseja verificar/remover -->
            countItem = 1 <!-- Quantidade que deseja verificar/remover -->
        }
    
        if getPlayerItemcount(cid, config.checkItem) >= config.countItem then
            if getPlayerStorageValue(cid, USurvival.storage_ex) <= os.time() then
                if #getPlayersInArea(USurvival.posi, USurvival.posf) == 0 then
                    doCleanArena()
                    doPlayerRemoveItem(cid, config.checkItem, config.countItem)
                    doTeleportThing(cid, USurvival.posc)
                    doPlayerSendTextMessage(cid, 21, 'The Survival will Start in 60 seconds! Be ready to face your destiny!')
                    addEvent(doStartWave, 60000, 1, cid)
                    setPlayerStorageValue(cid, USurvival.storage_wave, 1)
                    setPlayerStorageValue(cid, USurvival.storage_ex, os.time() + USurvival.exhaust)
                    if item.itemid % 2 == 1 then
                        doTransformItem(item.uid, item.itemid+1)
                    else
                        doTransformItem(item.uid, item.itemid-1)
                    end
                else
                    doPlayerSendCancel(cid, 'Someone is already in the arena.')
                    doSendMagicEffect(getThingPos(cid), 2)
                end
            else
                local left = getPlayerStorageValue(cid, USurvival.storage_ex) - os.time()
                left = {hour = math.floor(left/3600), minutes = math.ceil((left % 3600)/60)}
                doPlayerSendCancel(cid, 'You have to wait '.. left.hour ..'h and '..left.minutes..'min.')
                doSendMagicEffect(getThingPos(cid), 2)
            end
        end
        return true
    end
    ]]></action>
    
    <event type="login" name="US Login" event="script"><![CDATA[
    domodlib('ultimatelib')
    function onLogin(cid)
        registerCreatureEvent(cid,'UltimateSurvival1')
        registerCreatureEvent(cid,'UltimateSurvival2')
        if isInArea(getThingPos(cid), USurvival.posi, USurvival.posf) then
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            doSendMagicEffect(getThingPos(cid), 10)
        end
        return true
    end
    ]]></event>
    
    <event type="kill" name="UltimateSurvival1" event="script"><![CDATA[
    domodlib('ultimatelib')
    function onKill(cid, target)
        if isInArea(getThingPos(cid), USurvival.posi, USurvival.posf) then
            if #getMonstersInArea(USurvival.posi, USurvival.posf) == 1 then
                local wave = getPlayerStorageValue(cid, USurvival.storage_wave)
                if USurvival.waves[wave+1] then
                    setPlayerStorageValue(cid, USurvival.storage_wave, wave + 1)
                    addEvent(doStartWave, 30000, wave + 1, cid)
                    doPlayerSendTextMessage(cid, 22, 'Congratulations! Next wave will start in 30 seconds!')
                else
                    doPlayerSendTextMessage(cid, 22, 'CONGRATULATIONS! YOU HAVE BEATEN THE SURVIVAL!')
                    local reward = USurvival.final_reward
                    if reward.item then
                        doPlayerAddItem(cid, reward.item, (reward.amount or 1), false)
                    end
                    if reward.exp then
                        doPlayerAddExp(cid, reward.exp)
                    end
                    if reward.money then
                        doPlayerAddMoney(cid, reward.money)
                    end
                    local medal = doPlayerAddItem(cid, 5785, 1, false)
                    if medal then
                        doItemSetAttribute(medal, 'description', 'This was awarded to '..getCreatureName(cid)..' for completing the Ultimate Survival.')
                        doItemSetAttribute(medal,'name', 'Ultimate Survival Medal')
                    end
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
                end
            end
        end
        return true
    end
    
    ]]></event>
    
    <event type="preparedeath" name="UltimateSurvival2" event="script"><![CDATA[
    domodlib('ultimatelib')
    function onPrepareDeath(cid, killers)
        if isInArea(getThingPos(cid), USurvival.posi, USurvival.posf) then
            doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
            doRemoveConditions(cid, false)
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            doPlayerSendTextMessage(cid, 21, 'Too bad, you couldn\'t defeat the Ultimate Survival... Better luck next time.')
            local reward = USurvival.waves[getPlayerStorageValue(cid, USurvival.storage_wave)].reward
            if reward.item then
                doPlayerAddItem(cid, reward.item, reward.amount or 1)
            end
            if reward.exp then
                doPlayerAddExp(cid, reward.exp)
            end
            if reward.money then
                doPlayerAddMoney(cid, reward.money)
            end
            return false
        end
        return true
    end
    ]]></event>
    
    </mod>

     

     

    deu erro na distro

  4. DBO TFS 0.4

     

    Consegui um sistema na net do evento survive, nesse evento você usa uma alavanca a cada X horas e enfrenta vários mobs e se sobreviver até o final você recebe um premio.

    Eu gostaria que para você acessar o evento você precise ter um certo item e após utilizar a alavanca esse item irá sumir da sua backpack

     

    Spoiler

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
                    ULTIMATE SURVIVAL - Codigo feito por Omega / Pedido por vinnevinne
    -->
     
    <mod name="Ultimate Survival" version="1.0" author="Omega" enabled="yes">
    <config name="ultimatelib"><![CDATA[
    USurvival = {
        posi = {x=110, y=151, z=11},
        posf = {x=121, y=162, z=11},
        posc = {x=116, y=159, z=11},
        
        waves = {
        [1] = {monsters = {"wolf","wolf beast"}, count = 30, reward = {exp = 0, item = 3956, amount = 5, money = 100}},
        [2] = {monsters = {"shadow beast","shadow lion","shadow skeleton","shadow prisioner","shadow tombler"}, count = 40, reward = {exp = 0, item = 3956, amount = 10, money = 1000}},
        [3] = {monsters = {"raditz","nappa","turles","bardock","broly","gotenks","vegeta","king vegeta","goku","gogeta","vegetto"}, count = 50, reward = {exp = 0, item = 3956, amount = 15, money = 10000}},
        },
        exhaust = 1 * 24 * 60 * 60, -- Tempo em segundos ate poder entrar novamente na arena (1 * 24 * 60 * 60 = 1 dia)
        
        final_reward = {item = 2160, amount = 100, exp = 300000, money = 500000},
        
        storage_ex = 607069,
        storage_wave = 607089,
    }

    function isWalkable(pos)-- by Nord / editado por Omega
        if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
            return false
        elseif isCreature(getTopCreature(pos).uid) then
            return false
        elseif getTileInfo(pos).protection then
            return false
        elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then
            return false
        end
    return true
    end

    function doSpawnMonsters(monsters, pos, radius, limit)
        if not pos.x or not pos.y or not pos.z or not type(monsters) == 'table' then
            return false
        end
            local radius = tonumber(radius)
        if radius > 5 then
            radius = 5
        elseif radius < 2 then
            radius = 2
        end
        if not limit or limit < 1 then
            limit = 1
        elseif limit > radius ^ 2 then
            limit = math.floor((radius*1.5) ^ 2)
        end
        
        local k = 0
        local tries = 0
        repeat
            for x = pos.x - radius, pos.x + radius do
                for y = pos.y - radius, pos.y + radius do
                    if isWalkable({x=x, y=y, z=pos.z}) then
                        local monster = monsters[math.random(1, #monsters)]
                        local chance = math.random(1, 30)
                        if k == limit then
                            break
                        elseif chance <= 8 and doCreateMonster(monster, {x=x, y=y, z=pos.z}) then
                            k = k + 1
                        end
                    end
                end
            end
            tries = tries + 1
        until k >= limit or tries >= 500
        return k >= limit and true or false
    end

    function getPlayersInArea(pos1,pos2)
        local players = {}
        if pos1.x and pos1.y and pos2.x and pos2.y and pos1.z == pos2.z then
            for a = pos1.x, pos2.x do
                for b = pos1.y,pos2.y do
                    local pos = {x=a,y=b,z=pos1.z}
                    if isPlayer(getTopCreature(pos).uid) then
                        table.insert(players,getTopCreature(pos).uid)
                    end
                end
            end
            return players
        else
            return false
        end
    end    

    function getMonstersInArea(pos1,pos2)
        local players = {}
        if pos1.x and pos1.y and pos2.x and pos2.y and pos1.z == pos2.z then
            for a = pos1.x, pos2.x do
                for b = pos1.y,pos2.y do
                    local pos = {x=a,y=b,z=pos1.z}
                    if isMonster(getTopCreature(pos).uid) then
                        table.insert(players,getTopCreature(pos).uid)
                    end
                end
            end
            return players
        else
            return false
        end
    end

    function doCleanArena()
        local monsters = getMonstersInArea(USurvival.posi, USurvival.posf)
        for _, cid in pairs(monsters) do
            doRemoveCreature(cid)
        end
    end

    function doStartWave(waveID, cid)
        if not isCreature(cid) then return false end
        if USurvival.waves[waveID] then
            wave = USurvival.waves[waveID]
            doSpawnMonsters(wave.monsters, USurvival.posc, 5, wave.count)
            doPlayerSendTextMessage(cid, 21, 'Wave '..waveID..' has started! FIGHT!')
        end
    end
    ]]></config>

    <action actionid="4599" event="script" override="yes"><![CDATA[
    domodlib('ultimatelib')
    function onUse(cid, item)
        if getPlayerStorageValue(cid, USurvival.storage_ex) <= os.time() then
            if #getPlayersInArea(USurvival.posi, USurvival.posf) == 0 then
                doCleanArena()
                doTeleportThing(cid, USurvival.posc)
                doPlayerSendTextMessage(cid, 21, 'The Survival will Start in 60 seconds! Be ready to face your destiny!')
                addEvent(doStartWave, 60000, 1, cid)
                setPlayerStorageValue(cid, USurvival.storage_wave, 1)
                setPlayerStorageValue(cid, USurvival.storage_ex, os.time() + USurvival.exhaust)
                if item.itemid % 2 == 1 then
                    doTransformItem(item.uid, item.itemid+1)
                else
                    doTransformItem(item.uid, item.itemid-1)
                end
            else
                doPlayerSendCancel(cid, 'Someone is already in the arena.')
                doSendMagicEffect(getThingPos(cid), 2)
            end
        else
            local left = getPlayerStorageValue(cid, USurvival.storage_ex) - os.time()
            left = {hour = math.floor(left/3600), minutes = math.ceil((left % 3600)/60)}
            doPlayerSendCancel(cid, 'You have to wait '.. left.hour ..'h and '..left.minutes..'min.')
            doSendMagicEffect(getThingPos(cid), 2)
        end
        return true
    end
    ]]></action>

    <event type="login" name="US Login" event="script"><![CDATA[
    domodlib('ultimatelib')
    function onLogin(cid)
        registerCreatureEvent(cid,'UltimateSurvival1')
        registerCreatureEvent(cid,'UltimateSurvival2')
        if isInArea(getThingPos(cid), USurvival.posi, USurvival.posf) then
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            doSendMagicEffect(getThingPos(cid), 10)
        end
        return true
    end
    ]]></event>

    <event type="kill" name="UltimateSurvival1" event="script"><![CDATA[
    domodlib('ultimatelib')
    function onKill(cid, target)
        if isInArea(getThingPos(cid), USurvival.posi, USurvival.posf) then
            if #getMonstersInArea(USurvival.posi, USurvival.posf) == 1 then
                local wave = getPlayerStorageValue(cid, USurvival.storage_wave)
                if USurvival.waves[wave+1] then
                    setPlayerStorageValue(cid, USurvival.storage_wave, wave + 1)
                    addEvent(doStartWave, 30000, wave + 1, cid)
                    doPlayerSendTextMessage(cid, 22, 'Congratulations! Next wave will start in 30 seconds!')
                else
                    doPlayerSendTextMessage(cid, 22, 'CONGRATULATIONS! YOU HAVE BEATEN THE SURVIVAL!')
                    local reward = USurvival.final_reward
                    if reward.item then
                        doPlayerAddItem(cid, reward.item, (reward.amount or 1), false)
                    end
                    if reward.exp then
                        doPlayerAddExp(cid, reward.exp)
                    end
                    if reward.money then
                        doPlayerAddMoney(cid, reward.money)
                    end
                    local medal = doPlayerAddItem(cid, 5785, 1, false)
                    if medal then
                        doItemSetAttribute(medal, 'description', 'This was awarded to '..getCreatureName(cid)..' for completing the Ultimate Survival.')
                        doItemSetAttribute(medal,'name', 'Ultimate Survival Medal')
                    end
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
                end
            end
        end
        return true
    end

    ]]></event>

    <event type="preparedeath" name="UltimateSurvival2" event="script"><![CDATA[
    domodlib('ultimatelib')
    function onPrepareDeath(cid, killers)
        if isInArea(getThingPos(cid), USurvival.posi, USurvival.posf) then
            doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
            doRemoveConditions(cid, false)
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            doPlayerSendTextMessage(cid, 21, 'Too bad, you couldn\'t defeat the Ultimate Survival... Better luck next time.')
            local reward = USurvival.waves[getPlayerStorageValue(cid, USurvival.storage_wave)].reward
            if reward.item then
                doPlayerAddItem(cid, reward.item, reward.amount or 1)
            end
            if reward.exp then
                doPlayerAddExp(cid, reward.exp)
            end
            if reward.money then
                doPlayerAddMoney(cid, reward.money)
            end
            return false
        end
        return true
    end
    ]]></event>

    </mod>

     

  5. TFS 0.4

     

    Me passaram um mod do evento Survive com o sistema em movements(stepin), queria passar esse movements que é um piso para uma action q seria uma alavanca, mas para usar a alavanca precisaria ter algum item na bp e o item sumiria, ao invez de ser por tempo. 

     

    Spoiler

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
                    ULTIMATE SURVIVAL - Código feito por Omega / Pedido por vinnevinne
                        
    -->
     
    <mod name="Survive" version="1.0" author="Omega" enabled="yes">
    <config name="ultimatelib"><![CDATA[
    USurvival = {
        posi = {x=110, y=151, z=11},
        posf = {x=121, y=162, z=11},
        posc = {x=115, y=156, z=11},
        
        waves = {
        [1] = {monsters = {'wolf', 'wolf beast'}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [2] = {monsters = {"shadow beast","shadow lion","shadow skeleton","shadow prisioner","shadow tombler"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [3] = {monsters = {"raditz","nappa","turles","bardock","broly","gotenks","vegeta","king vegeta","goku","gogeta","vegetto"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [4] = {monsters = {"broly ssj","gotenks ssj","vegeta ssj","king vegeta ssj","gogeta ssj"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [5] = {monsters = {"gotenks ssj3","goku ssj3"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [6] = {monsters = {"bulma","tenshinhan","kuririn","uub","kame","turtle kame","ultimate uub","ultimate kame"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [7] = {monsters = {"cell junior","cell first","cell second","cell third","cell perfect","legendary cell"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [8] = {monsters = {"yamu","spopovitch","dabura","babidi","majin vegeta","fat boo","evil boo","majin boo","kid boo"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [9] = {monsters = {"dodoria","zarbon","cooler","spaceship freeza","warrior freeza","lord chilled","demonic cooler","legendary cooler","demonic freeza","demonic chilled","golden freeza","legendary chilled"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [10] = {monsters = {"c8","c16","c17","c18","c19","c20","super c16","super 18","super 17","super 20"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [11] = {monsters = {"gogeta","gogeta ssj","gotenks","gotenks ssj","vegetto","gogeta ssj4","gogeta blue","vegetto ssj4","vegetto ssj5","vegetto blue","gotenks ssj3"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [12] = {monsters = {"janemba","majin janemba","kid janemba","demonic janemba","black janemba"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [13] = {monsters = {"fat boo","evil boo","majin boo","kid boo"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [14] = {monsters = {"naturon shenron","oceanus shenron","rage shenron","nuova shenron","eis shenron","haze shenron","omega shenron","final omega shenron","shadow omega shenron"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [15] = {monsters = {"pan ssj4","gohan ssj4","vegetto ssj4","goku ssj4","vegeta ssj4","trunks ssj4","turles ssj4","raditz ssj4","bardock ssj4","broly ssj4","gogeta ssj4"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [16] = {monsters = {"super c16","super c17","super c18","super c20"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [17] = {monsters = {"goku ssj5","vegeta ssj5","turles ssj5","bardock ssj5","gohan ssj5","trunks ssj5","raditz ssj5","zaiko ssj5","vegetto ssj5"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [18] = {monsters = {"demonic cooler","demonic freeza","demonic chilled","demonic janemba"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [19] = {monsters = {"legendary king vegeta","legendary cell","legendary chilled","legendary cooler"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [20] = {monsters = {"golden freeza"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [21] = {monsters = {"omega shenron","final omega shenron","shadow omega shenron", count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [22] = {monsters = {"vegetto blue","goku god","vegeta god","Gogeta Blue"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [23] = {monsters = {"ultimate uub","ultimate kame"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [24] = {monsters = {"namekjin","strong namek","ultra namekjin","namekjin scout","furie namek","namekjin cultist","namekjin warrior","elder namekjin","namekjin mindcontroller","furie namek","ultimate namekjin"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
        [25] = {monsters = {"Goku Limit Break"}, count = 30, reward = {exp = 0, item = 0, amount = 0, money = 0}},
    },
        exhaust = 1 * 24 * 60 * 60, -- Tempo em segundos até poder entrar novamente na arena (1 * 24 * 60 * 60 = 1 dia)
        
        final_reward = {item = 6542, amount = 1, exp = 0, money = 0},
        
        storage_ex = 607069,
        storage_wave = 607089,
    }

    function isWalkable(pos)-- by Nord / editado por Omega
        if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
            return false
        elseif isCreature(getTopCreature(pos).uid) then
            return false
        elseif getTileInfo(pos).protection then
            return false
        elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then
            return false
        end
    return true
    end

    function doSpawnMonsters(monsters, pos, radius, limit)
        if not pos.x or not pos.y or not pos.z or not type(monsters) == 'table' then
            return false
        end
            local radius = tonumber(radius)
        if radius > 5 then
            radius = 5
        elseif radius < 2 then
            radius = 2
        end
        if not limit or limit < 1 then
            limit = 1
        elseif limit > radius ^ 2 then
            limit = math.floor((radius*1.5) ^ 2)
        end
        
        local k = 0
        local tries = 0
        repeat
            for x = pos.x - radius, pos.x + radius do
                for y = pos.y - radius, pos.y + radius do
                    if isWalkable({x=x, y=y, z=pos.z}) then
                        local monster = monsters[math.random(1, #monsters)]
                        local chance = math.random(1, 100)
                        if k == limit then
                            break
                        elseif chance <= 8 and doCreateMonster(monster, {x=x, y=y, z=pos.z}) then
                            k = k + 1
                        end
                    end
                end
            end
            tries = tries + 1
        until k >= limit or tries >= 500
        return k >= limit and true or false
    end

    function getPlayersInArea(pos1,pos2)
        local players = {}
        if pos1.x and pos1.y and pos2.x and pos2.y and pos1.z == pos2.z then
            for a = pos1.x, pos2.x do
                for b = pos1.y,pos2.y do
                    local pos = {x=a,y=b,z=pos1.z}
                    if isPlayer(getTopCreature(pos).uid) then
                        table.insert(players,getTopCreature(pos).uid)
                    end
                end
            end
            return players
        else
            return false
        end
    end    

    function getMonstersInArea(pos1,pos2)
        local players = {}
        if pos1.x and pos1.y and pos2.x and pos2.y and pos1.z == pos2.z then
            for a = pos1.x, pos2.x do
                for b = pos1.y,pos2.y do
                    local pos = {x=a,y=b,z=pos1.z}
                    if isMonster(getTopCreature(pos).uid) then
                        table.insert(players,getTopCreature(pos).uid)
                    end
                end
            end
            return players
        else
            return false
        end
    end

    function doCleanArena()
        local monsters = getMonstersInArea(USurvival.posi, USurvival.posf)
        for _, cid in pairs(monsters) do
            doRemoveCreature(cid)
        end
    end

    function doStartWave(waveID, cid)
        if not isCreature(cid) then return false end
        if USurvival.waves[waveID] then
            wave = USurvival.waves[waveID]
            doSpawnMonsters(wave.monsters, USurvival.posc, 5, wave.count)
            doPlayerSendTextMessage(cid, 21, 'Wave '..waveID..' has started! FIGHT!')
        end
    end
    ]]></config>


    <movement type="StepIn" actionid="4599" event="script" override="yes"><![CDATA[
    domodlib('ultimatelib')
    function onStepIn(cid, item, position, fromPosition)
        if getPlayerStorageValue(cid, USurvival.storage_ex) <= os.time() then
            if #getPlayersInArea(USurvival.posi, USurvival.posf) == 0 then
                doCleanArena()
                doTeleportThing(cid, USurvival.posc)
                doPlayerSendTextMessage(cid, 21, 'A Survival tera inicio em 10 segundos!')
                addEvent(doStartWave, 10000, 1, cid)
                summons = getCreatureSummons(cid)
                for _, summon in pairs(summons) do
                      doSendMagicEffect(getThingPos(summon), effect)
                      doRemoveCreature(summon)
                end
                setPlayerStorageValue(cid, USurvival.storage_wave, 1)
                setPlayerStorageValue(cid, USurvival.storage_ex, os.time() + USurvival.exhaust)
            else
                doCreatureSay(cid, "Ja tem alguem la dentro.", TALKTYPE_ORANGE_1)
                doPlayerSendCancel(cid, 'Ja tem alguem la dentro.')
                doTeleportThing(cid, fromPosition, true)
                doSendMagicEffect(getThingPos(cid), 2)
            end
        else
            local left = getPlayerStorageValue(cid, USurvival.storage_ex) - os.time()
            left = {hour = math.floor(left/3600), minutes = math.ceil((left % 3600)/60)}
            doPlayerSendTextMessage(cid, 21, 'Voce precisa esperar '.. left.hour ..'h e '..left.minutes..'min.')
            local pos = {x = 43, y = 149, z = 11}
            doTeleportThing(cid, pos, true)
            doSendMagicEffect(getThingPos(cid), 2)
        end
    return true
    end
    ]]></movement>

    <event type="login" name="US Login" event="script"><![CDATA[
    domodlib('ultimatelib')
    function onLogin(cid)
        registerCreatureEvent(cid,'UltimateSurvival1')
        registerCreatureEvent(cid,'UltimateSurvival2')
        if isInArea(getThingPos(cid), USurvival.posi, USurvival.posf) then
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            doSendMagicEffect(getThingPos(cid), 10)
        end
        return true
    end
    ]]></event>

    <event type="kill" name="UltimateSurvival1" event="script"><![CDATA[
    domodlib('ultimatelib')
    function onKill(cid, target)
        if isInArea(getThingPos(cid), USurvival.posi, USurvival.posf) then
            if #getMonstersInArea(USurvival.posi, USurvival.posf) == 1 then
                local wave = getPlayerStorageValue(cid, USurvival.storage_wave)
                if USurvival.waves[wave+1] then
                    setPlayerStorageValue(cid, USurvival.storage_wave, wave + 1)
                    addEvent(doStartWave, 5000, wave + 1, cid)
                    doPlayerSendTextMessage(cid, 22, 'Parabens, a proxima wave comecara em 5 segundos!')
                else
                    doPlayerSendTextMessage(cid, 22, 'Parabens voce terminou a Survival!')
                    local amount = 1
                    local event = getPlayerStorageValue(cid, EVENT_STORAGE) <= 0 and 0 or getPlayerStorageValue(cid, EVENT_STORAGE)
                    setPlayerStorageValue(cid, EVENT_STORAGE, event+amount)
                    local point = getPlayerStorageValue(cid, EVENT_STORAGE) <= 0 and 0 or getPlayerStorageValue(cid, EVENT_STORAGE)
                    local reward = USurvival.final_reward
                    if reward.item then
                        doPlayerAddItem(cid, reward.item, (reward.amount or 1), false)
                    end
                    if reward.exp then
                        doPlayerAddExp(cid, reward.exp)
                    end
                    if reward.money then
                        doPlayerAddMoney(cid, reward.money)
                    end
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
                end
            end
        end
        return true
    end

    ]]></event>

    <event type="preparedeath" name="UltimateSurvival2" event="script"><![CDATA[
    domodlib('ultimatelib')
    function onPrepareDeath(cid, killers)
        if isInArea(getThingPos(cid), USurvival.posi, USurvival.posf) then
            doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
            doRemoveConditions(cid, false)
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            doPlayerSendTextMessage(cid, 21, 'Too bad, you couldn\'t defeat the Survival... Better luck next time.')
            local reward = USurvival.waves[getPlayerStorageValue(cid, USurvival.storage_wave)].reward
            if reward.item then
                doPlayerAddItem(cid, reward.item, reward.amount or 1)
            end
            if reward.exp then
                doPlayerAddExp(cid, reward.exp)
            end
            if reward.money then
                doPlayerAddMoney(cid, reward.money)
            end
            return false
        end
        return true
    end
    ]]></event>

    </mod>

     

  6. Em 14/08/2017 em 00:08, KotZletY disse:

    @ZikaLord 

    
    local msg = "Agora seu sistema PvP está %s."
    function onSay(cid, words, param)
    local _table = {
        ["on"] = {"ativado", 1},
        ["off"] = {"desativado", 0},
    }
        if _table[param:lower()] then
            local mode = _table[param:lower()]
            setPlayerStorageValue(cid, 91821, mode[2])
            doPlayerSendTextMessage(cid, 27, "Seu pvp foi "..msg:format(mode[1]))
        end
        return true
    end

     

    e a tag xml deve estar assim:

    
    <talkaction words="!pvp" event="script" value="pvpon.lua"/>

    E então quando ele falar !pvp ae ele deve adicionar o param que é checado no script: !pvp on irá ativar e !pvp off irá desativar.

     

     

    creaturescripts:

      Ocultar conteúdo
    
    
    function onCombat(cid, target)
        if isPlayer(target) and isPlayer(cid) then
         if getPlayerStorageValue(cid, 91821) <= 0 then
          doPlayerSendCancel(cid, "Você está com o modo PvP desligado. Se quiser atacar outros jogadores, ative-o falando !pvp on.")
          return false
         elseif getPlayerStorageValue(target, 91821) <= 0 then
          doPlayerSendCancel(cid, "Seu target, está com o pvp desativado, ele precisa ativar para você poder ataca-lo.")
          return false
         end
    	end
       return true
    end
    
     
    function onLogin(cid)
     registerCreatureEvent(cid, "PvPCombat")
     setPlayerStorageValue(cid, 91821, 1)
     return true
    end

     

     

    Tags creaturescripts.xml:

    
    <event type="combat" name="PvPCombat" event="script" value="pvp.lua"/>
    <event type="login" name="PvPLogin" event="script" value="pvp.lua"/> 

     

    tem 1 erro, se a pessoa tive pk e der !pvp off ela fica pvp off, da pro cara usar qndo tive morrendo

  7. 2 horas atrás, Vodkart disse:

     

    deixa eu ver como ficou seu código editado...

    Spoiler

    boss_hours = {
        ["01:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=1142, z=8}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["02:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["03:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["04:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=1142, z=8}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["05:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["06:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["07:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=1142, z=8}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["08:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["09:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["10:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=1142, z=8}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["11:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["12:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["13:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=1142, z=8}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["14:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["15:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["16:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=1142, z=8}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["17:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["18:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["19:00"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=1142, z=8}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["20:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["21:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["23:45"] = {boss_name = "Phoenix Boss", pos = {fromPosition = {x=238, y=1142, z=8}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["23:00"] = {boss_name = "Gogeta Boss", pos = {fromPosition = {x=213, y=775, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10},
        ["00:00"] = {boss_name = "Dende Boss", pos = {fromPosition = {x=542, y=433, z=6}, toPosition = {x=1024, y=915, z=7}}, time = 30, extra_time = 10}
    }
    function isWalkable(pos) -- by Nord / editado por Omega
        if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
            return false
        elseif isCreature(getTopCreature(pos).uid) then
            return false
        elseif getTileInfo(pos).protection then
            return false
        elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then
            return false
        end
        return true
    end
    function getPlayersInBossArea(tb)
        local t = {}
        for _, pid in pairs(getPlayersOnline()) do
            if isInRange(getPlayerPosition(pid), tb.pos.fromPosition, tb.pos.toPosition) then 
                t[#t+1] = pid
            end
        end
        return t
    end 
    function doRemoveBoss(tb, force)
        for x = tb.pos.fromPosition.x, tb.pos.toPosition.x do
            for y = tb.pos.fromPosition.y, tb.pos.toPosition.y do
                local m = getTopCreature({x=x, y=y, z= tb.pos.fromPosition.z}).uid
                if m ~= 0 and isMonster(m) then
                    if not force and #getPlayersInBossArea(tb) > 0 then
                        addEvent(doRemoveBoss, tb.extra_time*60*1000, tb, true)
                        return true
                    end
                    doSendMagicEffect(getCreaturePosition(m), 54) -- Efeito no monstro quando for removido
                    doSendMagicEffect(getCreaturePosition(m), 3) -- Efeito no monstro quando for removido
                    doRemoveCreature(m)
                    break
                end
            end
        end
    end    
    function onThink(interval, lastExecution)
        hours = tostring(os.date("%X")):sub(1, 5)
        tb = boss_hours[hours]
        if tb then
            local create = true
            repeat
                local pos = {x = math.random(tb.pos.fromPosition.x, tb.pos.toPosition.x), y = math.random(tb.pos.fromPosition.y, tb.pos.toPosition.y), z = tb.pos.fromPosition.z}
                if isWalkable(pos) then
                    doCreateMonster(tb.boss_name, pos)
                    doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)
                    addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)
                    addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)
                    doSendMagicEffect(pos, CONST_ME_MORTAREA)
                    doBroadcastMessage("O Boss "..tb.boss_name.." nasceu!")
                    addEvent(doRemoveBoss, tb.time*60*1000, tb, false)
                    create = false 
                end
            until not create
        end
        return true
    end  

     

  8. 2 horas atrás, Vodkart disse:

    xml é mods no caso?

    nn, tipo isso n é global events? como coloca no xml de global events?
    eu coloquei isso aq     <globalevent name="othersboss" script="othersboss.lua" />, mas n sei como coloca n

  9. Em 10/10/2020 em 22:30, Vodkart disse:

    @BangxD

     

    Não testei

     

    
    boss_hours = {
    	["10:00"] = {boss_name = "Demon", pos = {fromPosition = {x=1011, y=910, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 20, extra_time = 10},
    	["11:00"] = {boss_name = "Rat", pos = {fromPosition = {x=1011, y=910, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 20, extra_time = 10},
    	["12:00"] = {boss_name = "Hydra", pos = {fromPosition = {x=1011, y=910, z=7}, toPosition = {x=1024, y=915, z=7}}, time = 20, extra_time = 10}
    }
    function isWalkable(pos) -- by Nord / editado por Omega
    	if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
    		return false
    	elseif isCreature(getTopCreature(pos).uid) then
    		return false
    	elseif getTileInfo(pos).protection then
    		return false
    	elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then
    		return false
    	end
    	return true
    end
    function getPlayersInBossArea(tb)
    	local t = {}
    	for _, pid in pairs(getPlayersOnline()) do
    		if isInRange(getPlayerPosition(pid), tb.pos.fromPosition, tb.pos.toPosition) then 
    			t[#t+1] = pid
    		end
    	end
    	return t
    end 
    function doRemoveBoss(tb, force)
    	for x = tb.pos.fromPosition.x, tb.pos.toPosition.x do
    		for y = tb.pos.fromPosition.y, tb.pos.toPosition.y do
    			local m = getTopCreature({x=x, y=y, z= tb.pos.fromPosition.z}).uid
    			if m ~= 0 and isMonster(m) then
    				if not force and #getPlayersInBossArea(tb) > 0 then
    					addEvent(doRemoveBoss, tb.extra_time*60*1000, tb, true)
    					return true
    				end
    				doSendMagicEffect(getCreaturePosition(m), 54) -- Efeito no monstro quando for removido
    				doSendMagicEffect(getCreaturePosition(m), 3) -- Efeito no monstro quando for removido
    				doRemoveCreature(m)
    				break
    			end
    		end
    	end
    end	
    function onThink(interval, lastExecution)
    	hours = tostring(os.date("%X")):sub(1, 5)
    	tb = boss_hours[hours]
    	if tb then
    		local create = true
    		repeat
    			local pos = {x = math.random(tb.pos.fromPosition.x, tb.pos.toPosition.x), y = math.random(tb.pos.fromPosition.y, tb.pos.toPosition.y), z = tb.pos.fromPosition.z}
    			if isWalkable(pos) then
    				doCreateMonster(tb.boss_name, pos)
    				doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)
    				addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)
    				addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)
    				doSendMagicEffect(pos, CONST_ME_MORTAREA)
    				doBroadcastMessage("O Boss "..tb.boss_name.." nasceu!")
    				addEvent(doRemoveBoss, tb.time*60*1000, tb, false)
    				create = false 
    			end
    		until not create
    	end
    	return true
    end  

     

    COMO POE EM XML?

  10. Encontrei um script aqui no tibia king, ele vira o personagem para o alvo, mas se o alvo estiver na diagonal ele acaba não virando, alguém consegue colocar esse script para viara para o alvo se o alvo estiver na diagonal fazendo um favor

    Spoiler
    
    function onAttack(cid, target)
    	doCreatureSetLookDirection(cid, getDirectionTo(getCreaturePosition(cid), getCreaturePosition(target)))
    	return true
    end

    TFS 0.4

  11. 5 minutos atrás, Sun disse:
      Mostrar conteúdo oculto
    
    
    <?xml version="1.0" encoding="UTF-8"?>
    <mod name="AdvancedExpPotionSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com">
    <!-- Configs and Functions -->
    <config name="PotionExpConfigs"><![CDATA[
    ------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
    configs = {
    time = 30, ---- TIME IN MINUTES
    needpa = FALSE,
    needlvl = {TRUE, level = 200},
    costmana = {FALSE, mana = 0},
    addrate = 25, -- Exp que vai adicionar em %
    removeonuse = TRUE
    }
    function getTime(s)
        local n = math.floor(s / 60)
        s = s - (60 * n)
        return n, s
    end
    CreatureEventChecker = function(event, ...) -- Colex
        if isCreature(arg[1]) then
       event(unpack(arg))
        end
    end
    creatureEvent = function(event, delay, ...) -- Colex
        addEvent(CreatureEventChecker, delay, event, unpack(arg))
    end
    function getPlayerExtraExpRate(cid) -- By MatheusMkalo
        return (getPlayerRates(cid)[8]-1)*100
    end
    ]]></config>
    <!-- exppotion.lua -->
    <action itemid="5880" event="script"><![CDATA[
    domodlib('PotionExpConfigs')
    if (getPlayerStorageValue(cid, 62164) - os.time()) > 0 then
        return doPlayerSendCancel(cid, "Voce ja ta Sob o Efeito da Potion.")
    end
    if configs.needpa and not isPremium(cid) then
        return doPlayerSendCancel(cid, "Voce Precisar ser Premium Para Usar")
    end
    if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then
        return doPlayerSendCancel(cid, "Voce Precisa ser " .. configs.needlvl.level .. " Para usar a Potion.")
    end
    if configs.costmana[1] then
    if getCreatureMana(cid) < configs.costmana.mana then
        return doPlayerSendCancel(cid, "Voce Precisar ter " .. configs.costmana.mana .. " de Mana Para usar a Potion")
    else
    doCreatureAddMana(cid, -configs.costmana.mana)
    end
    end
    if configs.removeonuse then
        doRemoveItem(item.uid, 1)
    end
     
    for i = configs.time*60, 1, -1 do
    local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
    if #a < 4 then
    a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
    end
    if i == configs.time*60 then
    creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "Efeito Final da Pocao de EXP.")
    end
    creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "O Efeito da Pocao vai acabar em "..a..".")
    end
    doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
    creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
    doPlayerSendTextMessage(cid, 22, "Agora Voce Esta Recebendo mais EXP por Matar Monstros.")
    setPlayerStorageValue(cid, 62164, os.time())
    creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62164, 0)
    return TRUE
    ]]></action>
    <creaturescript type="login" name="ExpPotion" event="script"><![CDATA[
    domodlib('PotionExpConfigs')
    local time = configs.time
        if os.time()-getPlayerStorageValue(cid, 62164) < time *60 then
      doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
      creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
      creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000 , cid, 62164, 0)
      for i = (time*60-(os.time()-getPlayerStorageValue(cid, 62164))), 1, -1 do
      local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
      if #a < 4 then
      a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
      end
      if i == (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) then
      creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 62164)))*1000, cid, "O Efeito da Potion Termina em.")
      end
      creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62164)))-i)*1000, cid, "O Efeito da Potion Termina em "..a..".")
      end
        end
    return TRUE
    ]]></creaturescript>
    </mod>

     

    @Orientalz

    foi, obg

  12. 22 minutos atrás, Sun disse:
      Ocultar conteúdo
    
    
    
    
    function onUse(cid, item, frompos, item2, topos)
    local pausa = 120*60*120000 -- (1000 = 1 segundos) Tempo que o script durará
    local texto = "Você dobrou sua Experiencia por 2 Horas" -- Texto que irá receber ao usar a potion.
    textofinal = "Acabou o potion de Experiencia." -- Texto que irá receber quando o efeito da potion acabar.
    local exp = 2 -- O quanto que você quer que dobre sua experiencia, por exemplo 2 é 2x as rates do seu server.
    expfinal = 1 --Não mude, isso é para a experiencia voltar ao normal.
    local limitedeuso = 49015
    local tempo = 120*60*1000 -- 1000 = 1s então 1000 vezes 60 vezes 30 = 30 minutos
    local textofinal1 = "Você já esta sob efeito da pot de experiência espere o efeito acabar."
    local seuitem = 7439 -- seu item que dará double exp
    local efeito1 = 27 -- efeito que ficara com o char por meia hora
    local efeito2 = 65 -- efeito que acontecera no momento que usar a pot
      
    --fim da parte configuravel não mecha se nao tiver conhecimento de scripting
    local timeEffect = 1801 -- tempo em segundos que o efeito vai aparecer no player, 31 = 30 segundos. sempre coloque 1 segundo a mais.
     
          function effect()
             if isPlayer(cid) then
                local pos = getCreaturePosition(cid)
                doSendMagicEffect(pos, efeito1)
             end
          end
          
    if item.itemid == seuitem and (getPlayerStorageValue(cid, limitedeuso) - os.time() <= 0) then
         doRemoveItem(item.uid,1)
         doPlayerSetExperienceRate(cid,exp)
         doSendMagicEffect(frompos,efeito2)
         setPlayerStorageValue(cid, limitedeuso, os.time() + 1800)
         doPlayerSendTextMessage(cid, 22, texto)
       a = 1
      while a ~= timeEffect do
            addEvent(effect, a * 1000)
            a = a + 1
      end
     else
    	doPlayerSendTextMessage(cid, 21, textofinal1)
    	return true
    end
     
     
    return true
    end

     

    testa ae!

    @Orientalz

    como adiciona isso?
    O codigo q eu uso

     

    Spoiler

    <?xml version="1.0" encoding="UTF-8"?>
    <mod name="AdvancedExpPotionSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com">
    <!-- Configs and Functions -->
    <config name="PotionExpConfigs"><![CDATA[
    ------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
    configs = {
    time = 30, ---- TIME IN MINUTES
    needpa = FALSE,
    needlvl = {TRUE, level = 200},
    costmana = {FALSE, mana = 0},
    addrate = 25, -- Exp que vai adicionar em %
    removeonuse = TRUE
    }
    function getTime(s)
        local n = math.floor(s / 60)
        s = s - (60 * n)
        return n, s
    end
    CreatureEventChecker = function(event, ...) -- Colex
        if isCreature(arg[1]) then
       event(unpack(arg))
        end
    end
    creatureEvent = function(event, delay, ...) -- Colex
        addEvent(CreatureEventChecker, delay, event, unpack(arg))
    end
    function getPlayerExtraExpRate(cid) -- By MatheusMkalo
        return (getPlayerRates(cid)[8]-1)*100
    end
    ]]></config>
    <!-- exppotion.lua -->
    <action itemid="5880" event="script"><![CDATA[
    domodlib('PotionExpConfigs')
    if getPlayerStorageValue(cid, 62164) >= 1 then
        return doPlayerSendCancel(cid, "Voce ja ta Sob o Efeito da Potion.")
    end
    if configs.needpa and not isPremium(cid) then
        return doPlayerSendCancel(cid, "Voce Precisar ser Premium Para Usar")
    end
    if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then
        return doPlayerSendCancel(cid, "Voce Precisa ser " .. configs.needlvl.level .. " Para usar a Potion.")
    end
    if configs.costmana[1] then
    if getCreatureMana(cid) < configs.costmana.mana then
        return doPlayerSendCancel(cid, "Voce Precisar ter " .. configs.costmana.mana .. " de Mana Para usar a Potion")
    else
    doCreatureAddMana(cid, -configs.costmana.mana)
    end
    end
    if configs.removeonuse then
        doRemoveItem(item.uid, 1)
    end
     
    for i = configs.time*60, 1, -1 do
    local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
    if #a < 4 then
    a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
    end
    if i == configs.time*60 then
    creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "Efeito Final da Pocao de EXP.")
    end
    creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "O Efeito da Pocao vai acabar em "..a..".")
    end
    doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
    creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
    doPlayerSendTextMessage(cid, 22, "Agora Voce Esta Recebendo mais EXP por Matar Monstros.")
    setPlayerStorageValue(cid, 62164, os.time())
    creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62164, 0)
    return TRUE
    ]]></action>
    <creaturescript type="login" name="ExpPotion" event="script"><![CDATA[
    domodlib('PotionExpConfigs')
    local time = configs.time
        if os.time()-getPlayerStorageValue(cid, 62164) < time *60 then
      doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
      creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
      creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000 , cid, 62164, 0)
      for i = (time*60-(os.time()-getPlayerStorageValue(cid, 62164))), 1, -1 do
      local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
      if #a < 4 then
      a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
      end
      if i == (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) then
      creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 62164)))*1000, cid, "O Efeito da Potion Termina em.")
      end
      creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62164)))-i)*1000, cid, "O Efeito da Potion Termina em "..a..".")
      end
        end
    return TRUE
    ]]></creaturescript>
    </mod>

     

  13. Em 08/01/2017 em 22:08, Vodkart disse:

     

    
    
    	local ranks = {
    		[{1, 20}] = "Huntsman", 
    		[{21, 50}] = "Ranger",
    		[{51, 100}] = "Big Game Hunter",
    		[{101, 200}] = "Trophy Hunter",		
    		[{201, math.huge}] = "Elite Hunter"
    	}

     

    TEM COMO POR TIPO BONUS FIXO PARA ESSES RANKS? TIPO SE TU FOR RANK RANGER GANHA 2 DE SHIELD, SE FOR BIG GAME HUNTER GANHA 2 DE AXE, SWORD E CLUB, SE FOR TROPHY HUNTER GANHA 10K DE HP E MANA, SE FOR ELITE HUNTER GANHA 2 DE ML
    CONSEGUE FAZER ISSO?

  14. Em 13/01/2021 em 22:20, Tottin disse:

                                                                                       Explicação do Sistema

     

    Recentemente foi levantada uma ideia de Sistema no Discord da Academia de Programação
    O sistema consiste em dar maior liberdade pro mercado e tirar a parte monótona dos NPCS que basicamente sempre vendem/compram tudo ao mesmo preço, assim ficando muito longe da realidade de 1 verdadeiro vendedor.
    A ideia é que o NPC venda produtos com base no que ele tenha em estoque, logo para ele vender 1 Blusa ele 1° irá precisar comprá-la de alguém.
    Exemplificando:
    O NPC só irá vender aquilo que comprar, se ele comprar 1 Blusa ele irá disponibilizar para vender 1 Blusa, se ele comprar 7 Blusas, ele irá disponibilizar pra vender 7 Blusas, ao acabar elas, o seu estoque fica vazio e ele deixa de vender até comprar mais.
    O preço que o NPC paga pelo seus produtos é baseado na quantidade de seu estoque, e o valor que ele cobra ao vender os produtos é definido previamente em 1 configuração.
    Exemplo: Quanto + item do mesmo produto o NPC tiver, + barato ele irá pagar nos mesmos, visto que ele já possui 1 estoque grande e na teoria esse produto não é um produto que possui 1 saída muito fácil. Ao mesmo tempo, quanto menor a quantidade de 1 mesmo produto em seu estoque, mais caro ele irá pagar, já que seu estoque sobre aquele produto é pequeno, o que indica que: Ou ele é muito raro, ou ele vende muito fácil, por isso o NPC irá demonstrar + interesse por ele.
    O preço que o NPC cobra é definido previamente e pode ser alterado sempre que desejar.

    Abaixo, o preço de 1 Pearl Shield que o NPC não possui em estoque:
    image.png.89210d090d06b585803b04129f55a87f.png 

    E agora, após o NPC ter comprado 10 Shields do mesmo:
    image.png.3fd3d9e59837397d4d50a9bb471a2a2c.png

    Enfim, agora que o sistema já foi previamente explicado, vamos a instalação:

    Vá para data/lib/ e crie 1 arquivo chamado npc_system.lua, nele você irá adicionar o seguinte código:
     

      Mostrar conteúdo oculto
    
    
    configurations = {
        Storage = 98170, -- storage utilizada pelo sistema para armazenar os items disponiveis para venda no npc
    }
    
    
    -- Tabela de items a serem comprados pelo Npc -- 
    tb_Items = { 
    --  [ITEMID] = {price = PRECO QUE O NPC VAI PAGAR AO PLAYER, newPrice = PRECO QUE O NPC VAI VENDER O ITEM}
        [15803] = {price = 10, newPrice = 20}, -- Sapphire Shield
        [15804] = {price = 10, newPrice = 20}, -- Pearl Shield
    }
    
    
    -------- Nao mexa daqui para baixo se não souber
    function setStorageTable(storage, tab)
        local tabstr = "&"
        for i,x in pairs(tab) do
            tabstr = tabstr .. i .. "," .. x.itemid .. ","..x.count..";"
        end
        setGlobalStorageValue(storage, tabstr:sub(1, #tabstr-1))
    end
    
    function getStorageTable(storage) 
        local tabstr = getGlobalStorageValue(storage)
        local tab = {}
        if type(tabstr) ~= "string" then
            return {}
        end
        if tabstr:sub(1,1) ~= "&" then
            return {}
        end
        local tabstr = tabstr:sub(2, #tabstr)
        local a = string.explode(tabstr, ";")
        for i,x in pairs(a) do
            local b = string.explode(x, ",")
            table.insert(tab, {itemid = tonumber(b[2]) or b[2], count = tonumber(b[3]) or b[3]})
        end
        return tab
    end
    
    function isInNpcTable(item, tb)
        for _,i in pairs(tb)do
            if tonumber(i.id) == tonumber(item) then
                return true
            end
        end
        return false
    end
    
    function addNpcItemTable(item, count)
        local x = getStorageTable(configurations.storage)
        local exist = false
        for v, k in pairs(x) do
            if tonumber(k.itemid) == tonumber(item) then
                k.count = k.count + count
                exist = true
            end
        end
        if not exist then
            table.insert(x,{itemid = tonumber(item), count = count})
            setStorageTable(configurations.storage, x)
        end
        return setStorageTable(configurations.storage, x)
    end
    
    function removeNpcItemTable(item, count)
        local x = getStorageTable(configurations.storage)
        for i,v in ipairs(x) do
            if tonumber(v.itemid) == tonumber(item) then
                if v.count > count then
                    v.count = v.count - count
                else
                    table.remove(x,i)
                end
            end
        end
        return setStorageTable(configurations.storage, x)
    end
    
    function attNpcItemsList(cid)
    local tb = {}
    local npc_items = getStorageTable(configurations.storage)
        for var, ret in pairs(tb_Items) do
            for v, k in pairs(npc_items) do
                if not isInNpcTable(k.itemid, tb) and not isInNpcTable(var, tb) then
                    if var == k.itemid then
                        if getItemInfo(k.itemid).stackable == true then
                            if k.count > 500 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.5, name = getItemNameById(var)})
                            elseif k.count > 400 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.6, name = getItemNameById(var)})
                            elseif k.count > 300 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.7, name = getItemNameById(var)})
                            elseif k.count > 200 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.8, name = getItemNameById(var)})
                            elseif k.count > 100 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.9, name = getItemNameById(var)})
                            else
                                table.insert(tb, {id = var, subType = 0, sell = ret.price, name = getItemNameById(var)})
                            end
                        else
                            if k.count > 50 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.5, name = getItemNameById(var)})
                            elseif k.count > 40 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.6, name = getItemNameById(var)})
                            elseif k.count > 30 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.7, name = getItemNameById(var)})
                            elseif k.count > 20 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.8, name = getItemNameById(var)})
                            elseif k.count > 10 then
                                table.insert(tb, {id = var, subType = 0, sell = ret.price*0.9, name = getItemNameById(var)})
                            else
                                table.insert(tb, {id = var, subType = 0, sell = ret.price, name = getItemNameById(var)})
                            end
                        end
                    end
                end
            end
            if not isInNpcTable(var, tb) then
                table.insert(tb, {id = var, subType = 0, sell = ret.price, name = getItemNameById(var)})
            end
        end
        for var, ret in pairs(tb_Items) do
            for v, k in pairs(npc_items) do
                if var == k.itemid then
                    table.insert(tb, {id = k.itemid, subType = 0, buy = ret.newPrice, count = k.count, name = getItemNameById(k.itemid)})
                end
            end
        end
    return tb
    end

     


    2º Agora vá para  data/npcs, crie 1 arquivo chamado: negociante.xml, nele você irá adicionar o seguinte código:
     

      Mostrar conteúdo oculto
    
    
    <?xml version="1.0"?>
    <npc name="Negociante" script="negociante.lua" walkinterval="50000" floorchange="0">
        <health now="150" max="150"/>
        <look type="181" head="120" body="50" legs="97" feet="132"/>
    <parameters>
    <parameter key="message_greet" value="Ola |PLAYERNAME|. Eu compro equipamentos e items variados. Diga 'trade' para ver minhas ofertas."/>
    </parameters>
    </npc>

     

    3º Agora vá para data/npcs/scripts, crie 1 arquivo chamado: negociante.lua, nele você irá adicionar o seguinte código:
     

      Mostrar conteúdo oculto
    
    
    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
        local shopWindow = {}
        onSelling = function(cid, item, subType, amount, ignoreCap, inBackpacks)
            local store,exausted = 552612,3
            local priceTicks = tb_Items[item].price*amount
            if getPlayerStorageValue(cid, store) >= os.time() then
                doPlayerSendCancel(cid, "Espere " .. getPlayerStorageValue(cid, store) - os.time() .. " segundos para vender seus items.") return true
            end
            if doPlayerRemoveItem(cid, item, amount) then
                doPlayerAddMoney(cid, priceTicks)
                npcHandler:say("Voce vendeu " .. amount .. "x " .. getItemNameById(item) .. " por " .. priceTicks .. " yens.", cid)
                setPlayerStorageValue(cid, store, os.time()+exausted) 
                addNpcItemTable(item, amount)
                closeShopWindow(cid)
                local shop = attNpcItemsList(cid)
                openShopWindow(cid, shop, onBuying, onSelling)
            end
            
            return true
        end
    
        onBuying = function(cid, item, subType, amount, ignoreCap, inBackpacks)
            local store,exausted = 552612,3
            local priceTicks = nil
            priceTicks = tb_Items[item].newPrice*amount
            if getPlayerStorageValue(cid, store) >= os.time() then
                doPlayerSendCancel(cid, "Espere " .. getPlayerStorageValue(cid, store) - os.time() .. " segundos para vender seus items.") return true
            end
            local npc_items = getStorageTable(configurations.storage)
                for v, k in pairs(npc_items) do
                    if k.itemid == item then
                        if k.count >= amount then
                            if doPlayerRemoveMoney(cid, priceTicks) then
                                doPlayerAddItem(cid, item, amount)
                                npcHandler:say("Voce comprou " .. amount .. "x " .. getItemNameById(item) .. " por " .. priceTicks .. " yens.", cid)
                                setPlayerStorageValue(cid, store, os.time()+exausted) 
                                removeNpcItemTable(item, amount)
                                closeShopWindow(cid)
                                local shop = attNpcItemsList(cid)
                                openShopWindow(cid, shop, onBuying, onSelling)
                            else
                                npcHandler:say("Voce nao possui dinheiro suficiente.", cid)
                            end
                        else
                            npcHandler:say("Lamento, mas atualmente eu so possuo: "..k.count.."x "..getItemNameById(k.itemid)..".", cid)
                        end
                    end
                end
            
            return true
        end
    
        if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
            shopWindow = attNpcItemsList(cid)
            openShopWindow(cid, shopWindow, onBuying, onSelling)
        end
    end
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())

     

    Instalação finalizada, as áreas configuráveis do sistema estão informadas na lib.
                            Créditos:
    Academia de Programação: Por ter levantado a ideia do sistema.
    @Endless: Por ter ajudado em uma questão de lógica.
    E a mim por ter feito. (Eu acho).

                   Informações adicionais:
    -> O sistema foi testado e não apresentou problemas, porém se vierem a encontrar falhas, favor reportar para que eu possa manter o tópico atualizado/corrigido.
    -> Eu faço correções no sistema caso esteja errado, mas não faço adaptações pro seu servidor. Caso queira variações do sistema, favor enviar seu pedido no discord da Academia de Programação, ou em meu privado: Admin#9865.


    Existe 1 bug: Quando vamo dizer q o npc tem 10 itens no estoque, se tento comprar os 10 de uma vez só vem 1 item, e o estoque do npc zera e também o dinheiro some

    image.thumb.png.a9ad8400fac4f0384a70fa387a8dea45.png e

    Tem como por pra só comprar/vender apenas 1 item por vez?

    Outro bug: image.png.0e4b95c44e782abc89fc7d3af9d0af66.pngimage.thumb.png.d1ed7018278df052b2e1c86f6fb93da5.png

    MESMO SE O ITEM TA VALENDO 900 GOLD, HORA QUE CLICA EM VENDER O ITEM SAI POR 1K

  15. Em 08/12/2020 em 21:58, Yan Liima disse:

    @OrientalzO problema da RK é em system\application\controllers\account.php. Precisa modificar este arquivo...

     

    Para remover as informações da conta que tu quer, ela se encontra em system\application\views\account.php

     

    Aba das skills se encontra em \system\application\views\highscores.php

     

    E o ultimo citado, é só ir na pasta templates e abrir seu index.tpl, tu edita lá.

    consegue explicar melhor oq preciso modificar pra remover o bug da rk?

    Em 04/12/2020 em 18:44, Nysman disse:

    Pode me disponibilizar o website ou falar onde baixou o mesmo?

    É bem mais complicado explicar sem ter conhecimento do mesmo, você disponibilizando vai ser mais fácil.

    Ou apenas os arquivos em .php, isso seria o suficiente.

    To usando esse aq

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo