• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Linux Zombie Event bug! -_-

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
Hi guys,

I'm trying to run this event but im not succeeding!

Code:
[Error - GlobalEvent Interface]
data/globalevents/scripts/zombie/onthink.lua:onThink
Description:
data/lib/zombie_event.lua:123: attempt to index local 'pir' (a number value)
stack traceback:
        data/lib/zombie_event.lua:123: in function 'spawnNewZombie'
        data/globalevents/scripts/zombie/onthink.lua:6: in function <data/globalevents/scripts/zombie/onthink.lua:1>
[Error - GlobalEvents::think] Couldn't execute event: ZombieGlobalThink

That is my lib:
Code:
-- CONFIG
ZE_DEFAULT_NUMBER_OF_PLAYERS = 2
ZE_ACCESS_TO_IGNORE_ARENA = 3
-- POSITIONS
ZE_blockEnterItemPosition = {x= 1256, y=1299, z=7}
ZE_enterPosition = {x = 1256, y = 1296, z = 7}
ZE_kickPosition = {x=1066, y=1062, z=7}
ZE_spawnFromPosition = {x = 1238, y = 1275, z = 7}
ZE_spawnToPosition = {x = 1271, y = 1296, z = 7}
-- ITEM IDS
ZE_blockEnterItemID = 1777
-- STORAGES
-- - player
ZE_isOnZombieArea = 39970
-- - global
ZE_STATUS = 39970 -- =< 0 - off, 1 - waiting for players, 2 - is running
ZE_PLAYERS_NUMBER = 39971
ZE_ZOMBIES_TO_SPAWN = 39972
ZE_ZOMBIES_SPAWNED = 39973

-- FUNCTION

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 = posx_tmp
posy = posy_tmp
posz = posz_tmp
pir = pir_tmp
end
local lowest_i = 1
for i=2, 5 do
if(pir < 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]}, false)) == 'number')
if(ret) then
addZombiesCount()
end
return ret
end

Im using this: http://otland.net/threads/zombie-event-new-version-bug-free-updated.128664/

Thanks!
 
TRY
Code:
--CONFIG
ZE_DEFAULT_NUMBER_OF_PLAYERS = 3
ZE_ACCESS_TO_IGNORE_ARENA = 8
-- POSITIONS
ZE_blockEnterItemPosition = {x = 1187, y = 1373, z = 7}
ZE_enterPosition = {x = 1188, y = 1373, z = 7}
ZE_kickPosition = {x=1000, y=999, z=7}
ZE_spawnFromPosition = {x = 339, y = 376, z = 7}
ZE_spawnToPosition = {x = 368, y = 401, z = 7}
-- ITEM IDS
ZE_blockEnterItemID = 2700
-- STORAGES
-- - player
ZE_isOnZombieArea = 34370
-- - global
ZE_STATUS = 34370 -- =< 0 - off, 1 - waiting for players, 2 - is running
ZE_PLAYERS_NUMBER = 34371
ZE_ZOMBIES_TO_SPAWN = 34372
ZE_ZOMBIES_SPAWNED = 34373
-- FUNCTION
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]}, false)) == 'number')
if(ret) then
  addZombiesCount()
end
return ret
end
 
TRY
Code:
--CONFIG
ZE_DEFAULT_NUMBER_OF_PLAYERS = 3
ZE_ACCESS_TO_IGNORE_ARENA = 8
-- POSITIONS
ZE_blockEnterItemPosition = {x = 1187, y = 1373, z = 7}
ZE_enterPosition = {x = 1188, y = 1373, z = 7}
ZE_kickPosition = {x=1000, y=999, z=7}
ZE_spawnFromPosition = {x = 339, y = 376, z = 7}
ZE_spawnToPosition = {x = 368, y = 401, z = 7}
-- ITEM IDS
ZE_blockEnterItemID = 2700
-- STORAGES
-- - player
ZE_isOnZombieArea = 34370
-- - global
ZE_STATUS = 34370 -- =< 0 - off, 1 - waiting for players, 2 - is running
ZE_PLAYERS_NUMBER = 34371
ZE_ZOMBIES_TO_SPAWN = 34372
ZE_ZOMBIES_SPAWNED = 34373
-- FUNCTION
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]}, false)) == 'number')
if(ret) then
  addZombiesCount()
end
return ret
end

> Broadcasted message: "Zombie Arena Event started.".


Now is working but when you 'die' o zoombie, my character won't go to temple. Just die and lost exp,etc~~
 
> Broadcasted message: "Zombie Arena Event started.".


Now is working but when you 'die' o zoombie, my character won't go to temple. Just die and lost exp,etc~~

You edited these ?

Code:
ZE_blockEnterItemPosition = {x = 1187, y = 1373, z = 7}
ZE_enterPosition = {x = 1188, y = 1373, z = 7}
ZE_kickPosition = {x=1000, y=999, z=7}
ZE_spawnFromPosition = {x = 339, y = 376, z = 7}
ZE_spawnToPosition = {x = 368, y = 401, z = 7}
 
You edited these ?

Code:
ZE_blockEnterItemPosition = {x = 1187, y = 1373, z = 7}
ZE_enterPosition = {x = 1188, y = 1373, z = 7}
ZE_kickPosition = {x=1000, y=999, z=7}
ZE_spawnFromPosition = {x = 339, y = 376, z = 7}
ZE_spawnToPosition = {x = 368, y = 401, z = 7}

Yes, I edited with according my map.
 
I upload my zombie event to you and it work 100% with me I hope same to you

http://speedy*****malware.localhost/KAd6h/Zombie-event.rar
 
Back
Top