• 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 getCreaturePosition do not work

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
Why this script do not works? No bugs in console

PS.: It's a lever
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition, item2, topos)

	if (item.actionid == 17000) and (getCreaturePosition(cid, {x=33061, y=31527, z=10})) then
			doTeleportThing(cid, {x=32993,y=31547,z=4})
			doSendMagicEffect(getPlayerPosition(cid), 10)
	end
	return false
end
 
Edit: wow, totally missread your script xD sorry, here's the solution:

getCreaturePosition(cid) == {x=33061, y=31527, z=10} then

this should do it
 
Last edited:
Do not work
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition, item2, topos)

	if (item.actionid == 17000) and (getCreaturePosition(cid) == {x=33061, y=31527, z=10}) then
		doTeleportThing({x=32993,y=31547,z=4})
	else
		doPlayerSendCancel(cid, "Sorry, not possible") 	
	end
	return false
end

It just saying "doPlayerSendCancel(cid, "Sorry, not possible")"
 
Do not work
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition, item2, topos)

	if (item.actionid == 17000) and (getCreaturePosition(cid) == {x=33061, y=31527, z=10}) then
		doTeleportThing(cid, {x=32993,y=31547,z=4})
	else
		doPlayerSendCancel(cid, "Sorry, not possible") 	
	end
	return false
end

It just saying "doPlayerSendCancel(cid, "Sorry, not possible")"
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition, item2, topos)
	if(isInRange(getCreaturePosition(cid),{x=33061, y=31527, z=10}, {x=33061, y=31527, z=10}) then
		doTeleportThing(cid, {x=32993,y=31547,z=4})
	end
	return true
end
XML:
	<action actionid="17000" event="script" value="blabla.lua"/>

:D
 
Last edited:
Do not work

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition, item2, topos)
 
	if (item.actionid == 17000) and (isInRange(getCreaturePosition(cid),{x=33061, y=31527, z=10}, {x=33061, y=31527, z=10})) then
		doTeleportThing(cid, {x=32993,y=31547,z=4})
		return true
	else
		doPlayerSendCancel(cid, "Sorry, not possible")
		return true
	end
	if (item.actionid == 17001) and (isInRange(getCreaturePosition(cid),{x=32993,y=31547,z=4}, {x=32993,y=31547,z=4})) then
		doTeleportThing(cid, {x=33061, y=31527, z=10})
		return true
	else
		doPlayerSendCancel(cid, "Sorry, not possible")
		return true
	end
	return true
end
XML:
	<action actionid="17000;17001" event="script" value="zao/levers.lua"/>
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition, item2, topos)
 
	if(item.actionid == 17000) then
		if(isInRange(getCreaturePosition(cid),{x=33061, y=31527, z=10}, {x=33061, y=31527, z=10})) then
			doTeleportThing(cid, {x=32993,y=31547,z=4})
			doSendMagicEffect(getCreaturePosition(cid), 12)
		end
	elseif(item.actionid == 17001) then
		if(isInRange(getCreaturePosition(cid),{x=32993,y=31547,z=4}, {x=32993,y=31547,z=4})) then
			doTeleportThing(cid, {x=33061, y=31527, z=10})
			doSendMagicEffect(getCreaturePosition(cid), 12)
		end
	end
	return true
end
 
Working 100%
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition, item2, topos)
 
	if(item.actionid == 17000) then
		if(isInRange(getCreaturePosition(cid),{x=33061, y=31527, z=10}, {x=33061, y=31527, z=10})) then
			doTeleportThing(cid, {x=32993,y=31547,z=4})
			doSendMagicEffect(getCreaturePosition(cid), 12)
		else
			doPlayerSendCancel(cid, "Sorry, not possible.")
		end
	elseif(item.actionid == 17001) then
		if(isInRange(getCreaturePosition(cid),{x=32993,y=31547,z=4}, {x=32993,y=31547,z=4})) then
			doTeleportThing(cid, {x=33061, y=31527, z=10})
			doSendMagicEffect(getCreaturePosition(cid), 12)
		else
			doPlayerSendCancel(cid, "Sorry, not possible.")
		end
	end
	return true
end
 
Back
Top