• 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!

Solved Teleporting script

Baneczek

うさちゃん
Joined
Nov 13, 2013
Messages
70
Reaction score
4
Location
Pila, Poland
Hello guys, i need some help. I wrote a script, that teleports me and my target when i say "teleportnow".
It works ok, but it also teleports me alone, when i don't have any target.
Could you please help me? What should i do with it to not teleport me when i don't have any target?
Here is a script:

Code:
function onSay(cid, words, param, channel)

local teleport = { x = 488, y = 431, z = 7 }
local teleport2 = { x = 488, y = 432, z = 7 }
local cel = getCreatureTarget(cid)
local nazwa = getCreatureName(getCreatureTarget(cid))

if getCreatureName(cel) == nazwa then

doTeleportThing(cid, teleport2)
doTeleportThing(cel, teleport)

else
doPlayerSendCancel(cid,"Error")
end

return true
end
 
Code:
function onSay(cid, words, param, channel)
local teleport = { x = 861, y = 590, z = 7 }
local teleport2 = { x = 861, y = 591, z = 7 }
local target = getCreatureTarget(cid)
if target ~= 0 then
doTeleportThing(cid, teleport2)
doTeleportThing(target, teleport)
else
doPlayerSendCancel(cid,"Error")
end
return true
end
 
Code:
function onSay(cid, words, param, channel)
local teleport = { x = 861, y = 590, z = 7 }
local teleport2 = { x = 861, y = 591, z = 7 }
local target = getCreatureTarget(cid)
if target ~= 0 then
doTeleportThing(cid, teleport2)
doTeleportThing(target, teleport)
else
doPlayerSendCancel(cid,"Error")
end
return true
end
Well lol. Thank you so much dude. Didn't think it could be that easy to solve. Easiest solutions come to mind very late.

And i also have 1 more question. Is there any way, to make this script send me and the target back in a 10 second delay to positions where i used "teleportnow" ?

I thought about AddEvent, but it didn't work.
 
Well lol. Thank you so much dude. Didn't think it could be that easy to solve. Easiest solutions come to mind very late.

And i also have 1 more question. Is there any way, to make this script send me and the target back in a 10 second delay to positions where i used "teleportnow" ?

I thought about AddEvent, but it didn't work.
Code:
local function teleportback(cid, target, mypos, targetpos)
doTeleportThing(cid, mypos)
doTeleportThing(target, targetpos)
end

function onSay(cid, words, param, channel)
local target = getCreatureTarget(cid)
local teleport = { x = 861, y = 590, z = 7 }
local teleport2 = { x = 861, y = 591, z = 7 }
if target ~= 0 then
local targetpos = getCreaturePosition(target)
local mypos = getCreaturePosition(cid)
doTeleportThing(cid, teleport2)
doTeleportThing(target, teleport)
addEvent(teleportback,10000,cid, target, mypos, targetpos)
else
doPlayerSendCancel(cid,"Error")
end
return true
end
 
Code:
local function teleportback(cid, target, mypos, targetpos)
doTeleportThing(cid, mypos)
doTeleportThing(target, targetpos)
end

function onSay(cid, words, param, channel)
local target = getCreatureTarget(cid)
local teleport = { x = 861, y = 590, z = 7 }
local teleport2 = { x = 861, y = 591, z = 7 }
if target ~= 0 then
local targetpos = getCreaturePosition(target)
local mypos = getCreaturePosition(cid)
doTeleportThing(cid, teleport2)
doTeleportThing(target, teleport)
addEvent(teleportback,10000,cid, target, mypos, targetpos)
else
doPlayerSendCancel(cid,"Error")
end
return true
end


Thank you. You're the best dude. I didn't know how to build AddEvent.
 
Back
Top