Ir para conteúdo

Featured Replies

Postado
  • Autor
Em 03/09/2021 em 09:10, Vodkart disse:

abri meu servidor para testar e deu certo, a house foi dada ao jogador sem maiores problemas!!! ou a houses não estão configuradas de forma correta no mapa ou é a função da lib mesmo... qual servidor/distro vc usa?

consegui arruma ja ta transferindo a house só q agora tem outro problema, tipo ele remove a pedra e coloca escada mas queria q quando acabar o evento removia a escada e voltava para pedra

pedra.thumb.png.0973df155f266525a2922bcdf653b184.pngescada.thumb.png.05d39dfa85eb8176da06983cea50eec3.png

 

Spoiler

local THRONE_POS = {x = 2561, y = 2446, z = 5}
local STORAGE_EVENT = 83902
local STORAGE_PLAYER = 73289
local DUR = 15 -- in minutes
local days = {"Friday", "Saturday", "Thursday"} -- coloque os dias
function OpenEvent()    
    for _, tid in ipairs(getPlayersOnline()) do        
        setPlayerStorageValue(tid, STORAGE_PLAYER, 1)        
    end    
    setGlobalStorageValue(STORAGE_EVENT, 1)    
    doBroadcastMessage("O Evento castle foi aberto e vai durar ".. DUR .." minutos.", 25)    
end
function getWinnerCastle()    
    CastleWalls()    
    local player = getTopCreature(THRONE_POS).uid    
    if getGlobalStorageValue(STORAGE_EVENT) < 0 then        
        return true        
    end    
    if (isPlayer(player)) then        
        if (getPlayerStorageValue(player, STORAGE_PLAYER) > 0) then            
            local id, pid = 561, getPlayerGUID(player)        
            setHouseOwner(id, pid)    
            db.executeQuery("UPDATE `houses` SET `owner` = "..pid.." WHERE `id` = "..id)            
            doPlayerAddPremiumDays(player, 7)            
            for _, cid in ipairs(getPlayersOnline()) do                
                setPlayerStorageValue(cid, STORAGE_PLAYER, 0)                
                doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))                
            end            
            doBroadcastMessage(getCreatureName(player) .. " ganhou o evento.", 25)            
            doTeleportThing(player, {x = 2531, y = 2460, z = 7})            
            doCreateItem(391, 1, {x = 2561, y = 2446, z = 5})            
        end        
    else        
        doBroadcastMessage("Ningúem ganhou o evento.", 27)        
        for _, pid in ipairs(getPlayersOnline()) do            
            setPlayerStorageValue(pid, STORAGE_PLAYER, 0)            
            doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))            
        end        
    end    
    setGlobalStorageValue(STORAGE_EVENT, 0)    
    return db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. STORAGE_PLAYER)    
end
function isEventDay()
    for _, dia in pairs(days) do
        if dia == os.date("%A") then
            return true
        end
    end
    return false
end
function CastleWalls()
    local pedra = getTileItemById({ x = 2539, y = 2474, z = 7}, 1285)    
    local escada = getTileItemById({ x = 2525, y = 2471, z = 7}, 3687)    
    if pedra.uid > 0 then        
        return doRemoveItem(pedra.uid)        
    else        
        return doCreateItem(1285, 1, { x = 2539, y = 2474, z = 7})        
    end
    if escada.uid > 0 then        
        return doRemoveItem(escada.uid)        
    else        
        return doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})        
    end    
end
function onTimer()
    if isEventDay() then
        doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})
        OpenEvent()
        CastleWalls()
        addEvent(getWinnerCastle, DUR * 60 * 1000)
    end
    return true
end

 

Editado por Gatinha Pirada (veja o histórico de edições)

  • 3 months later...
  • Respostas 21
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • sim e era para remover, estranho hein... testa em outra house pra ver se passa, troca o id lá naquela linha o 223 por outra house só para testar local THRONE_POS = {x = 2561, y = 2446, z = 5} local

Posted Images

Postado
Em 04/09/2021 em 19:09, Gatinha Pirada disse:

consegui arruma ja ta transferindo a house só q agora tem outro problema, tipo ele remove a pedra e coloca escada mas queria q quando acabar o evento removia a escada e voltava para pedra

pedra.thumb.png.0973df155f266525a2922bcdf653b184.pngescada.thumb.png.05d39dfa85eb8176da06983cea50eec3.png

 

  Mostrar conteúdo oculto

local THRONE_POS = {x = 2561, y = 2446, z = 5}
local STORAGE_EVENT = 83902
local STORAGE_PLAYER = 73289
local DUR = 15 -- in minutes
local days = {"Friday", "Saturday", "Thursday"} -- coloque os dias
function OpenEvent()    
    for _, tid in ipairs(getPlayersOnline()) do        
        setPlayerStorageValue(tid, STORAGE_PLAYER, 1)        
    end    
    setGlobalStorageValue(STORAGE_EVENT, 1)    
    doBroadcastMessage("O Evento castle foi aberto e vai durar ".. DUR .." minutos.", 25)    
end
function getWinnerCastle()    
    CastleWalls()    
    local player = getTopCreature(THRONE_POS).uid    
    if getGlobalStorageValue(STORAGE_EVENT) < 0 then        
        return true        
    end    
    if (isPlayer(player)) then        
        if (getPlayerStorageValue(player, STORAGE_PLAYER) > 0) then            
            local id, pid = 561, getPlayerGUID(player)        
            setHouseOwner(id, pid)    
            db.executeQuery("UPDATE `houses` SET `owner` = "..pid.." WHERE `id` = "..id)            
            doPlayerAddPremiumDays(player, 7)            
            for _, cid in ipairs(getPlayersOnline()) do                
                setPlayerStorageValue(cid, STORAGE_PLAYER, 0)                
                doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))                
            end            
            doBroadcastMessage(getCreatureName(player) .. " ganhou o evento.", 25)            
            doTeleportThing(player, {x = 2531, y = 2460, z = 7})            
            doCreateItem(391, 1, {x = 2561, y = 2446, z = 5})            
        end        
    else        
        doBroadcastMessage("Ningúem ganhou o evento.", 27)        
        for _, pid in ipairs(getPlayersOnline()) do            
            setPlayerStorageValue(pid, STORAGE_PLAYER, 0)            
            doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))            
        end        
    end    
    setGlobalStorageValue(STORAGE_EVENT, 0)    
    return db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. STORAGE_PLAYER)    
end
function isEventDay()
    for _, dia in pairs(days) do
        if dia == os.date("%A") then
            return true
        end
    end
    return false
end
function CastleWalls()
    local pedra = getTileItemById({ x = 2539, y = 2474, z = 7}, 1285)    
    local escada = getTileItemById({ x = 2525, y = 2471, z = 7}, 3687)    
    if pedra.uid > 0 then        
        return doRemoveItem(pedra.uid)        
    else        
        return doCreateItem(1285, 1, { x = 2539, y = 2474, z = 7})        
    end
    if escada.uid > 0 then        
        return doRemoveItem(escada.uid)        
    else        
        return doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})        
    end    
end
function onTimer()
    if isEventDay() then
        doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})
        OpenEvent()
        CastleWalls()
        addEvent(getWinnerCastle, DUR * 60 * 1000)
    end
    return true
end

 

tem que colocar alguma action no trono? eu fiz aq abriu evento mas quando subo no trono n acontece nada... TfS 0.5

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo