Ir para conteúdo

Featured Replies

Postado

Boa noite pessoal!

 

Estou com um problema e não consigo resolver porque não sou bom em scripts. É o seguinte.

 

Estou com o problema abaixo no meu zombie event.

 

QlKJnOog_.png

 

Ele abre e aparece o TP, porém, quando tenta entrar da esse erro. Segue meu zombie_teleport.lua

 

dofile('data/zombie_system.lua')
 
function onStepIn(cid, item, position, fromPosition)
        local player = Player(cid)
    if not player then
            return false
        end
  
        if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has already started.')
            player:teleportTo(fromPosition, true)
            return false
        end
  
        if Game.getStorageValue(zeStartedGlobalStorage) == 0 then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has not started yet.')
            player:teleportTo(fromPosition, true)
            return false
        end
  
       if Game.getStorageValue(zeJoinedCountGlobalStorage) > zeMaxPlayers then
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event is already full! ['.. Game.getStorageValue(zeJoinedCountGlobalStorage) ..'/'.. zeMaxPlayers ..']')
            return false
        end
  
        player:teleportTo(zeWaitingRoomPos)
        Game.setStorageValue(zeJoinedCountGlobalStorage, Game.getStorageValue(zeJoinedCountGlobalStorage) + 1)
        broadcastMessage(string.format('%s has joined the Zombie Event! [%s/'.. zeMaxPlayers ..'].', player:getName(), Game.getStorageValue(zeJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)
        player:setStorageValue(zeJoinStorage, 1)
        return true
end

 
Ao Passar o tempo e o evento não abrir por falta de players, da o seguinte erro
 
ONKcbwE7x.png
 
Segue meu Zombie_system.lua
 

-- Zombie Variables
zeZombieName = 'Zombie Event' --Zombie Name
zombieSpawnInterval = 5 --how many seconds until a new zombie spawns
zeMaxZombies = 30 --max zombies in the arena?
zeJoinedCountGlobalStorage = 100 --Player joined event count
 
-- Players Variables
zeJoinStorage = 1000 --player join storage
zeMinPlayers = 10 --min players needed when time runout
zeMaxPlayers = 30 --max players to join
zeTrophy = 7369 --trophy itemid
zeJoinedCountGlobalStorage = 101 --Zombie spawned Count
 
-- Other Variables
zeWaitMinutes = 2 --when event has opened, how long until it starts?
zeWaitingRoomPos = Position(32306, 31926, 7) --middle of waiting room
zeZombieArena = Position(32360, 31922, 7) --when even start where should player be teleported in the zombie arena?
zeArenaFromPosition = Position(32338, 31913, 7) --pos of top left corner
zeArenaToPosition = Position(32385, 31934, 7) --pos of bottom right corner
zeMiddleZombieArena = Position(32360, 31924, 7) --Middle pos of the arena
zeWaitingRoomRadiusX = 20 --depends how big the waiting room is 20sqm to x
zeWaitingRoomRadiusY = 20 --depends how big the waiting room is 20sqm to y
zeZombieArenaRadiusX = 20 --Depends how big the zombie arena is 50sqm to x
zeZombieArenaRadiusY = 20 --Depends how big the zombie arena is 50sqm to y
zeStartedGlobalStorage = 102 -- Value: 0 == false, 1 == true, 2 == started --State of the event
zeCreateTeleportPosition = Position(32340, 32213, 7) --Where should the teleport be created?
 
function startZombie()
    local specs = Game.getSpectators(zeWaitingRoomPos, false, true, 0, zeWaitingRoomRadiusX, 0, zeWaitingRoomRadiusY)
        if Game.getStorageValue(zeJoinedCountGlobalStorage) < zeMinPlayers then
            for i = 1, #specs do
                    specs:teleportTo(specs:getTown():getTemplePosition(), false)
                    specs:setStorageValue(zeJoinStorage, 0)
            end
            resetVariables()
            broadcastMessage('Zombie Event failed to start, because of to little players joined the event!', MESSAGE_STATUS_WARNING)
            return true
        end
 
        for i = 1, #specs do
            specs:teleportTo(zeZombieArena)
        end
        broadcastMessage("Zombie Event has started, good luck to all participant.", MESSAGE_STATUS_WARNING)
        Game.setStorageValue(zeStartedGlobalStorage, 2)
        doStartZombieEvasion()
end
 
function doSummonZombie()
        if Game.getStorageValue(zeZombieCountGlobalStorage) > zeMaxZombies then
            return false
        end
 
        local zombie = Game.createMonster(zeZombieName, {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)})
        if zombie then
            Game.createMonster(zeZombieName, {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)})
        end
        Game.setStorageValue(zeZombieCountGlobalStorage, Game.getStorageValue(zeZombieCountGlobalStorage) + 1)
end
 
function doStartZombieEvasion()
        if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
               doSummonZombie()
            addEvent(doStartZombieEvasion, 5 * 1000)
        end
end
 
function resetVariables()
        Game.setStorageValue(zeJoinedCountGlobalStorage, 0)
        Game.setStorageValue(zeZombieCountGlobalStorage, 0)
        Game.setStorageValue(zeStartedGlobalStorage, 0)
end
 
function doClearZombieArena()
        local specs = Game.getSpectators(zeMiddleZombieArena, false, false, 0, zeZombieArenaRadiusX, 0, zeZombieArenaRadiusY)
        for i = 1, #specs do
            if specs:getName() == zeZombieName then
                    specs:remove()
            end
        end
end

 
Me ajudem por favooooor!

 

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