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

My script doesn't work

Ecstacy

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

I'm making a script which will make a user select a tree (action) and will make them get teleported towards it, but my script now doesn't do anything, and any other attempts on making the script didn't work :blink:.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local trees = {2700,2701,2702,2703,2705,2707,2708,2711,7024}
	if getTileItemById(getThingPos(cid),trees.itemid) then
		if exhaustion.get(cid,3100) == false then
			doTeleportThing(cid,getThingPos(cid))
			exhaustion.set(cid,3100,1*60*1000)
		else
			doPlayerSendCancel(cid,'You are exhausted.')
		end
	else
		doPlayerSendCancel(cid,'You can only jump in trees.')
	end
	return true
end

And what do I have to use for crosshair target? cid?
 
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local trees = {2700,2701,2702,2703,2705,2707,2708,2711,7024}

	if isInArray(trees,getThingFromPos(toPosition).itemid) then
		if exhaustion.get(cid,3100) == false then
			doTeleportThing(cid,getThingPos(itemEx.uid))
			exhaustion.set(cid,3100,1*60*1000)
			doSendMagicEffect(fromPosition,CONST_ME_POFF)
		else
			doPlayerSendCancel(cid,'You are exhausted.')
		end
	else
		doPlayerSendCancel(cid,'You can only jump in trees.')
	end
	return true
end

BTW:
You need to write allowfaruse="1" in the line in actions.xml

Rep+?
 
@up, better would be
LUA:
    if isInArray(trees,getThingFromPos(toPosition).itemid) then
to 
    if isInArray(trees,itemEx.itemid) then

and
            doTeleportThing(cid,getThingPos(itemEx.uid))
to
            doTeleportThing(cid,toPosition)

xP
 
@up, better would be
LUA:
    if isInArray(trees,getThingFromPos(toPosition).itemid) then
to 
    if isInArray(trees,itemEx.itemid) then

and
            doTeleportThing(cid,getThingPos(itemEx.uid))
to
            doTeleportThing(cid,toPosition)

xP

Ye I was afk from my brain ;D
 
Back
Top