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

Teleport onUse

Castic

Member
Joined
Sep 10, 2010
Messages
175
Reaction score
7
I'm in need of a script that if you use an item you receive another item and get teleported somewhere. Also, you can use the item again to teleport yourself, but it says "You've already retrieved the item"
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

	--start of config--
	local teleportPosition = {x=1000, y=1000, z=7, stackpos=254}	--coordinates of the location you wish to teleport to
	local removeOriginal = false									--remove the original item when you teleport?
	local itemToReceive = 2160										--itemid of the item you wish to recieve when you teleport
	local storageValue = 13001										--storage value to determine if you teleported before or not
	--end of config--
	
	if(removeOriginal) then
		doRemoveItem(cid, item.uid, 1)
	end
	
	if(getPlayerStorageValue(cid, storageValue) == 1) then
		doPlayerSendTextMessage(cid, MessageClasses, 'You\'ve already retrieved ' .. getItemArticleById(itemToReceive) .. ' ' .. getItemNameById(itemToReceive) .. '.')
	else
		doPlayerAddItem(cid, itemToReceive, 1, FALSE)
		doPlayerSetStorageValue(cid, storageValue, 1)
	end
	
	doTeleportThing(cid, teleportPosition)
	
	return true
end
 
Back
Top