Maniucza
~Lua~ Noob
Hi, I present to you the script that teleports to different locations 4 after 5 seconds, for example, the first position and wait five seconds for the second, etc.
Data/Actions/NAME.lua
Data/actions.xml
Data/Actions/NAME.lua
Lua:
local config =
{
positions =
{
[1] = {x = 1000, y = 1000, z = 7},
[2] = {x = 1002, y = 994, z = 7},
[3] = {x = 1043, y = 981, z = 7},
[4] = {x = 1000, y = 1003, z = 7}
},
timeToTeleport = 5,
freezAfterTeleport = false
}
local function teleportAfterTime(cid, i)
if(i == 0) then
if(config.freezAfterTeleport == true) then
doCreatureSetNoMove(cid, false)
end
return true
end
if(config.freezAfterTeleport == true) then
doCreatureSetNoMove(cid, true)
end
doTeleportThing(cid, config.positions[i])
addEvent(teleportAfterTime, config.timeToTeleport * 1000, cid, i-1)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(isPlayer(itemEx.uid) == false or getCreatureName(cid) ~= getCreatureName(itemEx.uid)) then
return false
end
teleportAfterTime(cid, #config.positions)
return true
end
Data/actions.xml
Lua:
<action itemid="XXXX" event="script" value="NAME.lua"/>
Last edited: