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

Lua doTeleportThing on addEvent

MadMOOK

Hoo
Joined
Apr 20, 2011
Messages
802
Reaction score
44
Code:
Function onStepIn(stuff)
AddEvent(goHome, 10000)
Return true end
Code:
Function goHome()
DoTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
Return true end
Error says thing not found.
What do i add to get it to find player that activated movement?
 
Use

function goHome(cid)
And
AddEvent(goHome, 10000, cid)

Update
Forgot one thing jut added haha
 
Last edited:
Code:
function onStepIn(cid, item, position, fromPosition)
    addEvent(doTeleportThing, 10000, cid, getTownTemplePosition(getPlayerTown(cid)))
    return true
end
 
Code:
function onStepIn(cid, item, position, fromPosition)
addEvent(function(cid, pos) if not isPlayer(cid) then return true end doTeleportThing(cid, pos) end, 10000, cid, getTownTemplePosition(getPlayerTown(cid)))
return true
end
 
Code:
function onStepIn(cid, item, position, fromPosition)
    addEvent(doTeleportThing, 10000, cid, getTownTemplePosition(getPlayerTown(cid)))
    return true
end
Code:
function onStepIn(cid, item, position, fromPosition)
addEvent(function(cid, pos) if not isPlayer(cid) then return true end doTeleportThing(cid, pos) end, 10000, cid, getTownTemplePosition(getPlayerTown(cid)))
return true
end
Is it more efficient to do it this way or something? I've always been more comfortable doing it the way he's doing it and it feels more organized, but if it's better I will deffinately switch.
 
If he only wants to call a single function I do not think that it is needed to name a function for that.
If you want to do more stuff it might be clever to define a function out of local scope to make it more readable.
 
Back
Top