local skulls = {
white = SKULL_WHITE,
red = SKULL_RED,
black = SKULL_BLACK
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getTownTemplePosition(getPlayerTown(cid))
if(not isInArray(skulls, getCreatureSkullType(cid))) then
if(not isPlayerPzLocked(cid)) then
doTeleportThing(cid, pos)
doSendMagicEffect(pos, CONST_ME_ENERGYAREA)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been teleported.")
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "You cannot teleport while in a fight.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
else
doPlayerSendCancel(cid, "You cannot teleport because you are skulled.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
return true
end
<action itemid="SCROLL_ID_HERE" event="script" value="SCRIPT_NAME.lua"/>
local skulls = {
white = SKULL_WHITE,
red = SKULL_RED,
black = SKULL_BLACK
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local compareTime = 20*60 --20 minutes
local currentValue = getPlayerStorageValue(cid, 30000)
local pos = getTownTemplePosition(getPlayerTown(cid))
if(not isInArray(skulls, getCreatureSkullType(cid))) then
if(not getCreatureCondition(cid, 1024)) then
if(os.time() - currentValue) >= compareTime then
currentValue = os.time()
doTeleportThing(cid, pos)
doSendMagicEffect(pos, CONST_ME_ENERGYAREA)
setPlayerStorageValue(cid, 30000, os.time())
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been teleported.\nYou can teleport again in 20 minutes.")
elseif (os.time() - currentValue) < compareTime then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can't teleport right now, be patient!")
end
else
doPlayerSendCancel(cid, "You cannot teleport while in a fight.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
else
doPlayerSendCancel(cid, "You cannot teleport because you are skulled.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
return true
end