Slaying World
Member
So i modified a script to make a monster on a random position but i keep getting an error.
the description i get from the error is
"attempt to index a number value
stack traceback:
[c]: in function 'doCreateMonster'"
Code:
local Spawns = {
[1] = {x= 868, y=1056, z=7},
[2] = {x= 876, y=1052, z=7},
[3] = {x= 887, y=1055, z=7},
[4] = {x= 897, y=1063, z=7},
[5] = {x= 876, y=1076, z=7}
}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor, itemEx, var, pos)
if(not isPlayer(cid)) then
return true
end
if(getPlayerAccess(cid) >= ZE_ACCESS_TO_IGNORE_ARENA) then
addPlayerToZombiesArea(cid)
doCreatureSay(cid, "Protect your building from nazi zombies! If you get touched you are infected and are out of the game.", TALKTYPE_ORANGE_1)
elseif(#getZombiesEventPlayers() < getZombiesEventPlayersLimit() and getStorage(ZE_STATUS) == 1) then
addPlayerToZombiesArea(cid)
doCreatureSay(cid, "Protect your building from nazi zombies! If you get touched you are infected and are out of the game.", TALKTYPE_ORANGE_1)
local players_on_arena_count = #getZombiesEventPlayers()
if(players_on_arena_count == getZombiesEventPlayersLimit()) then
addZombiesEventBlockEnterPosition()
doSetStorage(ZE_STATUS, 2)
doCreateMonster("Zombie Event", math.random(#Spawns))
doBroadcastMessage("Zombie Arena Event started.")
else
doBroadcastMessage(getCreatureName(cid) .. " has entered a Zombie Arena. We still need " .. getZombiesEventPlayersLimit() - players_on_arena_count .. " players.")
end
else
doTeleportThing(cid, fromPosition, true)
addZombiesEventBlockEnterPosition()
end
return true
end
the description i get from the error is
"attempt to index a number value
stack traceback:
[c]: in function 'doCreateMonster'"