• 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 gets overloaded

haxborn

server dominando, cry is free
Joined
Dec 1, 2011
Messages
126
Reaction score
7
Location
Sweden
I've got a problem, I will rep the one that helps me.

btw I'm using this script: http://otland.net/f82/zombie-event-new-version-bug-free-updated-128664/

I use the auto start event that's posted later in the thread and it works perfectly, it starts every hour etc and the event works fine.
BUT if the events start, they ask for players, and if no one joins, the event starts anyway and starts to summon zombies.
Eventually the map is full with zombies and there is no more space for zombies to spawn. The server starts giving errors that
it can't summon more zombies. Later on the server crashes. How can I fix it to NOT start if no players join? I'm using the script
exactly as it's written in the guide and also uses the autostart that he posted later in the thread.

Thank you in advance
Hax~
 
If you read the post again you can see that I'm saying "btw I'm using this script: Zombie event - NEW version, bug free, updated" and it's a link the the exact script I'm using. Also that I use the auto function thats posted later on the thread.
The server version I use is TFS 0.3.7.
 
How can the event start if not enought players are there. It only spawns if the event started and that happens if enough players joined.

Which auto function do you use?
I wont click through 18 pages.
 
If you go to Page 6 you see that the author responds with an auto start script. I dont know how to link to an specific post. Thanks for . When using the auto script you have some minutes to enter then eventually the monsters spawns anyway because the arena was crowded with zombies and no player were there. I would need something that shuts down the event if nobody joins or if its easier it could be a timer so if no one wins in 5 or 10 min it shuts down. I would really appriciate your help.

- - - Updated - - -

Can anyone please help me? It shouldn't be so hard :(
just use the "event stopped" part from this script:
http://otland.net/f163/zombie-event-without-bugs-work-all-forgotten-server-144357/
I would do it myself if I could, I don't know all the small parts. v=getblabla end end andif.
 
Last edited:
LUA:
function onThink(interval, lastExecution, thinkInterval)
	if(getStorage(ZE_STATUS) ~= 2) then
		if(getStorage(45267)+autoStartInterval*60 <= os.time() and getStorage(45268) ~= 1) then
			doSetStorage(45268, 1)
			removeZombiesEventBlockEnterPosition()
			doSetStorage(ZE_STATUS, 1)
			doBroadcastMessage("Zombie Arena Event teleport will be opened for 2 minutes. The reward for winning is 100k, don't get hit by the zombies to win. We are waiting for " .. getZombiesEventPlayersLimit() - #getZombiesEventPlayers() .. " players to start.")
		elseif(getStorage(45267)+autoStartInterval*60+120 <= os.time() and getStorage(45268) == 1) then
			local count = 0
			for _, v in ipairs(getZombiesEventPlayers()) do
				count += 1
			end
			if count > 1 then
				addZombiesEventBlockEnterPosition()
				doSetStorage(45268, 0)
				doSetStorage(ZE_STATUS, 2)
				doSetStorage(45267, os.time())
				doBroadcastMessage("Zombie Arena Event started.")
			else
				doBroadcastMessage("To few participants on zombie even for it to start.")
			end
		end
	end
	return true
end
 
LUA:
function onThink(interval, lastExecution, thinkInterval)
    if(getStorage(ZE_STATUS) ~= 2) then
        if(getStorage(45267)+autoStartInterval*60 <= os.time() and getStorage(45268) ~= 1) then
            doSetStorage(45268, 1)
            removeZombiesEventBlockEnterPosition()
            doSetStorage(ZE_STATUS, 1)
            doBroadcastMessage("Zombie Arena Event teleport will be opened for 2 minutes. The reward for winning is 100k, don't get hit by the zombies to win. We are waiting for " .. getZombiesEventPlayersLimit() - #getZombiesEventPlayers() .. " players to start.")
        elseif(getStorage(45267)+autoStartInterval*60+120 <= os.time() and getStorage(45268) == 1) then
            local count = 0
            for _, v in ipairs(getZombiesEventPlayers()) do
                count += 1
            end
            if count > 1 then
                addZombiesEventBlockEnterPosition()
                doSetStorage(45268, 0)
                doSetStorage(ZE_STATUS, 2)
                doSetStorage(45267, os.time())
                doBroadcastMessage("Zombie Arena Event started.")
            else
                doBroadcastMessage("To few participants on zombie even for it to start.")
            end
        end
    end
    return true
end

i have the same error, where i put the time of zombie? im trying your code right now if ucan help me
 
Try this script insted, http://otland.net/threads/zombie-event-new-version-bug-free-updated.128664/
Auto: http://otland.net/threads/zombie-event-new-version-bug-free-updated.128664/page-3#post-1253789

This system is written by Gesior and not by some random.

0.4, needs tho a modification to the lib file:
Code:
function setZombiesEventPlayersLimit(value)
    doSetStorage(ZE_PLAYERS_NUMBER, value)
end

function getZombiesEventPlayersLimit()
    return getStorage(ZE_PLAYERS_NUMBER)
end

function addPlayerToZombiesArea(cid)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    doTeleportThing(cid, ZE_enterPosition, true)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    if(getPlayerAccess(cid) < ZE_ACCESS_TO_IGNORE_ARENA) then
        setPlayerZombiesEventStatus(cid, os.time())
    end
end

function kickPlayerFromZombiesArea(cid)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    doTeleportThing(cid, ZE_kickPosition, true)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    setPlayerZombiesEventStatus(cid, 0)
end

function getPlayerZombiesEventStatus(cid)
    return getCreatureStorage(cid, ZE_isOnZombieArea)
end

function setPlayerZombiesEventStatus(cid, value)
    doCreatureSetStorage(cid, ZE_isOnZombieArea, value)
end

function getZombiesEventPlayers()
    local players = {}
    for i, cid in pairs(getPlayersOnline()) do
        if(getPlayerZombiesEventStatus(cid) > 0) then
            table.insert(players, cid)
        end
    end
return players
end

function getZombiesCount()
    return getStorage(ZE_ZOMBIES_SPAWNED)
end

function addZombiesCount()
    doSetStorage(ZE_ZOMBIES_SPAWNED, getStorage(ZE_ZOMBIES_SPAWNED)+1)
end

function resetZombiesCount()
    doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
end

function getZombiesToSpawnCount()
    return getStorage(ZE_ZOMBIES_TO_SPAWN)
end

function setZombiesToSpawnCount(count)
    doSetStorage(ZE_ZOMBIES_TO_SPAWN, count)
end

function addZombiesEventBlockEnterPosition()
    if(getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID).uid == 0) then
        doCreateItem(ZE_blockEnterItemID, 1, ZE_blockEnterItemPosition)
    end
end

function removeZombiesEventBlockEnterPosition()
    local item = getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID)
    if(item.uid ~= 0) then
        doRemoveItem(item.uid)
    end
end

