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

isInArray

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Hey,

I need some help on this part of my script,
I wan't it to check for tiles in an array, but it doesn't work.

array
Code:
local water = {4608,4609,4610,4611,4612,4613,4614,4615,4616,4617,4618,4619,4664,4665,4666,5757,5756,5755,5759,5760,5758,5761}
Code:
						if(getTileItemById(down,(isInArray(water,itemid)),false)) then
							doPlayerSendTextMessage(cid,20,'[Flying] You have flown down.')
							doSendMagicEffect(down,10)
							doCreatureSay(cid,'Down!',19)
							doTeleportThing(cid,down)
							return doSendMagicEffect(down,10)
						else
							doPlayerSendTextMessage(cid,20,'[Flying] You can\'t fly on water.')
						end
(sorry about the far away tabbing, but that's because it's somewhere far in my script.)

It teleports me even if it is in the array.
 
PHP:
local water = {4608,4609,4610,4611,4612,4613,4614,4615,4616,4617,4618,4619,4664,4665,4666,5757,5756,5755,5759,5760,5758,5761}

down.stackpos = 0
if not isInArray(water,getThingFromPos(down).itemid) then
	doPlayerSendTextMessage(cid,20,'[Flying] You have flown down.')
	doSendMagicEffect(down,10)
	doCreatureSay(cid,'Down!',19)
	doTeleportThing(cid,down)
	return doSendMagicEffect(down,10)
else
	doPlayerSendTextMessage(cid,20,'[Flying] You can\'t fly on water.')
end

If the groud is no water you can go down..
If you want it the other way -> Ground = water and go down then remove the "not"
 
Back
Top