I ended up with this guys. Use it if you need it.
function onUse(cid, item, frompos, item2, topos)
local telepos = {x=513, y=844, z=7}
if isPlayerPzLocked(cid) or (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
doPlayerSendCancel(cid,"You can not teleport while in combat.")...