• 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 Script] If PlayerPos == 1, 2 or 3 (solved)

StormRusher

New Member
Joined
Dec 23, 2009
Messages
138
Reaction score
0
Well i need a script to:

if PlayerPosition == position1 or position2 or position3 then

the 3 position possibles are:

Lua:
{x=330, y=602, z=10, stackpos=253}
{x=330, y=603, z=10, stackpos=253}
{x=330, y=604, z=10, stackpos=253}

thanks
 
Last edited:
Code:
function isPositionInArray(array, position)
	for i = 1, #array do
		if array[i].x == position.x and array[i].y == position.y and array[i].z == position.z then
			return true
		end
	end
	return false
end

local posList = {
	{x=330, y=602, z=10},
	{x=330, y=603, z=10},
	{x=330, y=604, z=10} 
}

if isPositionInArray(posList, getCreaturePosition(cid)) then
	--
else
	--
end
Moar simple:
Code:
local pos = getCreaturePosition(cid)
if pos.x == 330 and pos.y >= 602 and pos.y <= 604 and pos.z == 10 then
	--
else
	--
end
 
??
Lua:
_pos = {
[1] = {x=330, y=602, z=10, stackpos=253},
[2] = {x=330, y=603, z=10, stackpos=253},
[3] = {x=330, y=604, z=10, stackpos=253}  }

if isInArray(_pos, getCreaturePosition(cid)) then
bla bla bla
 
Back
Top