• 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 [HELP] Teleport with time restriction problem, please help and i Rep++!

DanneZ

Web-Scripting-Design-Host
Joined
Jan 16, 2010
Messages
84
Reaction score
2
Location
Sweden
I need help to find out why this is not working!

Im using TFS 0.2.7 if thats for any help.

Quest.lua
local teleportItems = {
[13379] = {
position = {x=857, y=724, z=6},
backPosition = {x=857, y=722, z=6},
message = "Welcome to the Quest, you only have 20 minutes."},
backMessage = "You were too slow, try again!"},
timer = 10 * 60 * 1000
},
[1001] =
position = {x=100, y=100, z=7},
backPosition = {x=100, y=100, z=7},
message = "Welcome somewhere!"},
backMessage = "Your visit has been finished!"},
timer = 30 * 60 * 1000
}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local teleport = teleportItems[item.uid]
if(not teleport) then
return FALSE
end

doTeleportThing(cid, teleport.position)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
if(teleport.message) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, teleport.message)
end

if(teleport.timer) then
addEvent(teleportBack, teleport.timer, cid, item.uid)
end
return TRUE
end

function teleportBack(cid, id)
if(isPlayer(cid) == FALSE) then
return
end

local teleport = teleportItems[id]

doTeleportThing(cid, teleport.position)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

if(teleport.backMessage) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, teleport.backMessage)
end
end
Orginal Post: Add two actions - Nacke Post

I dont need both actions, but I could not find anything better.
So if you need you can remove this part:
[1001] =
position = {x=100, y=100, z=7},
backPosition = {x=100, y=100, z=7},
message = "Welcome somewhere!"},
backMessage = "Your visit has been finished!"},
timer = 30 * 60 * 1000
}

Actions.xml
<action itemid="13379" script="Quest.lua"/>


Errors when reloading actions.
[21/01/2011 12:06:12] Warning: [Event::checkScript] Can not load script. /scripts/Quest.lua
[21/01/2011 12:06:12] data/actions/scripts/Quest.lua:7: unexpected symbol near '='

No errors when pressing the door.

This is the settings of the door.
doorz.png



Ofc I will Rep++ You if you help, Thanks for your time.

Yours DanneZ.
 
replace the begining with that:

Lua:
local teleportItems = {
    [13379] = {
        position = {x=857, y=724, z=6},
        backPosition = {x=857, y=722, z=6},
        message = "Welcome to the Quest, you only have 20 minutes.",
        backMessage = "You were too slow, try again!",
        timer = 10 * 60 * 1000
    },
    [1001] =
        position = {x=100, y=100, z=7},
        backPosition = {x=100, y=100, z=7},
        message = "Welcome somewhere!",
        backMessage = "Your visit has been finished!",
        timer = 30 * 60 * 1000
    }
}


Just a little question maybe it helps you.
 
Last edited:
Back
Top