function onStepIn(cid, item, pos)
local thing = 1337 -- ID of item
local destination = {x=1000, y=1000, z=7} -- Where to be teleported
if isPlayer(cid) == true then
if getPlayerItemCount(cid, thing) >= 1 then
doTeleportThing(cid, destination)
doPlayerRemoveItem(cid, thing, 1)
else
doPlayerSendTextMessage(cid, 22, "You need the item in order to teleport.")
end
else
return false
end
return true
end
function onStepIn(cid, item, pos)
if isPlayer(cid) ~= true and getPlayerItemCount(cid, 1222) < 1 then
doPlayerSendTextMessage(cid, 22, "You need the item in order to teleport.")
else
doTeleportThing(cid, {x=1000, y=1000, z=7})
doPlayerRemoveItem(cid, 1222, 1)
end
end
function onUse(cid, item, topos, frompos)
local t = 1223 -- ID of item to use
local p = {x=1000, y=1000, z=7) -- Where to be teleported
if item.itemid == t then
if isPzLocked(cid) == false then
doTeleportThing(cid, p)
doRemoveItem(item.uid, t) -- or doPlayerRemoveItem(cid, t, 1) ?
else
doPlayerSendTextMessage(cid, 22, "You must be inside protection zone.")
end
return false
end
return true
end
<action itemid="ITEM ID" script="teleport.lua"/>
function onSay(cid, item, param)
if isPzLocked(cid) == false then
if getPlayerItemCount(cid, 1222) >= 1 then
doTeleportThing(cid, {x=1000, y=1000, z=7})
doPlayerRemoveItem(cid, 1222, 1)
else
doPlayerSendTextMessage(cid, 22, "You need the item in order to teleport.")
end
else
doPlayerSendTextMessage(cid, 22, "You must be inside protection zone.")
end
return true
end
<talkaction words="!teleport" script="teleport.lua"/>