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

Windows (luaDoAddCondition) & (luaCreateConditionObject) Errors, help?

Naxtie

mapper, designer
Joined
Oct 15, 2011
Messages
1,565
Solutions
1
Reaction score
250
Location
Sweden
Hello there, I got a error which I didn't understand.. It all happens when i'm using a talkaction to join a event.

(If the "condition" doesn't exist, is it possible to add it?)

Here's the whole error:
Code:
[Error - TalkAction Interface]
buffer:onSay
Description:
(luaCreateConditionObject) This function can only be used while loading the script.

[Error - TalkAction Inferface]
buffer:onSay
Description:
(luaDoAddCondition) Condition not found

Thanks in advance..
Naxtie
 
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="LMS_Event" version="1.0" author="VirrageS" contact="otland.net" enabled="yes">

	<config name="Lms_setup">
		<![CDATA[
			setup = {
				storage = 7532,  -- set free storage
				eventStorage = 5373,  -- set free storage
				joinEventStorage = 4534,  -- set free storage
				countPlayerStorage = 4553,  -- set free storage
				killStorage = 4656, -- set free storage
				exhaustStorage = 6456,
				whichEventStorage = 5486,

				maxPlayers = 30,  -- max players in event
				teleportPosLms = {x=783, y=861, z=7}, -- Position where the player will get teleported when entering the event.
				rewardID = {7958, 11366, 2349, 7450}, -- Player reward ID's
				minLvl = 100, -- Join event minimum level.
				pvp = false,
				days = {['Tuesday'] = {'21:59:20'}, 
					['Thursday'] = {'21:59:20'}, 
					['Friday'] = {'21:59:20'}, 
					['Sunday'] = {'21:59:20'}},
				minPlayers = 2,
				-- NEW --
				numberOfCreateMonsters = 5,
				---------
				
				text = '-ENG-\nTo win and get rewarded you have to kill as many zombies as possible for 20 minutes or stay alive in the arena.',

				monsterName = {'Scratchclaw', 'Propell Zombie', 'Vile Centurion', 'Mongrel Man', 'Daidalost'}, -- name of monsters which is creating in event

				delayTime = 1.0, -- time in which players who joined to event are teleporting to teleport position [[[miuntes]]]
				timeToStartEvent = 5, -- time from teleport to start event [[[seconds]]]
				timeToStopEvent = 9200 -- [[[seconds]]]
			}

			room = {fromPos = {x=767, y=848, z=7}, -- left top corner of event room
					toPos = {x=798, y=877, z=7}, -- right bottom corner of event room
			}
		]]>
	</config>
	
	<lib name="Lms_lib">
		<![CDATA[			
			function doStopEvent()
				if getStorage(setup.eventStorage) == 1 then
					local playerTable, creatureTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							local n, i = getTileInfo({x=x, y=y, z=7}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								end
							end
						end
					end

					if #playerTable > 1 then
						table.sort(playerTable, function(a, b) return (getCreatureStorage(a, setup.killStorage)) > (getCreatureStorage(b, setup.killStorage)) end)
						
						local prize = math.random(#setup.rewardID)
						
						addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
						doCreatureSetStorage(playerTable[1], setup.killStorage, 0)
						doPlayerAddItem(playerTable[1], setup.rewardID[prize], 1)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! Your reward is ' .. getItemNameById(setup.rewardID[prize]) .. '.')
						doBroadcastMessage('Zombie Plague Attack has been finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations!', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						db.executeQuery("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(setup.rewardID[prize]) .. "\", " .. getStorage(setup.whichEventStorage) ..");")

						for i = 2, #playerTable do
							doCreatureAddHealth(playerTable[i], - getCreatureHealth(playerTable[i]) + 1)
							doCreatureAddMana(playerTable[i], - getCreatureMana(playerTable[i]))
							doTeleportThing(playerTable[i], getTownTemplePosition(getPlayerTown(playerTable[i])))
							doPlayerSendTextMessage(playerTable[i], MESSAGE_EVENT_ADVANCE, 'You lost. You have been infected!')
							doSendMagicEffect(getThingPos(playerTable[i]), 31)
							doCreatureSetStorage(playerTable[i], setup.killStorage, 0)
						end

						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					end
				end
			end

			function doStartEventLMS()
				doSetStorage(setup.joinEventStorage, -1)

				if setup.minPlayers <= getStorage(setup.countPlayerStorage) then
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, setup.storage) == 1 then
							doCreatureSetStorage(cid, setup.storage, -1)
							doTeleportThing(cid, setup.teleportPosLms)
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
							
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Get ready. Event will start in ' .. setup.timeToStartEvent .. ' seconds.')
						end
					end
					addEvent(doSetStorage, setup.timeToStartEvent * 1000, setup.eventStorage, 1)
					addEvent(doStopEvent, setup.timeToStopEvent * 1000)
				else
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, setup.storage) == 1 then
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
						end
					end
					doBroadcastMessage('Zombie Plague Attack have been started! Get ready to survive!.', MESSAGE_EVENT_ADVANCE)
				end
				doSetStorage(setup.countPlayerStorage, 0)
			end
		]]>
	</lib>

	<talkaction words="!zombie" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onSay(cid, words, param)
				local storage, playerJoined, counter = getCreatureStorage(cid, setup.storage), {}, getStorage(setup.countPlayerStorage)

				if getStorage(setup.joinEventStorage) == 1 then
					if(param == '') then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Command param required (say: "!zombie join" or "!zombie leave").')
					end

					if getPlayerLevel(cid) < setup.minLvl then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join the event if you do not have the required level. [' .. setup.minLvl .. ']')
					end
					
					if getTileInfo(getThingPos(cid)).protection ~= true then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join the event if you are not in a protection zone.')
					end
					
					if exhaustion.check(cid, setup.exhaustStorage) ~= false then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait: ' .. exhaustion.get(cid, setup.exhaustStorage) .. ' seconds')
					end

					if param == 'join' then
						if storage <= 0 then
							if counter ~= setup.maxPlayers - 1 then
								doSetStorage(setup.countPlayerStorage, 0)
								for _, pid in ipairs(getPlayersOnline()) do
									if getCreatureStorage(pid, setup.storage) > 0 then
										table.insert(playerJoined, pid)
										doSetStorage(setup.countPlayerStorage, #playerJoined)
									end
								end
								local count = getStorage(setup.countPlayerStorage)
								doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, count == 0 and 'You are the first one to join the event.' or count == 1 and 'Currently there are 1 player in the event.' or count > 1 and 'Currently there are '.. count ..' players in the event.')
								doCreatureSetStorage(cid, setup.storage, 1)
								
								doCreatureSetNoMove(cid, true)
								local condition = createConditionObject(CONDITION_INFIGHT, -1)
								
								doAddCondition(cid, condition)
								doPlayerPopupFYI(cid, setup.text)
								doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the event. You can not move until event do not start. Wait patiently for event start.')
							else
								doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in the event have been reached.')
							end
						else
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You have already joined the event. Wait patiently for it to start.')
						end
					elseif param == 'leave' then
						if storage > 0 then
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
							doCreatureSetStorage(cid, setup.storage, -1)
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have left from the event.')
						else
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Sorry, But you can not leave from the event.')
						end
					end
				else
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join/leave the event yet.')
				end
				
				exhaustion.set(cid, setup.exhaustStorage, 5)
				
				return true
			end
		]]>
	</talkaction>
	
	<talkaction words="!startzombie" access="5" event="script">
		<![CDATA[
			domodlib("Lms_setup")
			domodlib("Lms_lib")

			function onSay(cid, words, param)
				doBroadcastMessage('Zombie Plague Attack will start in ' .. setup.delayTime .. ' min. You can join to event by say "!zombie join".', MESSAGE_EVENT_ADVANCE)

				for _, pid in ipairs(getPlayersOnline()) do
					if getCreatureStorage(pid, setup.storage) == 1 then
						doCreatureSetStorage(pid, setup.storage, -1)
						doSetStorage(setup.countPlayerStorage, 0)
						doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
						doCreatureSetStorage(pid, setup.killStorage, 0)
					end
				end

				doSetStorage(setup.joinEventStorage, 1)
				addEvent(doStartEventLMS, setup.delayTime * 60 * 1000)
				return true
			end
		]]>
	</talkaction>

	<event type="think" name="LMS_Boss_Event_Start" event="script">
		<![CDATA[
			domodlib("Lms_setup")
			domodlib("Lms_lib")
			
			local daysOpen = {}
			
			for k, v in pairs(setup.days) do
				table.insert(daysOpen, k)
			end
			
			function onThink(cid, interval)
				if isInArray(daysOpen, os.date('%A')) then
					if isInArray(setup.days[os.date('%A')], os.date('%X', os.time())) then
						if getStorage(setup.joinEventStorage) ~= 1 then
							doBroadcastMessage('Zombie Plague Attack will start in ' .. setup.delayTime .. ' min. You can join to event by say "!zombie join".', MESSAGE_EVENT_ADVANCE)

							for _, pid in ipairs(getPlayersOnline()) do
								if getCreatureStorage(pid, setup.storage) == 1 then
									doCreatureSetStorage(pid, setup.storage, -1)
									doSetStorage(setup.countPlayerStorage, 0)
									doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
									doCreatureSetStorage(pid, setup.killStorage, 0)
								end
							end

							doSetStorage(setup.joinEventStorage, 1)
							addEvent(doStartEventLMS, setup.delayTime * 60 * 1000)
						end
					end
				end

				return true
			end
		]]>
	</event>

	<globalevent name="LMS_Event_CheckPlayer" interval="1500" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onThink(interval, lastExecution)
				if getStorage(setup.eventStorage) == 1 then
					local playerTable, creatureTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							local n, i = getTileInfo({x=x, y=y, z=7}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								end
							end
						end
					end

					if #playerTable == 1 then
						local prize = math.random(#setup.rewardID)
						
						addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
						doPlayerAddItem(playerTable[1], setup.rewardID[prize], 1)
						doCreatureSetStorage(playerTable[1], setup.killStorage, 0)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! Your reward is ' .. getItemNameById(setup.rewardID[prize]) .. '.')
						doBroadcastMessage('Zombie Plague Attack have finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						db.executeQuery("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(setup.rewardID[prize]) .. "\", " .. getStorage(setup.whichEventStorage) ..");")
						
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					end
				end
				return true
			end
		]]>
	</globalevent>

	<globalevent name="LMS_Event_CreateMonster" interval="500" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onThink(interval, lastExecution)
				if getStorage(setup.eventStorage) == 1 then
					local xTable, yTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							table.insert(xTable, x)
							table.insert(yTable, y)
						end
					end

					local pos, create = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7}
					local monster = getCreatureByName(setup.monsterName[math.random(#setup.monsterName)])
					
					for q = 1, setup.numberOfCreateMonsters do
						if isCreature(monster) then
							if doTileQueryAdd(monster, pos) == RETURNVALUE_NOERROR then
								doCreateMonster(setup.monsterName[math.random(#setup.monsterName)], pos, false, false, false)
								doSendMagicEffect(pos, 66)
							end
						end
					end
				end
				return true
			end
		]]>
	</globalevent>

	<event type="login" name="LMS_login" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onLogin(cid)
				if getCreatureStorage(cid, setup.storage) == 1 then
					doCreatureSetStorage(cid, setup.storage, -1)
					doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
					doCreatureSetNoMove(cid, false)
					doRemoveCondition(cid, CONDITION_INFIGHT)
					doCreatureSetStorage(cid, setup.killStorage, 0)
				end
				
				registerCreatureEvent(cid, "LMS_Boss_Event_Start")
				registerCreatureEvent(cid, "LMS_dead")
				registerCreatureEvent(cid, "LMS_kill")
				return true
			end
		]]>
	</event>

	<event type="statschange" name="LMS_dead" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onStatsChange(cid, attacker, type, combat, value)
				if type == 1 and getCreatureHealth(cid) <= value then
					if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
						if isPlayer(cid) then
							doCreatureAddHealth(cid, - getCreatureHealth(cid) + 1)
							doCreatureAddMana(cid, - getCreatureMana(cid))
							addEvent(doTeleportThing, 200, cid, getTownTemplePosition(getPlayerTown(cid)))
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You loss. You have been infected.')
							doSendAnimatedText(getThingPos(cid), value, TEXTCOLOR_RED)
							doSendMagicEffect(getThingPos(cid), 10)
							doCreatureSetStorage(cid, setup.killStorage, 0)
							return false
						end
					end
				elseif setup.pvp ~= true and type == 1 and isPlayer(attacker) and isPlayer(cid) then
					if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
						return false
					end
				end
				return true
			end
		]]>
	</event>

	<event type="kill" name="LMS_kill" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onKill(cid, target, damage, flags)
				if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
					if isInArray(setup.monsterName, getCreatureName(target)) then
						doCreatureSetStorage(cid, setup.killStorage, math.max(0, getCreatureStorage(cid, setup.killStorage) + 1))
					end
				end
				return true
			end
		]]>
	</event>
