• 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!

Getting this error.

Slaying World

Member
Joined
Apr 9, 2009
Messages
212
Reaction score
9
Location
Texas
So i modified a script to make a monster on a random position but i keep getting an error.

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'"
 
That's why u need to take the functions needed to that event. Search here 4 zombie event, there's it :D
 
Just help me solve this question. How can i do this

Create a "zombie event" monster in a random position like in my i posted script?

doCreateMonster("Zombie Event", math.random(#Spawns))
 
Anyone? can you help me make a script to create a monster on a random position

Something like this
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}
			}
 
Back
Top