• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

zombie event problem

Sir Islam

Never Give Up
Joined
Jun 6, 2008
Messages
504
Solutions
1
Reaction score
116
Location
Suez , Egypt
i have problem in zombie event


Code:
00:44 Strom entered the Zombie event! Currently 1 players have joined!
00:44 Moon entered the Zombie event! Currently 2 players have joined!
00:45 Good luck in the zombie event people! The teleport has closed!
00:45 The first zombie will spawn in 8 seconds! Good luck!
00:46 A zombie has spawned! There is currently 1 zombies in the zombie event!
00:46 Moon have been eated by Zombies!
00:46 Strom won the Zombie event! Congratulations!
00:46 A zombie has spawned! There is currently 2 zombies in the zombie event!
00:46 A zombie has spawned! There is currently 3 zombies in the zombie event!
00:46 A zombie has spawned! There is currently 4 zombies in the zombie event!
00:46 A zombie has spawned! There is currently 5 zombies in the zombie event!
00:46 A zombie has spawned! There is currently 6 zombies in the zombie event!
00:46 A zombie has spawned! There is currently 7 zombies in the zombie event!
00:47 A zombie has spawned! There is currently 8 zombies in the zombie event!
00:47 A zombie has spawned! There is currently 9 zombies in the zombie event!
00:47 A zombie has spawned! There is currently 11 zombies in the zombie event!
00:47 A zombie has spawned! There is currently 12 zombies in the zombie event!
00:47 A zombie has spawned! There is currently 13 zombies in the zombie event!
00:47 A zombie has spawned! There is currently 14 zombies in the zombie event!
00:47 A zombie has spawned! There is currently 15 zombies in the zombie event!
00:48 A zombie has spawned! There is currently 16 zombies in the zombie event!
00:48 A zombie has spawned! There is currently 17 zombies in the zombie event!
00:48 A zombie has spawned! There is currently 18 zombies in the zombie event!
00:48 A zombie has spawned! There is currently 19 zombies in the zombie event!
00:48 A zombie has spawned! There is currently 20 zombies in the zombie event!
00:48 A zombie has spawned! There is currently 21 zombies in the zombie event!
00:48 A zombie has spawned! There is currently 22 zombies in the zombie event!
00:49 A zombie has spawned! There is currently 23 zombies in the zombie event!
00:49 A zombie has spawned! There is currently 24 zombies in the zombie event!
00:49 A zombie has spawned! There is currently 25 zombies in the zombie event!
00:49 A zombie has spawned! There is currently 26 zombies in the zombie event!
00:49 A zombie has spawned! There is currently 27 zombies in the zombie event!
00:49 A zombie has spawned! There is currently 28 zombies in the zombie event!

when any one win this event

spawned no stop
 
Try:

Lua:
local config = {
    playerCount = 2001, -- Global storage for counting the players left/entered in the event
    zombieCount = 2002, -- Global storage for counting the zombies in the event
    teleportActionId = 20000, -- Action id of the teleport needed for the movement script
    teleportPosition = {x = 1995, y = 1990, z = 15, stackpos = 1}, -- Where the teleport will be created
    teleportToPosition = {x = 1636, y = 1960, z = 7}, -- Where the teleport will take you
 
    teleportId = 1387, -- Id of the teleport
    timeToStartEvent = 2, -- Minutes, after these minutes the teleport will be removed and the event will be declared started
    timeBetweenSpawns = 8, -- Seconds between each spawn of zombie
    zombieName = "zombie", -- Name of the zombie that should be summoned
    playersNeededToStartEvent = 2, -- Players needed before the zombies can spawn.
 
    -- Should be the same as in the creaturescript!
    -- The zombies will spawn randomly inside this area
    fromPosition = {x = 1612, y =1947, z = 7}, -- top left cornor of the playground
    toPosition = {x = 1663, y = 1974, z = 7}, -- bottom right cornor of the playground
    }
 
function onThink(interval, lastExecution)
    local tp = doCreateTeleport(config.teleportId, config.teleportToPosition, config.teleportPosition)
    doItemSetAttribute(tp, "aid", config.teleportActionId)
    doBroadcastMessage("Zombie event starting in " .. config.timeToStartEvent .. " minutes! The teleport will be closed when the event start!", MESSAGE_FIRST)
    setGlobalStorageValue(config.playerCount, 0)
    setGlobalStorageValue(config.zombieCount, 0)
    addEvent(startEvent, config.timeToStartEvent * 1000 * 60)
    print(getGlobalStorageValue(2001))
    return true
end
 
function startEvent()
    local get = getThingfromPos(config.teleportPosition)
    if get.itemid == config.teleportId then
        doRemoveItem(get.uid, 1)
    end
 
    local fromp, top = config.fromPosition, config.toPosition
 
    if getGlobalStorageValue(config.playerCount) >= config.playersNeededToStartEvent then
        addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
        doBroadcastMessage("Good luck in the zombie event people! The teleport has closed!", MESSAGE_FIRST)
 
        for x = fromp.x, top.x do
            for y = fromp.y, top.y do
                for z = fromp.z, top.z do
                    areapos = {x = x, y = y, z = z, stackpos = 253}
                    getPlayers = getThingfromPos(areapos)
                    if isPlayer(getPlayers.uid) then
                          doPlayerSendTextMessage(getPlayers.uid, MESSAGE_EVENT_ADVANCE, "The first zombie will spawn in " .. config.timeBetweenSpawns .. " seconds! Good luck!")
                    end
                end
            end
        end
    else
        doBroadcastMessage("The Zombie event could not start because of to few players participating.\n At least " .. config.playersNeededToStartEvent .. " players is needed!", MESSAGE_FIRST)
        for x = fromp.x, top.x do
            for y = fromp.y, top.y do
                for z = fromp.z, top.z do
                    areapos = {x = x, y = y, z = z, stackpos = 253}
                    getPlayers = getThingfromPos(areapos)
                    if isPlayer(getPlayers.uid) then
                        doTeleportThing(getPlayers.uid, getTownTemplePosition(getPlayerTown(getPlayers.uid)))
                        doSendMagicEffect(getPlayerPosition(getPlayers.uid), CONST_ME_TELEPORT)
                    end
                end
            end
        end
    end
    return true
end
 
function spawnZombie()
    if getGlobalStorageValue(config.playerCount) >= 1 then
        pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
        doSummonCreature(config.zombieName, pos)
        doSendMagicEffect(pos, CONST_ME_MORTAREA)
        setGlobalStorageValue(config.zombieCount, getGlobalStorageValue(config.zombieCount)+1)
        doBroadcastMessage("A zombie has spawned! There is currently " .. getGlobalStorageValue(config.zombieCount) .. " zombies in the zombie event!", MESSAGE_FIRST)
        addEvent(spawnZombie, config.timeBetweenSpawns * 1000)
    end
return true
end
 
Back
Top