XxDeathAvenger
New Member
- Joined
- May 5, 2011
- Messages
- 95
- Reaction score
- 2
Can someone help me make a certain item teleport me to a certain coordinate?
Help would be appreciated, thank you.
Help would be appreciated, thank you.
local config = {
[2160] = {x = 100, y = 100, z = 7}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local position = config[item.itemid]
if position == nil then
return false
end
Player(cid):teleportTo(position)
return true
end
local truepos = {x=1000, y=1000, z=7}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLevel(cid) >= Place_level_here then
doTeleportThing(cid, truepos, TRUE)
doCreatureSay(cid, "Teleported!", 19)
end
return true
end
local truepos = {x=1000, y=1000, z=7}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayerPzLocked(cid) then
doTeleportThing(cid, truepos, FALSE)
doCreatureSay(cid, "You cannot teleport while pz locked!", 19)
else
doTeleportThing(cid, truepos, TRUE)
doCreatureSay(cid, "Teleported!", 19)
end
return true
end
im not very good at scripting at all, i just started. So, im not really sure where to insert this script.
local truepos = {x=1000, y=1000, z=7} -- Position the player will be send when use
function onUse(cid, item, fromPosition, itemEx, toPosition) -- Function
if isPlayerPzLocked(cid) then -- PZlock check
doTeleportThing(cid, truepos, FALSE) -- if Pzlock it do not teleport
doCreatureSay(cid, "You cannot teleport while pz locked!", 19) - player will get msg if pz lock
else
doTeleportThing(cid, truepos, TRUE) -- if no pz lock player gets teleported
doCreatureSay(cid, "Teleported!", 19) -- player will get msg when teleport happend
end
return true
end
<action itemid="ITEMID" event="script" value="YOURSCRIPTNAME.lua"/>
local truepos = {x=351, y=198, z=7}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayerPzLocked(cid) >= 1 then
doTeleportThing(cid, truepos, FALSE)
doCreatureSay(cid, "You cannot teleport while pz locked!", 19)
end
elseif isPlayerPzLocked(cid) < 0 then
doTeleportThing(cid, truepos, TRUE)
doCreatureSay(cid, "Teleported!", 19)
end
return true
end