</mod>
 
Last edited by a moderator:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="LMS_Event" version="1.0" author="VirrageS" contact="otland.net" enabled="yes">

	<config name="Lms_setup">
		<![CDATA[
			setup = {
				storage = 7532,  -- set free storage
				eventStorage = 5373,  -- set free storage
				joinEventStorage = 4534,  -- set free storage
				countPlayerStorage = 4553,  -- set free storage
				killStorage = 4656, -- set free storage
				exhaustStorage = 6456,
				whichEventStorage = 5486,

				maxPlayers = 30,  -- max players in event
				teleportPosLms = {x=783, y=861, z=7}, -- Position where the player will get teleported when entering the event.
				rewardID = {7958, 11366, 2349, 7450}, -- Player reward ID's
				minLvl = 100, -- Join event minimum level.
				pvp = false,
				days = {['Tuesday'] = {'21:59:20'}, 
					['Thursday'] = {'21:59:20'}, 
					['Friday'] = {'21:59:20'}, 
					['Sunday'] = {'21:59:20'}},
				minPlayers = 2,
				-- NEW --
				numberOfCreateMonsters = 5,
				---------
				
				text = '-ENG-\nTo win and get rewarded you have to kill as many zombies as possible for 20 minutes or stay alive in the arena.',

				monsterName = {'Scratchclaw', 'Propell Zombie', 'Vile Centurion', 'Mongrel Man', 'Daidalost'}, -- name of monsters which is creating in event

				delayTime = 1.0, -- time in which players who joined to event are teleporting to teleport position [[[miuntes]]]
				timeToStartEvent = 5, -- time from teleport to start event [[[seconds]]]
				timeToStopEvent = 9200 -- [[[seconds]]]
			}

			room = {fromPos = {x=767, y=848, z=7}, -- left top corner of event room
					toPos = {x=798, y=877, z=7}, -- right bottom corner of event room
			}
		]]>
	</config>
	
	<lib name="Lms_lib">
		<![CDATA[			
			function doStopEvent()
				if getStorage(setup.eventStorage) == 1 then
					local playerTable, creatureTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							local n, i = getTileInfo({x=x, y=y, z=7}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								end
							end
						end
					end

					if #playerTable > 1 then
						table.sort(playerTable, function(a, b) return (getCreatureStorage(a, setup.killStorage)) > (getCreatureStorage(b, setup.killStorage)) end)
						
						local prize = math.random(#setup.rewardID)
						
						addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
						doCreatureSetStorage(playerTable[1], setup.killStorage, 0)
						doPlayerAddItem(playerTable[1], setup.rewardID[prize], 1)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! Your reward is ' .. getItemNameById(setup.rewardID[prize]) .. '.')
						doBroadcastMessage('Zombie Plague Attack has been finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations!', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						db.executeQuery("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(setup.rewardID[prize]) .. "\", " .. getStorage(setup.whichEventStorage) ..");")

						for i = 2, #playerTable do
							doCreatureAddHealth(playerTable[i], - getCreatureHealth(playerTable[i]) + 1)
							doCreatureAddMana(playerTable[i], - getCreatureMana(playerTable[i]))
							doTeleportThing(playerTable[i], getTownTemplePosition(getPlayerTown(playerTable[i])))
							doPlayerSendTextMessage(playerTable[i], MESSAGE_EVENT_ADVANCE, 'You lost. You have been infected!')
							doSendMagicEffect(getThingPos(playerTable[i]), 31)
							doCreatureSetStorage(playerTable[i], setup.killStorage, 0)
						end

						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					end
				end
			end

			function doStartEventLMS()
				doSetStorage(setup.joinEventStorage, -1)

				if setup.minPlayers <= getStorage(setup.countPlayerStorage) then
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, setup.storage) == 1 then
							doCreatureSetStorage(cid, setup.storage, -1)
							doTeleportThing(cid, setup.teleportPosLms)
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
							
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Get ready. Event will start in ' .. setup.timeToStartEvent .. ' seconds.')
						end
					end
					addEvent(doSetStorage, setup.timeToStartEvent * 1000, setup.eventStorage, 1)
					addEvent(doStopEvent, setup.timeToStopEvent * 1000)
				else
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, setup.storage) == 1 then
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
						end
					end
					doBroadcastMessage('Zombie Plague Attack have been started! Get ready to survive!.', MESSAGE_EVENT_ADVANCE)
				end
				doSetStorage(setup.countPlayerStorage, 0)
			end
		]]>
	</lib>

	<talkaction words="!zombie" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onSay(cid, words, param)
				local storage, playerJoined, counter = getCreatureStorage(cid, setup.storage), {}, getStorage(setup.countPlayerStorage)

				if getStorage(setup.joinEventStorage) == 1 then
					if(param == '') then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Command param required (say: "!zombie join" or "!zombie leave").')
					end

					if getPlayerLevel(cid) < setup.minLvl then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join the event if you do not have the required level. [' .. setup.minLvl .. ']')
					end
					
					if getTileInfo(getThingPos(cid)).protection ~= true then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join the event if you are not in a protection zone.')
					end
					
					if exhaustion.check(cid, setup.exhaustStorage) ~= false then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait: ' .. exhaustion.get(cid, setup.exhaustStorage) .. ' seconds')
					end

					if param == 'join' then
						if storage <= 0 then
							if counter ~= setup.maxPlayers - 1 then
								doSetStorage(setup.countPlayerStorage, 0)
								for _, pid in ipairs(getPlayersOnline()) do
									if getCreatureStorage(pid, setup.storage) > 0 then
										table.insert(playerJoined, pid)
										doSetStorage(setup.countPlayerStorage, #playerJoined)
									end
								end
								local count = getStorage(setup.countPlayerStorage)
								doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, count == 0 and 'You are the first one to join the event.' or count == 1 and 'Currently there are 1 player in the event.' or count > 1 and 'Currently there are '.. count ..' players in the event.')
								doCreatureSetStorage(cid, setup.storage, 1)
								
								doCreatureSetNoMove(cid, true)
								
								doPlayerPopupFYI(cid, setup.text)
								doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the event. You can not move until event do not start. Wait patiently for event start.')
							else
								doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in the event have been reached.')
							end
						else
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You have already joined the event. Wait patiently for it to start.')
						end
					elseif param == 'leave' then
						if storage > 0 then
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
							doCreatureSetStorage(cid, setup.storage, -1)
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have left from the event.')
						else
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Sorry, But you can not leave from the event.')
						end
					end
				else
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join/leave the event yet.')
				end
				
				exhaustion.set(cid, setup.exhaustStorage, 5)
				
				return true
			end
		]]>
	</talkaction>
	
	<talkaction words="!startzombie" access="5" event="script">
		<![CDATA[
			domodlib("Lms_setup")
			domodlib("Lms_lib")

			function onSay(cid, words, param)
				doBroadcastMessage('Zombie Plague Attack will start in ' .. setup.delayTime .. ' min. You can join to event by say "!zombie join".', MESSAGE_EVENT_ADVANCE)

				for _, pid in ipairs(getPlayersOnline()) do
					if getCreatureStorage(pid, setup.storage) == 1 then
						doCreatureSetStorage(pid, setup.storage, -1)
						doSetStorage(setup.countPlayerStorage, 0)
						doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
						doCreatureSetStorage(pid, setup.killStorage, 0)
					end
				end

				doSetStorage(setup.joinEventStorage, 1)
				addEvent(doStartEventLMS, setup.delayTime * 60 * 1000)
				return true
			end
		]]>
	</talkaction>

	<event type="think" name="LMS_Boss_Event_Start" event="script">
		<![CDATA[
			domodlib("Lms_setup")
			domodlib("Lms_lib")
			
			local daysOpen = {}
			
			for k, v in pairs(setup.days) do
				table.insert(daysOpen, k)
			end
			
			function onThink(cid, interval)
				if isInArray(daysOpen, os.date('%A')) then
					if isInArray(setup.days[os.date('%A')], os.date('%X', os.time())) then
						if getStorage(setup.joinEventStorage) ~= 1 then
							doBroadcastMessage('Zombie Plague Attack will start in ' .. setup.delayTime .. ' min. You can join to event by say "!zombie join".', MESSAGE_EVENT_ADVANCE)

							for _, pid in ipairs(getPlayersOnline()) do
								if getCreatureStorage(pid, setup.storage) == 1 then
									doCreatureSetStorage(pid, setup.storage, -1)
									doSetStorage(setup.countPlayerStorage, 0)
									doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
									doCreatureSetStorage(pid, setup.killStorage, 0)
								end
							end

							doSetStorage(setup.joinEventStorage, 1)
							addEvent(doStartEventLMS, setup.delayTime * 60 * 1000)
						end
					end
				end

				return true
			end
		]]>
	</event>

	<globalevent name="LMS_Event_CheckPlayer" interval="1500" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onThink(interval, lastExecution)
				if getStorage(setup.eventStorage) == 1 then
					local playerTable, creatureTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							local n, i = getTileInfo({x=x, y=y, z=7}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								end
							end
						end
					end

					if #playerTable == 1 then
						local prize = math.random(#setup.rewardID)
						
						addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
						doPlayerAddItem(playerTable[1], setup.rewardID[prize], 1)
						doCreatureSetStorage(playerTable[1], setup.killStorage, 0)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! Your reward is ' .. getItemNameById(setup.rewardID[prize]) .. '.')
						doBroadcastMessage('Zombie Plague Attack have finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						db.executeQuery("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(setup.rewardID[prize]) .. "\", " .. getStorage(setup.whichEventStorage) ..");")
						
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					end
				end
				return true
			end
		]]>
	</globalevent>

	<globalevent name="LMS_Event_CreateMonster" interval="500" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onThink(interval, lastExecution)
				if getStorage(setup.eventStorage) == 1 then
					local xTable, yTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							table.insert(xTable, x)
							table.insert(yTable, y)
						end
					end

					local pos, create = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7}
					local monster = getCreatureByName(setup.monsterName[math.random(#setup.monsterName)])
					
					for q = 1, setup.numberOfCreateMonsters do
						if isCreature(monster) then
							if doTileQueryAdd(monster, pos) == RETURNVALUE_NOERROR then
								doCreateMonster(setup.monsterName[math.random(#setup.monsterName)], pos, false, false, false)
								doSendMagicEffect(pos, 66)
							end
						end
					end
				end
				return true
			end
		]]>
	</globalevent>

	<event type="login" name="LMS_login" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onLogin(cid)
				if getCreatureStorage(cid, setup.storage) == 1 then
					doCreatureSetStorage(cid, setup.storage, -1)
					doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
					doCreatureSetNoMove(cid, false)
					doRemoveCondition(cid, CONDITION_INFIGHT)
					doCreatureSetStorage(cid, setup.killStorage, 0)
				end
				
				registerCreatureEvent(cid, "LMS_Boss_Event_Start")
				registerCreatureEvent(cid, "LMS_dead")
				registerCreatureEvent(cid, "LMS_kill")
				return true
			end
		]]>
	</event>

	<event type="statschange" name="LMS_dead" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onStatsChange(cid, attacker, type, combat, value)
				if type == 1 and getCreatureHealth(cid) <= value then
					if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
						if isPlayer(cid) then
							doCreatureAddHealth(cid, - getCreatureHealth(cid) + 1)
							doCreatureAddMana(cid, - getCreatureMana(cid))
							addEvent(doTeleportThing, 200, cid, getTownTemplePosition(getPlayerTown(cid)))
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You loss. You have been infected.')
							doSendAnimatedText(getThingPos(cid), value, TEXTCOLOR_RED)
							doSendMagicEffect(getThingPos(cid), 10)
							doCreatureSetStorage(cid, setup.killStorage, 0)
							return false
						end
					end
				elseif setup.pvp ~= true and type == 1 and isPlayer(attacker) and isPlayer(cid) then
					if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
						return false
					end
				end
				return true
			end
		]]>
	</event>

	<event type="kill" name="LMS_kill" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onKill(cid, target, damage, flags)
				if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
					if isInArray(setup.monsterName, getCreatureName(target)) then
						doCreatureSetStorage(cid, setup.killStorage, math.max(0, getCreatureStorage(cid, setup.killStorage) + 1))
					end
				end
				return true
			end
		]]>
	</event>
