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

Lua Event Script

WibbenZ

Global Moderator
Staff member
Global Moderator
Joined
Oct 16, 2008
Messages
6,374
Solutions
229
Reaction score
1,503
Location
Sweden
Lua:
local fromPos = {x=995, y=667, z=7}
local toPos = {x=1000, y=672, z=7}				 
function onUse(cid, item, frompos, item2, topos)
	local i = 0
	for pos, thing in mapArea(fromPos, toPos, 253) do
		if isPlayer(thing.uid) == TRUE then
			doPlayerSendTextMessage(thing.uid, TALKTYPE_ORANGE_1, 'LAST MAN STANDING! KILL EVERYONE!')
			
			local pos = {x=992 + i % 12, y=630 + i % 3, z=7}
			doTeleportThing(thing.uid, pos)
		end
		i = i + 1
	end
	doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, 'Last Man Standing is running!')
	return TRUE
end

error
Code:
[04/05/2010 21:32:45] Lua Script Error: [Action Interface] 
[04/05/2010 21:32:45] data/actions/scripts/quests/last man.lua:onUse

[04/05/2010 21:32:46] data/actions/scripts/quests/last man.lua:5: attempt to call global 'mapArea' (a nil value)
[04/05/2010 21:32:46] stack traceback:
[04/05/2010 21:32:46] 	data/actions/scripts/quests/last man.lua:5: in function <data/actions/scripts/quests/last man.lua:3>

Need it to a event :)

rep++
 
Last edited:
Code:
-- Area iterator by Colandus @ OTFans.net
function mapArea(fromPos, toPos)
	local x, y, z = fromPos.x, fromPos.y-1, fromPos.z
	return function()
		if (y < toPos.y) then
			y = y+1
		elseif (x <= toPos.x) then
			y = fromPos.y
			x = x+1
		else
			x = fromPos.x
			y = fromPos.y
			z = z+1
		end
		if (x <= toPos.x and y <= toPos.y or z < toPos.z) then
			return x, y, z
		end
	end
end
 
Back
Top