function spawnNewZombie()
    local posx = {}
    local posy = {}
    local posz = {}
    local pir = {}
    for i=1, 5 do
        local posx_tmp = math.random(ZE_spawnFromPosition.x ,ZE_spawnToPosition.x)
        local posy_tmp = math.random(ZE_spawnFromPosition.y ,ZE_spawnToPosition.y)
        local posz_tmp = math.random(ZE_spawnFromPosition.z ,ZE_spawnToPosition.z)
        local pir_tmp = 0
        local spec = getSpectators({x=posx_tmp, y=posy_tmp, z=posz_tmp}, 3, 3, false)
        if(spec and #spec > 0) then
            for z, pid in pairs(spec) do
                if(isPlayer(pid)) then
                    pir_tmp = pir_tmp + 1
                end
            end
        end
        posx[i] = posx_tmp
        posy[i] = posy_tmp
        posz[i] = posz_tmp
        pir[i] = pir_tmp
    end
    local lowest_i = 1
    for i=2, 5 do
        if(pir[i] < pir[lowest_i]) then
            lowest_i = i
        end
    end
    local ret = (type(doCreateMonster('Zombie Event', {x=posx[lowest_i], y=posy[lowest_i], z=posz[lowest_i], stackpos = 253})) == 'number')
    if(ret) then
        addZombiesCount()
    end
    return ret
end
 
Try this script insted, http://otland.net/threads/zombie-event-new-version-bug-free-updated.128664/
Auto: http://otland.net/threads/zombie-event-new-version-bug-free-updated.128664/page-3#post-1253789

This system is written by Gesior and not by some random.

0.4, needs tho a modification to the lib file:
Code:
function setZombiesEventPlayersLimit(value)
    doSetStorage(ZE_PLAYERS_NUMBER, value)
end

function getZombiesEventPlayersLimit()
    return getStorage(ZE_PLAYERS_NUMBER)
end

function addPlayerToZombiesArea(cid)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    doTeleportThing(cid, ZE_enterPosition, true)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    if(getPlayerAccess(cid) < ZE_ACCESS_TO_IGNORE_ARENA) then
        setPlayerZombiesEventStatus(cid, os.time())
    end
end

function kickPlayerFromZombiesArea(cid)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    doTeleportThing(cid, ZE_kickPosition, true)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    setPlayerZombiesEventStatus(cid, 0)
end

function getPlayerZombiesEventStatus(cid)
    return getCreatureStorage(cid, ZE_isOnZombieArea)
end

function setPlayerZombiesEventStatus(cid, value)
    doCreatureSetStorage(cid, ZE_isOnZombieArea, value)
end

function getZombiesEventPlayers()
    local players = {}
    for i, cid in pairs(getPlayersOnline()) do
        if(getPlayerZombiesEventStatus(cid) > 0) then
            table.insert(players, cid)
        end
    end
return players
end

function getZombiesCount()
    return getStorage(ZE_ZOMBIES_SPAWNED)
end

function addZombiesCount()
    doSetStorage(ZE_ZOMBIES_SPAWNED, getStorage(ZE_ZOMBIES_SPAWNED)+1)
end

function resetZombiesCount()
    doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
end

function getZombiesToSpawnCount()
    return getStorage(ZE_ZOMBIES_TO_SPAWN)
end

function setZombiesToSpawnCount(count)
    doSetStorage(ZE_ZOMBIES_TO_SPAWN, count)
end

function addZombiesEventBlockEnterPosition()
    if(getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID).uid == 0) then
        doCreateItem(ZE_blockEnterItemID, 1, ZE_blockEnterItemPosition)
    end
end

function removeZombiesEventBlockEnterPosition()
    local item = getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID)
    if(item.uid ~= 0) then
        doRemoveItem(item.uid)
    end
end

function spawnNewZombie()
    local posx = {}
    local posy = {}
    local posz = {}
    local pir = {}
    for i=1, 5 do
        local posx_tmp = math.random(ZE_spawnFromPosition.x ,ZE_spawnToPosition.x)
        local posy_tmp = math.random(ZE_spawnFromPosition.y ,ZE_spawnToPosition.y)
        local posz_tmp = math.random(ZE_spawnFromPosition.z ,ZE_spawnToPosition.z)
        local pir_tmp = 0
        local spec = getSpectators({x=posx_tmp, y=posy_tmp, z=posz_tmp}, 3, 3, false)
        if(spec and #spec > 0) then
            for z, pid in pairs(spec) do
                if(isPlayer(pid)) then
                    pir_tmp = pir_tmp + 1
                end
            end
        end
        posx[i] = posx_tmp
        posy[i] = posy_tmp
        posz[i] = posz_tmp
        pir[i] = pir_tmp
    end
    local lowest_i = 1
    for i=2, 5 do
        if(pir[i] < pir[lowest_i]) then
            lowest_i = i
        end
    end
    local ret = (type(doCreateMonster('Zombie Event', {x=posx[lowest_i], y=posy[lowest_i], z=posz[lowest_i], stackpos = 253})) == 'number')
    if(ret) then
        addZombiesCount()
    end
    return ret
end

the auto start dont found good, see my other post ZOMBIE EVENT DUDE i post there the problem
 
Back
Top