</mod>
 
local condition = createConditionObject(CONDITION_INFIGHT, -1)
has to be before function onSay(...)
 
Can you fix it? I dont really get it x'D

Exactly as he wrote..

local condition = createConditionObject(CONDITION_INFIGHT, -1) has to be BEFORE function onSay(...)

Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="LMS_Event" version="1.0" author="VirrageS" contact="otland.net" enabled="yes">

	<config name="Lms_setup">
		<![CDATA[
			setup = {
				storage = 7532,  -- set free storage
				eventStorage = 5373,  -- set free storage
				joinEventStorage = 4534,  -- set free storage
				countPlayerStorage = 4553,  -- set free storage
				killStorage = 4656, -- set free storage
				exhaustStorage = 6456,
				whichEventStorage = 5486,

				maxPlayers = 30,  -- max players in event
				teleportPosLms = {x=783, y=861, z=7}, -- Position where the player will get teleported when entering the event.
				rewardID = {7958, 11366, 2349, 7450}, -- Player reward ID's
				minLvl = 100, -- Join event minimum level.
				pvp = false,
				days = {['Tuesday'] = {'21:59:20'}, 
					['Thursday'] = {'21:59:20'}, 
					['Friday'] = {'21:59:20'}, 
					['Sunday'] = {'21:59:20'}},
				minPlayers = 2,
				-- NEW --
				numberOfCreateMonsters = 5,
				---------
				
				text = '-ENG-\nTo win and get rewarded you have to kill as many zombies as possible for 20 minutes or stay alive in the arena.',

				monsterName = {'Scratchclaw', 'Propell Zombie', 'Vile Centurion', 'Mongrel Man', 'Daidalost'}, -- name of monsters which is creating in event

				delayTime = 1.0, -- time in which players who joined to event are teleporting to teleport position [[[miuntes]]]
				timeToStartEvent = 5, -- time from teleport to start event [[[seconds]]]
				timeToStopEvent = 9200 -- [[[seconds]]]
			}

			room = {fromPos = {x=767, y=848, z=7}, -- left top corner of event room
					toPos = {x=798, y=877, z=7}, -- right bottom corner of event room
			}
		]]>
	</config>
	
	<lib name="Lms_lib">
		<![CDATA[			
			function doStopEvent()
				if getStorage(setup.eventStorage) == 1 then
					local playerTable, creatureTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							local n, i = getTileInfo({x=x, y=y, z=7}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								end
							end
						end
					end

					if #playerTable > 1 then
						table.sort(playerTable, function(a, b) return (getCreatureStorage(a, setup.killStorage)) > (getCreatureStorage(b, setup.killStorage)) end)
						
						local prize = math.random(#setup.rewardID)
						
						addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
						doCreatureSetStorage(playerTable[1], setup.killStorage, 0)
						doPlayerAddItem(playerTable[1], setup.rewardID[prize], 1)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! Your reward is ' .. getItemNameById(setup.rewardID[prize]) .. '.')
						doBroadcastMessage('Zombie Plague Attack has been finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations!', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						db.executeQuery("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(setup.rewardID[prize]) .. "\", " .. getStorage(setup.whichEventStorage) ..");")

						for i = 2, #playerTable do
							doCreatureAddHealth(playerTable[i], - getCreatureHealth(playerTable[i]) + 1)
							doCreatureAddMana(playerTable[i], - getCreatureMana(playerTable[i]))
							doTeleportThing(playerTable[i], getTownTemplePosition(getPlayerTown(playerTable[i])))
							doPlayerSendTextMessage(playerTable[i], MESSAGE_EVENT_ADVANCE, 'You lost. You have been infected!')
							doSendMagicEffect(getThingPos(playerTable[i]), 31)
							doCreatureSetStorage(playerTable[i], setup.killStorage, 0)
						end

						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					end
				end
			end

			function doStartEventLMS()
				doSetStorage(setup.joinEventStorage, -1)

				if setup.minPlayers <= getStorage(setup.countPlayerStorage) then
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, setup.storage) == 1 then
							doCreatureSetStorage(cid, setup.storage, -1)
							doTeleportThing(cid, setup.teleportPosLms)
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
							
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Get ready. Event will start in ' .. setup.timeToStartEvent .. ' seconds.')
						end
					end
					addEvent(doSetStorage, setup.timeToStartEvent * 1000, setup.eventStorage, 1)
					addEvent(doStopEvent, setup.timeToStopEvent * 1000)
				else
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, setup.storage) == 1 then
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
						end
					end
					doBroadcastMessage('Zombie Plague Attack have been started! Get ready to survive!.', MESSAGE_EVENT_ADVANCE)
				end
				doSetStorage(setup.countPlayerStorage, 0)
			end
		]]>
	</lib>

	<talkaction words="!zombie" event="script">
		<![CDATA[
			domodlib("Lms_setup")
local condition = createConditionObject(CONDITION_INFIGHT, -1)
			function onSay(cid, words, param)
				local storage, playerJoined, counter = getCreatureStorage(cid, setup.storage), {}, getStorage(setup.countPlayerStorage)

				if getStorage(setup.joinEventStorage) == 1 then
					if(param == '') then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Command param required (say: "!zombie join" or "!zombie leave").')
					end

					if getPlayerLevel(cid) < setup.minLvl then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join the event if you do not have the required level. [' .. setup.minLvl .. ']')
					end
					
					if getTileInfo(getThingPos(cid)).protection ~= true then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join the event if you are not in a protection zone.')
					end
					
					if exhaustion.check(cid, setup.exhaustStorage) ~= false then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait: ' .. exhaustion.get(cid, setup.exhaustStorage) .. ' seconds')
					end

					if param == 'join' then
						if storage <= 0 then
							if counter ~= setup.maxPlayers - 1 then
								doSetStorage(setup.countPlayerStorage, 0)
								for _, pid in ipairs(getPlayersOnline()) do
									if getCreatureStorage(pid, setup.storage) > 0 then
										table.insert(playerJoined, pid)
										doSetStorage(setup.countPlayerStorage, #playerJoined)
									end
								end
								local count = getStorage(setup.countPlayerStorage)
								doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, count == 0 and 'You are the first one to join the event.' or count == 1 and 'Currently there are 1 player in the event.' or count > 1 and 'Currently there are '.. count ..' players in the event.')
								doCreatureSetStorage(cid, setup.storage, 1)
								
								doCreatureSetNoMove(cid, true)
								
								doAddCondition(cid, condition)
								doPlayerPopupFYI(cid, setup.text)
								doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the event. You can not move until event do not start. Wait patiently for event start.')
							else
								doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in the event have been reached.')
							end
						else
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You have already joined the event. Wait patiently for it to start.')
						end
					elseif param == 'leave' then
						if storage > 0 then
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
							doCreatureSetStorage(cid, setup.storage, -1)
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have left from the event.')
						else
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Sorry, But you can not leave from the event.')
						end
					end
				else
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join/leave the event yet.')
				end
				
				exhaustion.set(cid, setup.exhaustStorage, 5)
				
				return true
			end
		]]>
	</talkaction>
	
	<talkaction words="!startzombie" access="5" event="script">
		<![CDATA[
			domodlib("Lms_setup")
			domodlib("Lms_lib")

			function onSay(cid, words, param)
				doBroadcastMessage('Zombie Plague Attack will start in ' .. setup.delayTime .. ' min. You can join to event by say "!zombie join".', MESSAGE_EVENT_ADVANCE)

				for _, pid in ipairs(getPlayersOnline()) do
					if getCreatureStorage(pid, setup.storage) == 1 then
						doCreatureSetStorage(pid, setup.storage, -1)
						doSetStorage(setup.countPlayerStorage, 0)
						doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
						doCreatureSetStorage(pid, setup.killStorage, 0)
					end
				end

				doSetStorage(setup.joinEventStorage, 1)
				addEvent(doStartEventLMS, setup.delayTime * 60 * 1000)
				return true
			end
		]]>
	</talkaction>

	<event type="think" name="LMS_Boss_Event_Start" event="script">
		<![CDATA[
			domodlib("Lms_setup")
			domodlib("Lms_lib")
			
			local daysOpen = {}
			
			for k, v in pairs(setup.days) do
				table.insert(daysOpen, k)
			end
			
			function onThink(cid, interval)
				if isInArray(daysOpen, os.date('%A')) then
					if isInArray(setup.days[os.date('%A')], os.date('%X', os.time())) then
						if getStorage(setup.joinEventStorage) ~= 1 then
							doBroadcastMessage('Zombie Plague Attack will start in ' .. setup.delayTime .. ' min. You can join to event by say "!zombie join".', MESSAGE_EVENT_ADVANCE)

							for _, pid in ipairs(getPlayersOnline()) do
								if getCreatureStorage(pid, setup.storage) == 1 then
									doCreatureSetStorage(pid, setup.storage, -1)
									doSetStorage(setup.countPlayerStorage, 0)
									doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
									doCreatureSetStorage(pid, setup.killStorage, 0)
								end
							end

							doSetStorage(setup.joinEventStorage, 1)
							addEvent(doStartEventLMS, setup.delayTime * 60 * 1000)
						end
					end
				end

				return true
			end
		]]>
	</event>

	<globalevent name="LMS_Event_CheckPlayer" interval="1500" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onThink(interval, lastExecution)
				if getStorage(setup.eventStorage) == 1 then
					local playerTable, creatureTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							local n, i = getTileInfo({x=x, y=y, z=7}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								end
							end
						end
					end

					if #playerTable == 1 then
						local prize = math.random(#setup.rewardID)
						
						addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
						doPlayerAddItem(playerTable[1], setup.rewardID[prize], 1)
						doCreatureSetStorage(playerTable[1], setup.killStorage, 0)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! Your reward is ' .. getItemNameById(setup.rewardID[prize]) .. '.')
						doBroadcastMessage('Zombie Plague Attack have finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						db.executeQuery("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(setup.rewardID[prize]) .. "\", " .. getStorage(setup.whichEventStorage) ..");")
						
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					end
				end
				return true
			end
		]]>
	</globalevent>

	<globalevent name="LMS_Event_CreateMonster" interval="500" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onThink(interval, lastExecution)
				if getStorage(setup.eventStorage) == 1 then
					local xTable, yTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							table.insert(xTable, x)
							table.insert(yTable, y)
						end
					end

					local pos, create = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7}
					local monster = getCreatureByName(setup.monsterName[math.random(#setup.monsterName)])
					
					for q = 1, setup.numberOfCreateMonsters do
						if isCreature(monster) then
							if doTileQueryAdd(monster, pos) == RETURNVALUE_NOERROR then
								doCreateMonster(setup.monsterName[math.random(#setup.monsterName)], pos, false, false, false)
								doSendMagicEffect(pos, 66)
							end
						end
					end
				end
				return true
			end
		]]>
	</globalevent>

	<event type="login" name="LMS_login" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onLogin(cid)
				if getCreatureStorage(cid, setup.storage) == 1 then
					doCreatureSetStorage(cid, setup.storage, -1)
					doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
					doCreatureSetNoMove(cid, false)
					doRemoveCondition(cid, CONDITION_INFIGHT)
					doCreatureSetStorage(cid, setup.killStorage, 0)
				end
				
				registerCreatureEvent(cid, "LMS_Boss_Event_Start")
				registerCreatureEvent(cid, "LMS_dead")
				registerCreatureEvent(cid, "LMS_kill")
				return true
			end
		]]>
	</event>

	<event type="statschange" name="LMS_dead" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onStatsChange(cid, attacker, type, combat, value)
				if type == 1 and getCreatureHealth(cid) <= value then
					if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
						if isPlayer(cid) then
							doCreatureAddHealth(cid, - getCreatureHealth(cid) + 1)
							doCreatureAddMana(cid, - getCreatureMana(cid))
							addEvent(doTeleportThing, 200, cid, getTownTemplePosition(getPlayerTown(cid)))
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You loss. You have been infected.')
							doSendAnimatedText(getThingPos(cid), value, TEXTCOLOR_RED)
							doSendMagicEffect(getThingPos(cid), 10)
							doCreatureSetStorage(cid, setup.killStorage, 0)
							return false
						end
					end
				elseif setup.pvp ~= true and type == 1 and isPlayer(attacker) and isPlayer(cid) then
					if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
						return false
					end
				end
				return true
			end
		]]>
	</event>

	<event type="kill" name="LMS_kill" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onKill(cid, target, damage, flags)
				if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
					if isInArray(setup.monsterName, getCreatureName(target)) then
						doCreatureSetStorage(cid, setup.killStorage, math.max(0, getCreatureStorage(cid, setup.killStorage) + 1))
					end
				end
				return true
			end
		]]>
	</event>
