• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Teleport spell

theroyal

Wassup :)
Joined
Oct 22, 2009
Messages
372
Reaction score
6
can some one make me a teleport spell that when you cast it you will be teleported to a possition of my choose and it will have 10 minutes cooldown before you can use it again
i'll be very gratefull.
 
Lua:
local pos = {x=100, y=100, z=7}

function onCastSpell(cid, var)
	if not exhaustion.check(cid, 123) then
		exhaustion.set(cid, 123, 600)
		local p = getThingPos(cid)
		doTeleportThing(cid, pos)
		doSendMagicEffect(p, CONST_ME_TELEPORT)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
		return true
	end
	doPlayerSendCancel(cid, 'Cooldown[' .. exhaustion.get(cid, 123) .. ']')
end
 
@Cyko: a question....
why you: local p = getThinPos(cid)???
because i think u can do
doSendMagicEffect(cid, CONST_ME_TELEPORT)
doTeleportThing(cid, pos)
doSendMagicEffect(cid, CONST_ME_TELEPORT) or doSendMagicEffect(pos, CONST_ME_TELEPORT)

Only a doubt.... xD
 
because of a networking efficiency reason.

yea i could've used this
Lua:
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, pos)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
but then the effect would get sent at player's old position BEFORE he/she got teleported, resulting in wasted bytes (TFS would to send the effect to the player anyway)
 
Back
Top