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

Boolean comparison

Ecstacy

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

I have some problem in this globalevent here, and I don't really know how to solve something with boolean because I'm not sure what it is.

Code:
function onThink(cid, interval)
local s = 5001
	for _,pid in ipairs(getOnlinePlayers()) do
		if(getThingPos(pid) < 6 or getThingPos(pid) > 7)then
			if getPlayerStorageValue(pid,s) == 1 then
				local cidv = getThingPos(pid)
				if not(getTilePzInfo(cidv))then
				local summons = getCreatureSummons(pid)
					for _,pid in ipairs(summons) do
					local v = getThingPos(getCreatureMaster(pid))
						doTeleportThing(pid,v)
						doSendMagicEffect(v,10)
					end
				else
					for _,pid in ipairs(summons) do
					local cid,v = getCreatureMaster(pid),getThingPos(getCreatureMaster(pid))
						doRemoveCreature(pid)
						doPlayerSendTextMessage(cid,19,'[Mount] Your horse got sent away because you are in PZ.')
						doSendMagicEffect(v,10)
					end
				end
			end
		end
	end
	return true
end
 
Please post the exact errors.

there is at least a bug in this line:
if(getThingPos(pid) < 6 or getThingPos(pid) > 7)then

because "getThingPos(pid)" is an array so you need something like:
getThingPos(pid).z to compare the positions..
 
Code:
[18/06/2010 18:14:27] [Error - GlobalEvent Interface] 
[18/06/2010 18:14:27] data/globalevents/scripts/heightCheck.lua:onThink
[18/06/2010 18:14:27] Description: 
[18/06/2010 18:14:27] data/globalevents/scripts/heightCheck.lua:4: attempt to compare boolean with number
[18/06/2010 18:14:27] stack traceback:
[18/06/2010 18:14:27] 	data/globalevents/scripts/heightCheck.lua:4: in function <data/globalevents/scripts/heightCheck.lua:1>
[18/06/2010 18:14:27] [Error - GlobalEvents::think] Couldn't execute event: heightCheck

checking if getThingPos(pid).z will work.

#Doesn't work.
 
Back
Top