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

Use Item .

Djowz

Djowz's Style
Joined
Dec 29, 2011
Messages
47
Reaction score
1
I would like a script that when using such an item in such a place the player is teleported to a place.
Hugs djowz .
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == your_id_of_itemid and itemEx.itemid == your_id_of_itemid_2 then ---<  change 
        doTeleportThing(cid, {x=,y=,z=})
		
	end
return true
end
 
There's no need to check for the item ID, Seminari. That is what you do within the actions.xml file.

LUA:
local config = {
	removeOnUse = true, -- true / false
	useEffect = true -- true / false
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	doTeleportThing(cid, {x = 100, y = 100, z = 7}, false)
	
	if(config.removeOnUse) then
		doRemoveItem(item.uid, 1)
	end
	
	if(config.useEffect) then
		doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
	end
	
	return true
end
^_^
 
There's no need to check for the item ID, Seminari. That is what you do within the actions.xml file.

LUA:
local config = {
	removeOnUse = true, -- true / false
	useEffect = true -- true / false
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	doTeleportThing(cid, {x = 100, y = 100, z = 7}, false)
	
	if(config.removeOnUse) then
		doRemoveItem(item.uid, 1)
	end
	
	if(config.useEffect) then
		doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
	end
	
	return true
end
^_^


I know, but it's out of habit, because often I do a longer scripts:)

but if you are making config, put positions to config..
tp_pos = {x = 100, y = 100, z = 7}

and maybe
if getPlayerPosition(cid).x - tp_pos.x == 1 or getPlayerPosition(cid).y - tp_pos.y == 1 then
pushMove == true
end
 
Back
Top