TP wand para GM/GOD
TFS 1.x: http://i.imgur.com/ui2T1AV.mp4
<action itemid="12318" script="tpwand.lua" allowfaruse="1" blockwalls="0" checkfloor="0"/>
function spellTP(cid, frompos, topos)
Player(cid):teleportTo(topos)
local f = Position(frompos)
local t = Position(topos)
t:sendMagicEffect(CONST_ME_PURPLEENERGY)
t:sendMagicEffect(CONST_ME_ENERGYAREA)
f:sendMagicEffect(CONST_ME_PURPLEENERGY)
f:sendMagicEffect(CONST_ME_ENERGYAREA)
end
function onUse(player, item, frompos, item2, topos)
if not(player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER or player:getGroup():getAccess()) then
return false
end
local cid = player:getId()
local i = getThingPos(item2.uid)
if i.x > 0 and i.x < 65000 and i.y > 0 and i.y < 65000 then
if player:isInGhostMode() then
player:teleportTo(i)
return true
else
local f = player:getPosition()
Position(f):sendMagicEffect(CONST_ME_THUNDER)
Position(i):sendMagicEffect(CONST_ME_THUNDER)
addEvent(spellTP, 500, cid, f, i)
return true
end
end
return false
end
TFS 0.4: http://i.imgur.com/2r7zErz.mp4
<action itemid="12318" event="script" value="tpwand.lua" allowfaruse="1" blockwalls="0" checkfloor="0"/>
function spellTP(cid, frompos, topos)
doTeleportThing(cid, topos)
doSendMagicEffect(topos, CONST_ME_PURPLEENERGY)
doSendMagicEffect(topos, CONST_ME_ENERGYAREA)
doSendMagicEffect(frompos, CONST_ME_PURPLEENERGY)
doSendMagicEffect(frompos, CONST_ME_ENERGYAREA)
end
function onUse(cid, item, frompos, item2, topos)
if getPlayerAccess(cid) < 3 then
return false
end
local i = getThingPos(item2.uid)
if i.x > 0 and i.x < 65000 and i.y > 0 and i.y < 65000 then
if isPlayerGhost(cid) then
doTeleportThing(cid, i)
return true
else
local f = getThingPos(cid)
doSendMagicEffect(f, CONST_ME_POFF)
doSendMagicEffect(i, CONST_ME_POFF)
addEvent(spellTP, 500, cid, f, i)
return true
end
end
return false
end