Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

World of Shinobi Brasil

 

Está surgindo algum erro? Se sim coloque-o aqui. 

Quando dou use nas soldier pills (primeiro item), ele funciona normalmente, heala health e mana, mas só a primeira vez. depois aparece essa mensagem: e da um erro no console

Citar

image.png.a8032e0d49f933bb90587508292dfd2c.png

image.thumb.png.2782fa4d19e76c948743a246d86b627f.png

 

Você tem o código disponível? Se tiver publique-o aqui: 

exhaustion.lua:

exhaustion =
{
    check = function (cid, storage)
        if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
            return false
        end

        return getPlayerStorageValue(cid, storage) >= os.time(t)
    end,

    get = function (cid, storage)
        if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
            return false
        end

        local exhaust = getPlayerStorageValue(cid, storage)
        if(exhaust > 0) then
            local left = exhaust - os.time(t)
            if(left >= 0) then
                return left
            end
        end

        return false
    end,

    set = function (cid, storage, time)
        setPlayerStorageValue(cid, storage, os.time(t) + time)
    end,

    make = function (cid, storage, time)
        local exhaust = exhaustion.get(cid, storage)
        if(not exhaust) then
            exhaustion.set(cid, storage, time)
            return true
        end

        return false
    end
}

soldierpills.lua

local config = {
	lifeGain = 5.5,
	lifeGainMax = 8,
	manaGain = 5.5,
	manaGainMax = 8,
	exhaustionSeconds = 0.9,
	effectChar = 212,
	storageUse = 34538
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(exhaustion.check(cid, config.storageUse)) then
   if (exhaustion.get(cid, config.storageUse) >= 60) then
   doPlayerSendCancel(cid, "You are exhausted.") 
   end
    if (exhaustion.get(cid, config.storageUse) <= 60) then
    doPlayerSendCancel(cid, "You are exhausted.")
    end
return true
end
doRemoveItem(item.uid, 1) 
local health = getCreatureMaxHealth(cid) * (config.lifeGain/100)
local mana = getCreatureMaxMana(cid) * (config.manaGain/100)
local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100)
local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100)
doCreatureAddHealth(cid, math.random(health, healthmax))
doCreatureAddMana(cid, math.random(mana, manamax))
doSendMagicEffect(getPlayerPosition(cid), config.effectChar)
exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
return true
end

 

Dei uma lida aqui no forum, e tenho quase certeza que há um problema relacionado a o storage, que depois que o player usa a 1x fica setado lá e ele não consegue usar novamente.

Sou muito novo na area de programação e ot então não consigo resolver essa bronca solo. Desde já agradeço a ajuda.

 

image.png

Resolvido por L3K0T

Ir para solução
  • Respostas 15
  • Visualizações 458
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Posted Images

Postado

testa ae

Spoiler

local config = {
    lifeGain = 5.5,
    lifeGainMax = 8,
    manaGain = 5.5,
    manaGainMax = 8,
    exhaustionSeconds = 0.9,
    effectChar = 212,
    storageUse = 34538
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if exhaustion.check(cid, config.storageUse) == false then
        exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
    else
        return doPlayerSendCancel(cid, "Aguarde:  " ..exhaustion.get(cid, config.storageUse).." segundos para usar novamente.")
    end
doRemoveItem(item.uid, 1) 
local health = getCreatureMaxHealth(cid) * (config.lifeGain/100)
local mana = getCreatureMaxMana(cid) * (config.manaGain/100)
local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100)
local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100)
doCreatureAddHealth(cid, math.random(health, healthmax))
doCreatureAddMana(cid, math.random(mana, manamax))
doSendMagicEffect(getPlayerPosition(cid), config.effectChar)
return true
end

 

 

Host bom para hospedar seu jogo => https://shre.ink/OminiHost

 

Postado
  • Diretor
19 horas atrás, Marceneiro disse:

.Qual servidor ou website você utiliza como base? 

World of Shinobi Brasil

 

Está surgindo algum erro? Se sim coloque-o aqui. 

Quando dou use nas soldier pills (primeiro item), ele funciona normalmente, heala health e mana, mas só a primeira vez. depois aparece essa mensagem: e da um erro no console

 

Você tem o código disponível? Se tiver publique-o aqui: 

exhaustion.lua:


exhaustion =
{
    check = function (cid, storage)
        if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
            return false
        end

        return getPlayerStorageValue(cid, storage) >= os.time(t)
    end,

    get = function (cid, storage)
        if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
            return false
        end

        local exhaust = getPlayerStorageValue(cid, storage)
        if(exhaust > 0) then
            local left = exhaust - os.time(t)
            if(left >= 0) then
                return left
            end
        end

        return false
    end,

    set = function (cid, storage, time)
        setPlayerStorageValue(cid, storage, os.time(t) + time)
    end,

    make = function (cid, storage, time)
        local exhaust = exhaustion.get(cid, storage)
        if(not exhaust) then
            exhaustion.set(cid, storage, time)
            return true
        end

        return false
    end
}

soldierpills.lua


local config = {
	lifeGain = 5.5,
	lifeGainMax = 8,
	manaGain = 5.5,
	manaGainMax = 8,
	exhaustionSeconds = 0.9,
	effectChar = 212,
	storageUse = 34538
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(exhaustion.check(cid, config.storageUse)) then
   if (exhaustion.get(cid, config.storageUse) >= 60) then
   doPlayerSendCancel(cid, "You are exhausted.") 
   end
    if (exhaustion.get(cid, config.storageUse) <= 60) then
    doPlayerSendCancel(cid, "You are exhausted.")
    end
return true
end
doRemoveItem(item.uid, 1) 
local health = getCreatureMaxHealth(cid) * (config.lifeGain/100)
local mana = getCreatureMaxMana(cid) * (config.manaGain/100)
local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100)
local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100)
doCreatureAddHealth(cid, math.random(health, healthmax))
doCreatureAddMana(cid, math.random(mana, manamax))
doSendMagicEffect(getPlayerPosition(cid), config.effectChar)
exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
return true
end

 

Dei uma lida aqui no forum, e tenho quase certeza que há um problema relacionado a o storage, que depois que o player usa a 1x fica setado lá e ele não consegue usar novamente.

Sou muito novo na area de programação e ot então não consigo resolver essa bronca solo. Desde já agradeço a ajuda.

 

image.png

 

local config = {
    lifeGain = 5.5,
    lifeGainMax = 8,
    manaGain = 5.5,
    manaGainMax = 8,
    exhaustionSeconds = 0.9,
    effectChar = 212,
    storageUse = 34538
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if exhaustion.check(cid, config.storageUse) then
        local timeLeft = exhaustion.get(cid, config.storageUse)
        if timeLeft > 0 then
            doPlayerSendCancel(cid, "You are exhausted. You need to wait " .. timeLeft .. " seconds before using this item again.")
            return true
        end
    end
    
    doRemoveItem(item.uid, 1) 
    local health = getCreatureMaxHealth(cid) * (config.lifeGain/100)
    local mana = getCreatureMaxMana(cid) * (config.manaGain/100)
    local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100)
    local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100)
    doCreatureAddHealth(cid, math.random(health, healthmax))
    doCreatureAddMana(cid, math.random(mana, manamax))
    doSendMagicEffect(getPlayerPosition(cid), config.effectChar)
    exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
    return true
end
 

 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Postado
  • Autor
6 horas atrás, quemtuacha disse:

testa ae

  Ocultar conteúdo

local config = {
    lifeGain = 5.5,
    lifeGainMax = 8,
    manaGain = 5.5,
    manaGainMax = 8,
    exhaustionSeconds = 0.9,
    effectChar = 212,
    storageUse = 34538
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if exhaustion.check(cid, config.storageUse) == false then
        exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
    else
        return doPlayerSendCancel(cid, "Aguarde:  " ..exhaustion.get(cid, config.storageUse).." segundos para usar novamente.")
    end
doRemoveItem(item.uid, 1) 
local health = getCreatureMaxHealth(cid) * (config.lifeGain/100)
local mana = getCreatureMaxMana(cid) * (config.manaGain/100)
local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100)
local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100)
doCreatureAddHealth(cid, math.random(health, healthmax))
doCreatureAddMana(cid, math.random(mana, manamax))
doSendMagicEffect(getPlayerPosition(cid), config.effectChar)
return true
end

 

ainda não deu certo :/

1 hora atrás, L3K0T disse:

 

local config = {
    lifeGain = 5.5,
    lifeGainMax = 8,
    manaGain = 5.5,
    manaGainMax = 8,
    exhaustionSeconds = 0.9,
    effectChar = 212,
    storageUse = 34538
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if exhaustion.check(cid, config.storageUse) then
        local timeLeft = exhaustion.get(cid, config.storageUse)
        if timeLeft > 0 then
            doPlayerSendCancel(cid, "You are exhausted. You need to wait " .. timeLeft .. " seconds before using this item again.")
            return true
        end
    end
    
    doRemoveItem(item.uid, 1) 
    local health = getCreatureMaxHealth(cid) * (config.lifeGain/100)
    local mana = getCreatureMaxMana(cid) * (config.manaGain/100)
    local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100)
    local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100)
    doCreatureAddHealth(cid, math.random(health, healthmax))
    doCreatureAddMana(cid, math.random(mana, manamax))
    doSendMagicEffect(getPlayerPosition(cid), config.effectChar)
    exhaustion.set(cid, config.storageUse, config.exhaustionSeconds)
    return true
end
 

 

não deu certo, mas eu vi que se eu ir no sqlite e apagar o storage 34538 eu posso usar novamente mais 1x a pill, mas fica bugado novamente..

Postado
  • Diretor
39 minutos atrás, Marceneiro disse:

ainda não deu certo :/

não deu certo, mas eu vi que se eu ir no sqlite e apagar o storage 34538 eu posso usar novamente mais 1x a pill, mas fica bugado novamente..

Vc quer usar semprea cada certo tempo, agora entendi amigo

 

local config = {
    lifeGain = 5.5,
    lifeGainMax = 8,
    manaGain = 5.5,
    manaGainMax = 8,
    exhaustionSeconds = 0.9,
    effectChar = 212
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if exhaustion.check(cid, item.itemid) then
        local timeLeft = exhaustion.get(cid, item.itemid)
        if timeLeft > 0 then
            doPlayerSendCancel(cid, "You are exhausted. You need to wait " .. timeLeft .. " seconds before using this item again.")
            return true
        end
    end
    
    doRemoveItem(item.uid, 1) 
    local health = getCreatureMaxHealth(cid) * (config.lifeGain/100)
    local mana = getCreatureMaxMana(cid) * (config.manaGain/100)
    local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100)
    local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100)
    doCreatureAddHealth(cid, math.random(health, healthmax))
    doCreatureAddMana(cid, math.random(mana, manamax))
    doSendMagicEffect(getPlayerPosition(cid), config.effectChar)
    exhaustion.set(cid, item.itemid, config.exhaustionSeconds)
    return true
end
 

 

 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

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

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo