Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado
  • Diretor

123 é  a storage que o player deverá ter

 

local storageValue = 123 -- Valor da storage específica que indica se o efeito deve ser ativado ou não

function ariseText(cid)
    if not isPlayer(cid) then -- Verifica se o jogador ainda é válido
        return true
    end
    
    local texts = {"' .    ,", ".    ' ,", "'  .  ,", ",    ' ."}
    
    if getPlayerStorageValue(cid, storageValue) > 0 then
        doSendAnimatedText(getCreaturePosition(cid), texts[math.random(1, #texts)], math.random(1, 255))
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) -- Efeito mágico adicionado
    end
    
    addEvent(ariseText, 1000, cid)
    
    return true
end

function onLogin(cid)
    if getPlayerStorageValue(cid, storageValue) > 0 then
        ariseText(cid)
    end
    
    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

 

  • Respostas 14
  • Visualizações 457
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Seria tipo isso?   data > creaturescripts > creaturescripts.xml   <event type="login" name="playerTextEffect" event="script" value="playerTextEffect.lua"/>    

Postado
  • Autor
18 minutos atrás, L3K0T disse:

123 é  a storage que o player deverá ter

 

local storageValue = 123 -- Valor da storage específica que indica se o efeito deve ser ativado ou não

function ariseText(cid)
    if not isPlayer(cid) then -- Verifica se o jogador ainda é válido
        return true
    end
    
    local texts = {"' .    ,", ".    ' ,", "'  .  ,", ",    ' ."}
    
    if getPlayerStorageValue(cid, storageValue) > 0 then
        doSendAnimatedText(getCreaturePosition(cid), texts[math.random(1, #texts)], math.random(1, 255))
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) -- Efeito mágico adicionado
    end
    
    addEvent(ariseText, 1000, cid)
    
    return true
end

function onLogin(cid)
    if getPlayerStorageValue(cid, storageValue) > 0 then
        ariseText(cid)
    end
    
    return true
end
 

Amigo, ele ta funciondo e nao deu error no console, o problema é,q quando acabar a storage o efeito nao sai.

Postado
  • Diretor

Duração de 10 minutos pode alterar o tempo, ao acabar o tempo o efeito para de sair e o player perde a storage, ela só poderá ser ganha novamente com algum sistema que vc deve ta fazebdo.

 

 

 

local storageValue = 123 -- Valor da storage específica que indica se o efeito deve ser ativado ou não
local effectDuration = 10 * 60 -- Duração do efeito em segundos (10 minutos)

function ariseText(cid)
    if not isPlayer(cid) then -- Verifica se o jogador ainda é válido
        return true
    end
    
    local texts = {"' .    ,", ".    ' ,", "'  .  ,", ",    ' ."}
    local storageEnd = getPlayerStorageValue(cid, storageValue)
    
    if storageEnd > os.time() then
        doSendAnimatedText(getCreaturePosition(cid), texts[math.random(1, #texts)], math.random(1, 255))
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) -- Efeito mágico adicionado
        addEvent(ariseText, 1000, cid)
    else
        setPlayerStorageValue(cid, storageValue, 0) -- Remove a storage quando o efeito expirar
    end
    
    return true
end

function onLogin(cid)
    local storageEnd = getPlayerStorageValue(cid, storageValue)
    
    if storageEnd > os.time() then
        ariseText(cid)
    else
        setPlayerStorageValue(cid, storageValue, os.time() + effectDuration) -- Define o tempo de término do efeito
        ariseText(cid)
    end
    
    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, L3K0T disse:

Duração de 10 minutos pode alterar o tempo, ao acabar o tempo o efeito para de sair e o player perde a storage, ela só poderá ser ganha novamente com algum sistema que vc deve ta fazebdo.

 

 

 

local storageValue = 123 -- Valor da storage específica que indica se o efeito deve ser ativado ou não
local effectDuration = 10 * 60 -- Duração do efeito em segundos (10 minutos)

function ariseText(cid)
    if not isPlayer(cid) then -- Verifica se o jogador ainda é válido
        return true
    end
    
    local texts = {"' .    ,", ".    ' ,", "'  .  ,", ",    ' ."}
    local storageEnd = getPlayerStorageValue(cid, storageValue)
    
    if storageEnd > os.time() then
        doSendAnimatedText(getCreaturePosition(cid), texts[math.random(1, #texts)], math.random(1, 255))
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) -- Efeito mágico adicionado
        addEvent(ariseText, 1000, cid)
    else
        setPlayerStorageValue(cid, storageValue, 0) -- Remove a storage quando o efeito expirar
    end
    
    return true
end

function onLogin(cid)
    local storageEnd = getPlayerStorageValue(cid, storageValue)
    
    if storageEnd > os.time() then
        ariseText(cid)
    else
        setPlayerStorageValue(cid, storageValue, os.time() + effectDuration) -- Define o tempo de término do efeito
        ariseText(cid)
    end
    
    return true
end
 

local effectDuration = 10 * 60 -- Duração do efeito em segundos (10 minutos)

tem q funcionar sem tempo irmao, quando o player tiver a storage ele vai ganhar e o efeito TEXT, ai quando ele nao tiver mais o o storage nao vai sair mais o efeito TEXT

Postado
  • Diretor

local storageValue = 123 -- Valor da storage específica que indica se o efeito deve ser ativado ou não

function ariseText(cid)
    if not isPlayer(cid) then -- Verifica se o jogador ainda é válido
        return true
    end
    
    local texts = {"' .    ,", ".    ' ,", "'  .  ,", ",    ' ."}
    local storage = getPlayerStorageValue(cid, storageValue)
    
    if storage > 1 then
        doSendAnimatedText(getCreaturePosition(cid), texts[math.random(1, #texts)], math.random(1, 255))
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) -- Efeito mágico adicionado
        addEvent(ariseText, 1000, cid)
    end
    
    return true
end

function onLogin(cid)
    local storage = getPlayerStorageValue(cid, storageValue)
    
    if storage > 1 then
        ariseText(cid)
    else
        setPlayerStorageValue(cid, storageValue, 0) -- Remove a storage quando o efeito expirar
    end
    
    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.6k

Informação Importante

Confirmação de Termo