</mod>
 
I did add it right above function onSay(cid, words, param) and now I dont get any error, but I wont get tped to the event area?
 
Try

Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="LMS_Event" version="1.0" author="VirrageS" contact="otland.net" enabled="yes">

	<config name="Lms_setup">
		<![CDATA[
			setup = {
				storage = 7532,  -- set free storage
				eventStorage = 5373,  -- set free storage
				joinEventStorage = 4534,  -- set free storage
				countPlayerStorage = 4553,  -- set free storage
				killStorage = 4656, -- set free storage
				exhaustStorage = 6456,
				whichEventStorage = 5486,

				maxPlayers = 30,  -- max players in event
				teleportPosLms = {x=783, y=861, z=7}, -- Position where the player will get teleported when entering the event.
				rewardID = {7958, 11366, 2349, 7450}, -- Player reward ID's
				minLvl = 100, -- Join event minimum level.
				pvp = false,
				days = {['Tuesday'] = {'21:59:20'}, 
					['Thursday'] = {'21:59:20'}, 
					['Friday'] = {'21:59:20'}, 
					['Sunday'] = {'21:59:20'}},
				minPlayers = 2,
				-- NEW --
				numberOfCreateMonsters = 5,
				---------
				
				text = '-ENG-\nTo win and get rewarded you have to kill as many zombies as possible for 20 minutes or stay alive in the arena.',

				monsterName = {'Scratchclaw', 'Propell Zombie', 'Vile Centurion', 'Mongrel Man', 'Daidalost'}, -- name of monsters which is creating in event

				delayTime = 1.0, -- time in which players who joined to event are teleporting to teleport position [[[miuntes]]]
				timeToStartEvent = 5, -- time from teleport to start event [[[seconds]]]
				timeToStopEvent = 9200 -- [[[seconds]]]
			}

			room = {fromPos = {x=767, y=848, z=7}, -- left top corner of event room
					toPos = {x=798, y=877, z=7}, -- right bottom corner of event room
			}
		]]>
	</config>
	
	<lib name="Lms_lib">
		<![CDATA[			
			function doStopEvent()
				if getStorage(setup.eventStorage) == 1 then
					local playerTable, creatureTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							local n, i = getTileInfo({x=x, y=y, z=7}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								end
							end
						end
					end

					if #playerTable > 1 then
						table.sort(playerTable, function(a, b) return (getCreatureStorage(a, setup.killStorage)) > (getCreatureStorage(b, setup.killStorage)) end)
						
						local prize = math.random(#setup.rewardID)
						
						addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
						doCreatureSetStorage(playerTable[1], setup.killStorage, 0)
						doPlayerAddItem(playerTable[1], setup.rewardID[prize], 1)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! Your reward is ' .. getItemNameById(setup.rewardID[prize]) .. '.')
						doBroadcastMessage('Zombie Plague Attack has been finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations!', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						db.executeQuery("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(setup.rewardID[prize]) .. "\", " .. getStorage(setup.whichEventStorage) ..");")

						for i = 2, #playerTable do
							doCreatureAddHealth(playerTable[i], - getCreatureHealth(playerTable[i]) + 1)
							doCreatureAddMana(playerTable[i], - getCreatureMana(playerTable[i]))
							doTeleportThing(playerTable[i], getTownTemplePosition(getPlayerTown(playerTable[i])))
							doPlayerSendTextMessage(playerTable[i], MESSAGE_EVENT_ADVANCE, 'You lost. You have been infected!')
							doSendMagicEffect(getThingPos(playerTable[i]), 31)
							doCreatureSetStorage(playerTable[i], setup.killStorage, 0)
						end

						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					end
				end
			end

			function doStartEventLMS()
				doSetStorage(setup.joinEventStorage, -1)

				if setup.minPlayers <= getStorage(setup.countPlayerStorage) then
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, setup.storage) == 1 then
							doCreatureSetStorage(cid, setup.storage, -1)
							doTeleportThing(cid, setup.teleportPosLms)
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
							
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Get ready. Event will start in ' .. setup.timeToStartEvent .. ' seconds.')
						end
					end
					addEvent(doSetStorage, setup.timeToStartEvent * 1000, setup.eventStorage, 1)
					addEvent(doStopEvent, setup.timeToStopEvent * 1000)
				else
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, setup.storage) == 1 then
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
						end
					end
					doBroadcastMessage('Zombie Plague Attack have been started! Get ready to survive!.', MESSAGE_EVENT_ADVANCE)
				end
				doSetStorage(setup.countPlayerStorage, 0)
			end
		]]>
	</lib>

	<talkaction words="!zombie" event="script">
		<![CDATA[
			domodlib("Lms_setup")
local condition = createConditionObject(CONDITION_INFIGHT, -1)
local count = getStorage(setup.countPlayerStorage)
			function onSay(cid, words, param)
				local storage, playerJoined, counter = getCreatureStorage(cid, setup.storage), {}, getStorage(setup.countPlayerStorage)

				if getStorage(setup.joinEventStorage) == 1 then
					if(param == '') then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Command param required (say: "!zombie join" or "!zombie leave").')
					end

					if getPlayerLevel(cid) < setup.minLvl then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join the event if you do not have the required level. [' .. setup.minLvl .. ']')
					end
					
					if getTileInfo(getThingPos(cid)).protection ~= true then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join the event if you are not in a protection zone.')
					end
					
					if exhaustion.check(cid, setup.exhaustStorage) ~= false then
						return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must wait: ' .. exhaustion.get(cid, setup.exhaustStorage) .. ' seconds')
					end

					if param == 'join' then
						if storage <= 0 then
							if counter ~= setup.maxPlayers - 1 then
								doSetStorage(setup.countPlayerStorage, 0)
								for _, pid in ipairs(getPlayersOnline()) do
									if getCreatureStorage(pid, setup.storage) > 0 then
										table.insert(playerJoined, pid)
										doSetStorage(setup.countPlayerStorage, #playerJoined)
									end
								end
								
								doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, count == 0 and 'You are the first one to join the event.' or count == 1 and 'Currently there are 1 player in the event.' or count > 1 and 'Currently there are '.. count ..' players in the event.')
								doCreatureSetStorage(cid, setup.storage, 1)
								
								doCreatureSetNoMove(cid, true)
								
								doAddCondition(cid, condition)
								doPlayerPopupFYI(cid, setup.text)
								doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined the event. You can not move until event do not start. Wait patiently for event start.')
							else
								doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Max players in the event have been reached.')
							end
						else
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You have already joined the event. Wait patiently for it to start.')
						end
					elseif param == 'leave' then
						if storage > 0 then
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
							doCreatureSetStorage(cid, setup.storage, -1)
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have left from the event.')
						else
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'Sorry, But you can not leave from the event.')
						end
					end
				else
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You can not join/leave the event yet.')
				end
				
				exhaustion.set(cid, setup.exhaustStorage, 5)
				
				return true
			end
		]]>
	</talkaction>
	
	<talkaction words="!startzombie" access="5" event="script">
		<![CDATA[
			domodlib("Lms_setup")
			domodlib("Lms_lib")

			function onSay(cid, words, param)
				doBroadcastMessage('Zombie Plague Attack will start in ' .. setup.delayTime .. ' min. You can join to event by say "!zombie join".', MESSAGE_EVENT_ADVANCE)

				for _, pid in ipairs(getPlayersOnline()) do
					if getCreatureStorage(pid, setup.storage) == 1 then
						doCreatureSetStorage(pid, setup.storage, -1)
						doSetStorage(setup.countPlayerStorage, 0)
						doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
						doCreatureSetStorage(pid, setup.killStorage, 0)
					end
				end

				doSetStorage(setup.joinEventStorage, 1)
				addEvent(doStartEventLMS, setup.delayTime * 60 * 1000)
				return true
			end
		]]>
	</talkaction>

	<event type="think" name="LMS_Boss_Event_Start" event="script">
		<![CDATA[
			domodlib("Lms_setup")
			domodlib("Lms_lib")
			
			local daysOpen = {}
			
			for k, v in pairs(setup.days) do
				table.insert(daysOpen, k)
			end
			
			function onThink(cid, interval)
				if isInArray(daysOpen, os.date('%A')) then
					if isInArray(setup.days[os.date('%A')], os.date('%X', os.time())) then
						if getStorage(setup.joinEventStorage) ~= 1 then
							doBroadcastMessage('Zombie Plague Attack will start in ' .. setup.delayTime .. ' min. You can join to event by say "!zombie join".', MESSAGE_EVENT_ADVANCE)

							for _, pid in ipairs(getPlayersOnline()) do
								if getCreatureStorage(pid, setup.storage) == 1 then
									doCreatureSetStorage(pid, setup.storage, -1)
									doSetStorage(setup.countPlayerStorage, 0)
									doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
									doCreatureSetStorage(pid, setup.killStorage, 0)
								end
							end

							doSetStorage(setup.joinEventStorage, 1)
							addEvent(doStartEventLMS, setup.delayTime * 60 * 1000)
						end
					end
				end

				return true
			end
		]]>
	</event>

	<globalevent name="LMS_Event_CheckPlayer" interval="1500" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onThink(interval, lastExecution)
				if getStorage(setup.eventStorage) == 1 then
					local playerTable, creatureTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							local n, i = getTileInfo({x=x, y=y, z=7}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=7, stackpos=i}).uid
								end
							end
						end
					end

					if #playerTable == 1 then
						local prize = math.random(#setup.rewardID)
						
						addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
						doPlayerAddItem(playerTable[1], setup.rewardID[prize], 1)
						doCreatureSetStorage(playerTable[1], setup.killStorage, 0)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! Your reward is ' .. getItemNameById(setup.rewardID[prize]) .. '.')
						doBroadcastMessage('Zombie Plague Attack have finished. The winner is ' .. getCreatureName(playerTable[1]) .. '. Congratulations.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						db.executeQuery("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(setup.rewardID[prize]) .. "\", " .. getStorage(setup.whichEventStorage) ..");")
						
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.', MESSAGE_EVENT_ADVANCE)
						doSetStorage(setup.eventStorage, -1)
						
						doSetStorage(setup.whichEventStorage, getStorage(setup.whichEventStorage) + 1)
					end
				end
				return true
			end
		]]>
	</globalevent>

	<globalevent name="LMS_Event_CreateMonster" interval="500" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onThink(interval, lastExecution)
				if getStorage(setup.eventStorage) == 1 then
					local xTable, yTable = {}, {}

					for x = room.fromPos.x, room.toPos.x do
						for y = room.fromPos.y, room.toPos.y do
							table.insert(xTable, x)
							table.insert(yTable, y)
						end
					end

					local pos, create = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7}
					local monster = getCreatureByName(setup.monsterName[math.random(#setup.monsterName)])
					
					for q = 1, setup.numberOfCreateMonsters do
						if isCreature(monster) then
							if doTileQueryAdd(monster, pos) == RETURNVALUE_NOERROR then
								doCreateMonster(setup.monsterName[math.random(#setup.monsterName)], pos, false, false, false)
								doSendMagicEffect(pos, 66)
							end
						end
					end
				end
				return true
			end
		]]>
	</globalevent>

	<event type="login" name="LMS_login" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onLogin(cid)
				if getCreatureStorage(cid, setup.storage) == 1 then
					doCreatureSetStorage(cid, setup.storage, -1)
					doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
					doCreatureSetNoMove(cid, false)
					doRemoveCondition(cid, CONDITION_INFIGHT)
					doCreatureSetStorage(cid, setup.killStorage, 0)
				end
				
				registerCreatureEvent(cid, "LMS_Boss_Event_Start")
				registerCreatureEvent(cid, "LMS_dead")
				registerCreatureEvent(cid, "LMS_kill")
				return true
			end
		]]>
	</event>

	<event type="statschange" name="LMS_dead" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onStatsChange(cid, attacker, type, combat, value)
				if type == 1 and getCreatureHealth(cid) <= value then
					if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
						if isPlayer(cid) then
							doCreatureAddHealth(cid, - getCreatureHealth(cid) + 1)
							doCreatureAddMana(cid, - getCreatureMana(cid))
							addEvent(doTeleportThing, 200, cid, getTownTemplePosition(getPlayerTown(cid)))
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You loss. You have been infected.')
							doSendAnimatedText(getThingPos(cid), value, TEXTCOLOR_RED)
							doSendMagicEffect(getThingPos(cid), 10)
							doCreatureSetStorage(cid, setup.killStorage, 0)
							return false
						end
					end
				elseif setup.pvp ~= true and type == 1 and isPlayer(attacker) and isPlayer(cid) then
					if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
						return false
					end
				end
				return true
			end
		]]>
	</event>

	<event type="kill" name="LMS_kill" event="script">
		<![CDATA[
			domodlib("Lms_setup")

			function onKill(cid, target, damage, flags)
				if isInRange(getThingPos(cid), room.fromPos, room.toPos) then
					if isInArray(setup.monsterName, getCreatureName(target)) then
						doCreatureSetStorage(cid, setup.killStorage, math.max(0, getCreatureStorage(cid, setup.killStorage) + 1))
					end
				end
				return true
			end
		]]>
	</event>
</mod>
 
Nop, no errors at all. When I added the condition thingy above the onSay and then the error dissapeard but you're not getting tped to the event area.
 
Back
Top