Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Bom galera, é o seguinte, passei meu servidor (Dbo) de 8.54 para versão 8.60, e nesse processo o Npc Reborn, acabou dando erro, quando você reborna, O certo seria você voltar para o nível 1, Porem isso não está acontecendo, você realmente reborna, passa a utilizar as Outfits Reborn e Attack do mesmo, porem continua no level em que estava.

alguém poderia me ajudar? O problema é que ele não volta para o nível 1, Ele continua no level em que estava na hora de Resetar e da erro na Distro.



SCRIPT DO NPC :


  Citar

Citar

--[[script made 100% by Nogard and Night Wolf.
You can feel free to edit anything you want, but don't remove the credits]]


local config = {
minlevel = 250, --- level inical para resetar
price = 0, --- preço inicial para resetar
newlevel = 1, --- level após reset
priceByReset = 0, --- preço acrescentado por reset
percent = 99, ---- porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total)
levelbyreset = 0 --- quanto de level vai precisar a mais no próximo reset
}
--- end config
local cfg = {
--[vocation id] = {nova voc, looktype}
[1] = { 201, 137 }, -- GOKU
[10] = { 208, 148 }, -- GOHAN
[18] = { 215, 144 }, -- GOTEN
[24] = { 222, 152 }, -- VEGETA
[33] = { 229, 150 }, -- TRUNKS
[41] = { 236, 162 }, -- CHIBI TRUNKS
[47] = { 243, 173 }, -- PICCOLO
[53] = { 250, 221 }, -- DENDE
[58] = { 257, 60 }, -- BARDOCK
[65] = { 264, 84 }, -- BROOLY
[71] = { 271, 178 }, -- TSUFUL
[77] = { 278, 227 }, -- FREEZA
[85] = { 285, 190 }, -- COOLER
[92] = { 292, 15 }, -- ANDROID 17
[98] = { 299, 15 }, -- ANDROID 18
[104] = { 306, 34 }, -- BUU
[111] = { 313, 118 }, -- CELL
[117] = { 320, 341 }, -- SHIN
[122] = { 327, 102 }, -- PAN
[128] = { 334, 326 }, -- JANEMBA
[135] = { 341, 482 }, -- JENK
[142] = { 348, 500 }, -- TURLES
[500] = { 600, 521 }, -- KING VEGETTA
[506] = { 607, 198 }, -- SHENRON
[512] = { 614, 422 }, -- VEGETTO
[518] = { 621, 506 }, -- KAGOME
[524] = { 628, 547 } -- TAPION
}


function addReset(cid)
resets = getResets(cid)
setPlayerStorageValue(cid, 378378, resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
local hp = getCreatureMaxHealth(cid)
local resethp = hp*(config.percent/100)
setCreatureMaxHealth(cid, resethp)
local differencehp = (hp - resethp)
doCreatureAddHealth(cid, -differencehp)
local mana = getCreatureMaxMana(cid)
local resetmana = mana*(config.percent/100)
setCreatureMaxMana(cid, resetmana)
local differencemana = (mana - resetmana)
doCreatureAddMana(cid, -differencemana)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
return TRUE
end

function getResets(cid)
resets = getPlayerStorageValue(cid, 378378)
if resets < 0 then
resets = 0
end
return resets
end

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if (not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

local newPrice = config.price + (getResets(cid) * config.priceByReset)
local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)

if getPlayerLevel(cid) >= 602 then
return doPlayerSendCancel(cid, "Você só pode rebornar level 601-.")
end

if msgcontains(msg, 'reborn') then
if getResets(cid) == resets then
selfSay('Você tem certeza ?', cid)
talkState[talkUser] = 1
else
selfSay('I couldnt acess your bank of acess!', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerMoney(cid) < newPrice then
selfSay('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
elseif getPlayerLevel(cid) < newminlevel then
selfSay('The minimum level for reseting is '..newminlevel..'!', cid)
else
local voc = cfg[getPlayerVocation(cid)]
if voc then
doPlayerSetVocation(cid, voc[1])
local outfit = {lookType = voc[2]}
doCreatureChangeOutfit(cid, outfit)
doPlayerRemoveMoney(cid,newPrice)
playerid = getPlayerGUID(cid)
addEvent(addReset, (0.1*1000), cid)
local msg ="---[Reborn: Yes]-- You have Reborned! Você vai ser desconectado em 1 segundo."
if doPlayerPopupFYI(cid, msg) then
end
else
selfSay('Reverta as transformções !', cid)
end
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
talkState[talkUser] = 0
selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantity') then
selfSay('You have a total of '..getResets(cid)..' reset(s).', cid)
talkState[talkUser] = 0
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Expand   Mostrar mais  

Espero que alguém possa me ajudar, obrigado.

Editado por nettoferreira (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Meu Servidor Minecraft : Ip - Skylowcraft.minecraftbr.net:25585 = Servidor 24hrs Sem Lag , Sem Hackers (1.7.2) Servidor De Fullpvp e Survival - Vamos Colocar Minigames!.

Link para o post
Compartilhar em outros sites

doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")

 

Não precisa remover o player, pode usar assim:

doPlayerAddLevel(cid, -(getPlayerLevel(cid) - config.newlevel))
Link para o post
Compartilhar em outros sites

Obrigado mas, nenhuma das duas respostas pode me ajudar, o erro está persistindo, continua no nível 600 ao em vez de voltar ao nível 1. Segue Anexo de uma Print do Error:

post-71637-0-42234200-1429809312_thumb.p

Editado por nettoferreira (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

--[[Script made 100% by Nogard and Night Wolf.
You can feel free to edit anything you want, but don't remove the credits]]


local config = {
    minlevel = 250, --- level inical para resetar
    price = 0, --- preço inicial para resetar
    newlevel = 1, --- level após reset
    priceByReset = 0, --- preço acrescentado por reset
    percent = 99, ---- porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total)
    levelbyreset = 0 --- quanto de level vai precisar a mais no próximo reset
}
--- end config
local cfg = {
    --[vocation id] = {nova voc, looktype}
    [1] = { 201, 137 }, -- GOKU
    [10] = { 208, 148 }, -- GOHAN
    [18] = { 215, 144 }, -- GOTEN
    [24] = { 222, 152 }, -- VEGETA
    [33] = { 229, 150 }, -- TRUNKS
    [41] = { 236, 162 }, -- CHIBI TRUNKS
    [47] = { 243, 173 }, -- PICCOLO
    [53] = { 250, 221 }, -- DENDE
    [58] = { 257, 60 }, -- BARDOCK
    [65] = { 264, 84 }, -- BROOLY
    [71] = { 271, 178 }, -- TSUFUL
    [77] = { 278, 227 }, -- FREEZA
    [85] = { 285, 190 }, -- COOLER
    [92] = { 292, 15 }, -- ANDROID 17
    [98] = { 299, 15 }, -- ANDROID 18
    [104] = { 306, 34 }, -- BUU
    [111] = { 313, 118 }, -- CELL
    [117] = { 320, 341 }, -- SHIN
    [122] = { 327, 102 }, -- PAN
    [128] = { 334, 326 }, -- JANEMBA
    [135] = { 341, 482 }, -- JENK
    [142] = { 348, 500 }, -- TURLES
    [500] = { 600, 521 }, -- KING VEGETTA
    [506] = { 607, 198 }, -- SHENRON
    [512] = { 614, 422 }, -- VEGETTO
    [518] = { 621, 506 }, -- KAGOME
    [524] = { 628, 547 } -- TAPION
}

function getResets(cid)
    local resets = getPlayerStorageValue(cid, 378378)
    if resets < 0 then
        resets = 0
    end
    return resets
end

function addReset(cid)
    local resets = getResets(cid)
    setPlayerStorageValue(cid, 378378, resets+1)
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    local hp = getCreatureMaxHealth(cid)
    local resethp = hp*(config.percent/100)
    
    local resetlevel = level*(config.resets+1)
    setCreatureMaxHealth(cid, resethp)
    local differencehp = (hp - resethp)
    doCreatureAddHealth(cid, -differencehp)
    local mana = getCreatureMaxMana(cid)
    local resetmana = mana*(config.percent/100)
    setCreatureMaxMana(cid, resetmana)
    local differencemana = (mana - resetmana)
    doCreatureAddMana(cid, -differencemana)
    doPlayerAddLevel(cid, -(getPlayerLevel(cid) - config.newlevel))
    return true
end

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if (not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
    
    local newPrice = config.price + (getResets(cid) * config.priceByReset)
    local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)
    
    if getPlayerLevel(cid) >= 602 then
        return doPlayerSendCancel(cid, "Você só pode rebornar level 601-.")
    end
    
    if msgcontains(msg, 'reborn') then
        if getResets(cid) == resets then
            selfSay('Você tem certeza ?', cid)
            talkState[talkUser] = 1
        else
            selfSay('I couldnt acess your bank of acess!', cid)
        end
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        if getPlayerMoney(cid) < newPrice then
            selfSay('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
        elseif getPlayerLevel(cid) < newminlevel then
            selfSay('The minimum level for reseting is '..newminlevel..'!', cid)
        else
            local voc = cfg[getPlayerVocation(cid)]
            if voc then
                doPlayerSetVocation(cid, voc[1])
                local outfit = {lookType = voc[2]}
                doCreatureChangeOutfit(cid, outfit)
                doPlayerRemoveMoney(cid,newPrice)
                playerid = getPlayerGUID(cid)
                addEvent(addReset, (0.1*1000), cid)
                local msg ="---[Reborn: Yes]-- You have Reborned! Você vai ser desconectado em 1 segundo."
                if doPlayerPopupFYI(cid, msg) then
                end
            else
                selfSay('Reverta as transformções !', cid)
            end
        end
        talkState[talkUser] = 0
    elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
        talkState[talkUser] = 0
        selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantity') then
        selfSay('You have a total of '..getResets(cid)..' reset(s).', cid)
        talkState[talkUser] = 0
    end
    
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Link para o post
Compartilhar em outros sites

Ainda não funciona, o personagem é automaticamente Desconectado depois de rebornar e as Newtype's trocam mas o level não desce para o 1.

 

Se você achar que o erro está em outro lugar e querer a Script, pode pedir que eu posto aqui..

Editado por FaelJunior (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Ainda não funciona, o personagem é automaticamente Desconectado depois de rebornar e as Newtype's trocam mas o level não desce para o 1.

 

Se você achar que o erro está em outro lugar e querer a Script, pode pedir que eu posto aqui..

Link para o post
Compartilhar em outros sites

use o npc correto....

hahaha ninguém é pário para mim em wodbo  ;D

npc:

  Mostrar conteúdo oculto

local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)
end

function onCreatureAppear(creature)
end

function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('?????.')
focus = 0
talk_start = 0
end
end

function onCreatureTurn(creature)
end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello. If you ready I can "Reborn" you.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! Hey!.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'reborn') and getPlayerStorageValue(cid,30023) == 4 then
selfSay('Sorry, but you are after reborn.')
focus = 0
talk_start = 0
elseif msgcontains(msg, 'reborn') and getPlayerLevel(cid) < 250 and getPlayerStorageValue(cid,30023) ~= 4 then
selfSay('Hehe, I say If you READY. You do not have 250 lvl.')
elseif msgcontains(msg, 'reborn') then
selfSay('Are you sure?')
talk_state = 2
--_GOKU_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 1 then
doReborn(cid,1,152,109)
talk_state = 0
--_VEGETA_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 7 then
doReborn(cid,1,129,118)
talk_state = 0
--_GOHAN_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 13 then
doReborn(cid,1,147,127)
talk_state = 0
--_TRUNKS_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 19 then
doReborn(cid,1,131,136)
talk_state = 0
--_CELL_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 25 then
doReborn(cid,1,127,145)
talk_state = 0
--_FREEZA_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 31 then
doReborn(cid,1,9,154)
talk_state = 0
--_UUB_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 37 then
doReborn(cid,1,233,163)
talk_state = 0
--_C17_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 43 then
doReborn(cid,1,100,172)
talk_state = 0
--_C18_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 49 then
doReborn(cid,1,292,181)
talk_state = 0
--_PICOLLO_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 55 then
doReborn(cid,1,262,190)
talk_state = 0
--_DENDE_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 61 then
doReborn(cid,1,225,199)
talk_state = 0
--_TSUFUL_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 67 then
doReborn(cid,1,81,208)
talk_state = 0
--_BARDOCK_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 73 then
doReborn(cid,1,319,217)
talk_state = 0
--_BROLLY_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 79 then
doReborn(cid,1,263,226)
talk_state = 0
--_C16_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 85 then
doReborn(cid,1,301,235)
talk_state = 0
--_COOLER_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 91 then
doReborn(cid,1,242,244)
talk_state = 0
--_JANEMBA_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 97 then
doReborn(cid,1,551,253)
talk_state = 0
--_TAPION_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 103 then
doReborn(cid,1,577,262)
talk_state = 0

elseif msgcontains(msg, 'yes') and talk_state == 2 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert.')


elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye.')
focus = 0
talk_start = 0
end
end
end

function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 45 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end

agora abra data/lib

em 050-function.lua

adiciona essa linha

  Mostrar conteúdo oculto

function doReborn(cid, level, looktype, vocation)
setGlobalStorageValue(1000,getPlayerGUID(cid))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = " .. level .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `looktype` = " .. looktype .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `vocation` = " .. vocation .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
return TRUE
end

Se fizer tudo que nem eu falei vai funfar com certeza  ^^

Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais...

________________________________________________________________________________

Minhas Sprites:

  Mostrar conteúdo oculto

Mega Metagross

Mega Abomasnow

Pack de Shinys

[Posso atualizá-lo com novos shinys a qualquer momento]

Tutoriais:

  Mostrar conteúdo oculto

[Completo] Criando e adicionando um novo Pokémon

[Actions] Criando quest no RME

Editores Lua/Xml/Sync Entre outros:

Editores Win/Mac/Linux

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por L3K0T
      Bom, como todos sabem, existe o shop.lua em servidores 0.4 para receber itens. Muitos deles têm loops infinitos ou fazem uma varredura completa no banco de dados, o que pode deixá-los instáveis. Isso ocorre principalmente quando o script não verifica adequadamente se há itens para processar ou se o banco de dados está sobrecarregado com consultas desnecessárias.
      No entanto, com algumas melhorias, podemos otimizar esse processo, garantindo que o servidor se mantenha estável e eficiente. No nosso exemplo, aplicamos algumas mudanças importantes:
       

       
      Checagem eficiente de itens pendentes: A consulta ao banco de dados foi otimizada para verificar se existem realmente itens pendentes para o jogador. Se não houver itens, o script termina sua execução rapidamente, evitando sobrecarga.
      Evitar loops infinitos: O loop foi ajustado para garantir que, se não houver mais itens para processar, o script saia sem continuar verificando o banco de dados, prevenindo loops desnecessários.
      Logs: Foi adicionado um sistema de logs, onde cada transação bem sucedida do jogador é registrada com data e hora, além de informações sobre o jogador e os itens recebidos.
      Execução controlada com intervalos: Ao invés de fazer consultas contínuas ao banco de dados, o script executa checagens de tempos em tempos, configuráveis pelo parâmetro SQL_interval. Isso distribui as verificações ao longo do tempo e evita que o servidor fique sobrecarregado com solicitações simultâneas.
       
      Segue o scripts:
      data/globalevents/scripts/shop.lua
       
      function getCurrentDateTime() local currentDateTime = os.date("%Y-%m-%d %H:%M:%S") return currentDateTime end function createDirectoryIfNotExists(dir) local command = "mkdir -p " .. dir os.execute(command) end function saveLog(message) local logFilePath = "data/logs/shop/shop.txt" local logDir = "data/logs/shop/" createDirectoryIfNotExists(logDir) local currentDateTime = getCurrentDateTime() local logMessage = string.format("[%s] %s\n", currentDateTime, message) local file = io.open(logFilePath, "a") if file then file:write(logMessage) file:close() else print("Erro ao tentar escrever no arquivo de log.") end end SHOP_MSG_TYPE = 19 SQL_interval = 5 function onThink(interval, lastExecution) local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';") if result_plr:getID() == -1 then return true end local hasMoreItems = false while true do local id = tonumber(result_plr:getDataInt("id")) local cid = getCreatureByName(tostring(result_plr:getDataString("name"))) if isPlayer(cid) then hasMoreItems = true local itemtogive_id = tonumber(result_plr:getDataInt("param1")) local itemtogive_count = tonumber(result_plr:getDataInt("param2")) local add_item_name = tostring(result_plr:getDataString("param6")) local received_item = 0 local full_weight = 0 if isItemRune(itemtogive_id) then full_weight = getItemWeightById(itemtogive_id, 1) else full_weight = getItemWeightById(itemtogive_id, itemtogive_count) end local free_cap = getPlayerFreeCap(cid) if full_weight <= free_cap then local new_item = doCreateItemEx(itemtogive_id, itemtogive_count) received_item = doPlayerAddItemEx(cid, new_item) if received_item == RETURNVALUE_NOERROR then doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, string.format("Você recebeu >> %s << da loja.", add_item_name)) doPlayerSave(cid) db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";") db.executeQuery("UPDATE `z_shop_history` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";") saveLog(string.format("[%s] %s (ID: %d), Você recebeu >> %s << da loja.", getCurrentDateTime(), tostring(result_plr:getDataString("name")), id, add_item_name)) end else doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, string.format("Você não tem capacidade suficiente para >> %s <<. Necessário: %.2f oz. Disponível: %.2f oz.", add_item_name, full_weight, free_cap)) saveLog(string.format("[%s] %s (ID: %d), Tentou comprar >> %s <<, mas não tinha capacidade suficiente. Necessário: %.2f oz. Disponível: %.2f oz.", getCurrentDateTime(), tostring(result_plr:getDataString("name")), id, add_item_name, full_weight, free_cap)) end end if not result_plr:next() then break end end result_plr:free() if not hasMoreItems then return false end return true end  
      data/globalevents/globalevents.xml
       
      <globalevent name="shop" interval="30000" script="shop.lua"/>  
       
      *Testado em Myaac
      *Testado em OTX2 8.60
      *Testado em Ubuntu 20.04
      *Não precisa criar pasta, ele mesmo cria.
       
      Com essas melhorias, a performance do servidor foi significativamente melhorada, garantindo que o sistema de loja funcione de forma mais estável e eficiente, sem sobrecarregar o banco de dados ou causar lags. Agora, a transação de itens na loja ocorre de forma mais controlada e com menos chance de erros ou travamentos. by @L3K0T
       
    • Por Under
      Apresentando o Tibia-IA: A IA para Desenvolvimento de Servidores Tibia! 
       O que é o Tibia-IA?
      Um modelo de IA especializado para Tibia! Ele está atualmente em teste gratuito, e eu adoraria que vocês o experimentassem. Basta acessar https://ai.tibiaking.com, criar uma conta e começar a usar totalmente de graça! 
       Versão Experimental Fechada
      Atualmente, algumas funcionalidades ainda estão em desenvolvimento. No momento, apenas a geração de scripts está disponível para o público.
      Se encontrarem qualquer problema nos scripts gerados, me avisem! Vamos juntos construir a IA mais poderosa para ajudar no desenvolvimento de servidores Tibia!  
      Contato direto discord : underewar
       Acesse agora: https://ai.tibiaking.com
       Como funciona?
       Geração automática de scripts LUA para TFS  Suporte a diferentes eventos, criaturas, NPCs, magias, etc.  Ferramenta em constante evolução para aprimorar o desenvolvimento Novidades em breve confira no site. O acesso ao Tibia-IA está disponível para testes GRATUITOS! 
      Basta criar uma conta em: https://ai.tibiaking.com
      Utilize a IA para gerar seus scripts de forma simples e rápida
      Envie feedbacks para ajudarmos a tornar a ferramenta ainda melhor!

      Problemas relatar diretamente no meu discord pessoal : underewar
       
       
    • Por kean1337
      After a long break, DBAW returns with a new season! 
       
      This will be the edition with the biggest update since the server's launch! 
       
      What's new?
       
      -New planet Beerus
      -New transformation from level 1000
      -New specials for new transformation
      -Fusion moved from level 750 to 600
      -New items, tasks, missions
      -New Bosses with new mechanics
      -Accelerated gameplay 1-1000
      -Additional amenities in the early game
       
      And on top of that, the systems we already know from previous editions!
       
      -16 playable classes
      -special passives for every class
      -saga system (from DB to DBGT)
      -daily mission
      -raid system
      -dragon balls system
      -advanced task system
      -glyphs & enchants
      -easy/medium/hard/very hard/bonus quests
      -offline training
      -auto loot
      -auto senzu
      -toogle stamina system
      -DP stash systems
       
      We start on April 4, 2025!
      20:00 PL
      15:00 BR
       
      Website: http://dbaw.pl/
      Discord: https://discord.gg/dnwGsaXN
    • Por Veigh
      IP: HYPEOT.COM (Versão 8.60) Por que jogar no HYPEOT? Confira nossos diferenciais: Sistema de Reset 180+ Montarias 65+ Outfits Sistema de Stage Sistema de Pesca Sistema de Refinamento Sistema de Aura Sistema de Mineração Sistema de Woodcut Sistema de Dungeons Sistema de Survival Mais de 30 Bosses de Alavancas +10 Eventos Automáticos Mais de 5 anos online com apenas 2 resets. Agora estamos de volta com força total desde 05/12! O que você está esperando? Junte-se à aventura e faça parte dessa jornada épica! Conecte-se agora mesmo e não fique de fora!
    • Por Glacial
      Boa noite galera!
       
      Meu nome é Gustavo/Glacial, gostaria de compartilhar meu mapa projeto Old City (8.60)
       
      Espero que curtam e podem baixar pra colocar no ot de vocês!
       
      Atualização Old City (8.60) versão 1.0:
      - Depot + Templo + Lojas (NPCs a gosto) + Teleports (para customizar) tudo em uma mesma casa central.
      - Houses em volta da cidade.
      - 4 saídas N, S, L e Oeste.
      - Cidade estilizada com bancos, postes de luz, e bancos.

      Atualização Old City (8.60) versão 2.0:
      - 4 Novos Mapas de Hunt/Quest ao Norte (Montanhas) Sul (Jungle) Leste (Vulcão) e Oeste (Gelo) da Old City. 
       
      >>> Download Mapas: https://www.mediafire.com/folder/hz0q694t9nk86/Mapas_Glacial <<<
       
      Scan VirusTotal:

      Old City (8.60) versão 1.0 Virus Total: https://www.virustotal.com/gui/file/5c2988531c71e1ae7f363b1102c865cb9debe2fd7e5f1b09b7cd09d40c2bf517?nocache=1
      Old City (8.60) versão 2.0 Virus Total: https://www.virustotal.com/gui/file/a2caef91a130d0df62ae4e88fa0719c331a6bb1fbad66a72c08fc3cd362bf430?nocache=1
       
      - Mapas Anteriores:
      Glacial City (10.98) versão 1.0 Virus Total: https://www.virustotal.com/gui/file/b4e94903752e24aba63b291f9929f15f6bd7f4feb44d5a1f42ec3d755ee7977e?nocache=1
      Glacial City (10.98) versão 2.0 Virus Total: https://www.virustotal.com/gui/file/d88ae087e966bed6e2f2348f31246c1858831c1fb13d4e8613ba98f6ede37503?nocache=1
       





       
       
       
  • Estatísticas dos Fóruns

    96831
    Tópicos
    519565
    Posts
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo