• 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 Help with teleport script

Legoland

Legoland OT
Joined
Mar 3, 2013
Messages
75
Reaction score
4
Location
Sweden
Hello! :D

I saw this uniqe multi - teleport scroll i wanted to use on my own server.

Developed By.. J.Dre / Sonik / Fallen / Shinmaru
Link: http://otland.net/threads/teleport-scroll-unique-version.137262/

So far in this script you can only get teleported to a few common locations made for everybody so
I want to edit the .Lua script and add "houses", which mean you get teleported to your OWN house, like a house teleportation scroll. (House tp scroll and tp scroll in one)

How do i add a function like that in this .lua Creature script?

PHP:
local t = {
["Temple"] = {pos = {x = 3000, y = 2098, z = 7}, storage = 1337, time = 30},
["Teleports"] = {pos = {x = 2815, y = 2025, z = 7}, storage = 1338, time = 30},
["Addons"] = {pos = {x = 1266, y = 880, z = 7}, storage = 1339, time = 30},
["Addon Bosses"] = {pos = {x = 1127, y = 907,z = 6}, storage = 1340, time = 30},
["Trainers"] = {pos = {x = 2877, y = 2005, z = 7}, storage = 1341, time = 30},
["Donation Quest"] = {pos = {x = 3160, y = 1572, z = 7}, storage = 1342, time = 30},
["Shops"] = {pos = {x = 2940, y = 2075, z = 7}, storage = 1343, time = 30},
["Sailors Quarter"] = {pos = {x = 3010, y = 2192, z = 6}, storage = 1344, time = 30}
}
function onTextEdit(cid, item, newText)
if item.itemid == 1949 then
if isPlayerPzLocked(cid) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end
local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end
local ti = p.time
local pos = p.pos
doTeleportThing(cid, pos, true)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
doCreatureSetStorage(cid, st, os.time() + ti)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
end
return true
end

Thank you for reading my thread, Hope you guys can help me! :D


Solution:

PHP:
function onTextEdit(cid, item, newText)
local t = {
["temple"] = {pos = {x = 1000, y = 1000, z = 7}, storage = 1440, time = 300},
["hunts"] = {pos = {x = 892, y = 1030, z = 7}, storage = 1441, time = 300},
["quests"] = {pos = {x = 862, y = 1025, z = 6}, storage = 1442, time = 300},
["trainers"] = {pos = {x = 1194, y = 1080, z = 7}, storage = 1444, time = 300}
}
if item.itemid == 1948 then
if hasCondition(cid,CONDITION_INFIGHT) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
for i,v in pairs(t) do
if getCreatureStorage(cid, v.storage) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid,v.storage) - os.time() .. ' second' .. (getCreatureStorage(cid, v.storage) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end
end

if getCreatureStorage(cid,1443) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, 1443) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end
if newText == "temple" then
doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
doCreatureSetStorage(cid, 1440, os.time() + 300)
doSendMagicEffect({x = 1000, y = 1000, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "hunts" then
doTeleportThing(cid, {x = 892, y = 1030, z = 7})
doCreatureSetStorage(cid, 1441, os.time() + 300)
doSendMagicEffect({x = 892, y = 1030, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "quests" then
doTeleportThing(cid, {x = 862, y = 1025, z = 6})
doCreatureSetStorage(cid, 1442, os.time() + 300)
doSendMagicEffect({x = 862, y = 1025, z = 6}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "house" then
doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), true)
doCreatureSetStorage(cid, 1443, os.time() + 300)
doSendMagicEffect(getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "trainers" then
doTeleportThing(cid, {x = 1194, y = 1080, z = 7})
doCreatureSetStorage(cid, 1444, os.time() + 300)
doSendMagicEffect({x = 1194, y = 1080, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
return true
end
end
return true
end
 
Last edited:
A Noobie Script But Should Work
Code:
function onTextEdit(cid, item, newText)
local t = {
["temple"] = {pos = {x = 1000, y = 1000, z = 7}, storage = 1337, time = 300},
["hunts"] = {pos = {x = 892, y = 1030, z = 7}, storage = 1338, time = 300},
["quests"] = {pos = {x = 862, y = 1025, z = 6}, storage = 1339, time = 300},
["house"] = {pos = getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), storage = 1341, time = 300},
["trainers"] = {pos = {x = 1194, y = 1080, z = 7}, storage = 1340, time = 300}
}
if item.itemid == 1948 then
if isPlayerPzLocked(cid) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end

local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

local ti = p.time
local pos = p.pos
if newText == "temple" then
doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
doCreatureSetStorage(cid, 1440, os.time() + 300)
doSendMagicEffect({x = 1000, y = 1000, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "hunts" then
doTeleportThing(cid, {x = 892, y = 1030, z = 7})
doCreatureSetStorage(cid, 1441, os.time() + 300)
doSendMagicEffect({x = 892, y = 1030, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "quests" then
doTeleportThing(cid, {x = 862, y = 1025, z = 6})
doCreatureSetStorage(cid, 1442, os.time() + 300)
doSendMagicEffect({x = 862, y = 1025, z = 6}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "house" and getHouseByPlayerGUID(getPlayerGUID(cid)) then
doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))))
doCreatureSetStorage(cid, 1443, os.time() + 300)
doSendMagicEffect(getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "trainers" then
doTeleportThing(cid, {x = 1194, y = 1080, z = 7})
doCreatureSetStorage(cid, 1444, os.time() + 300)
doSendMagicEffect({x = 1194, y = 1080, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
return true
end
end
return true
end
 
Code:
[22/01/2014 00:03:09] [Error - CreatureScript Interface]
[22/01/2014 00:03:09] data/creaturescripts/scripts/teleportpaper.lua:onTextEdit
[22/01/2014 00:03:09] Description:
[22/01/2014 00:03:09] data/lib/050-function.lua:203: attempt to index a boolean value
[22/01/2014 00:03:09] stack traceback:
[22/01/2014 00:03:09]    data/lib/050-function.lua:203: in function 'getHouseEntry'
[22/01/2014 00:03:09]    data/creaturescripts/scripts/teleportpaper.lua:6: in function <data/creaturescripts/scripts/teleportpaper.lua:1>


dont we need to put something in data/lib ?
 
Last Try
Code:
function onTextEdit(cid, item, newText)
local t = {
["temple"] = {pos = {x = 1000, y = 1000, z = 7}, storage = 1440, time = 300},
["hunts"] = {pos = {x = 892, y = 1030, z = 7}, storage = 1441, time = 300},
["quests"] = {pos = {x = 862, y = 1025, z = 6}, storage = 1442, time = 300},
["trainers"] = {pos = {x = 1194, y = 1080, z = 7}, storage = 1444, time = 300}
}
if item.itemid == 1948 then
if hasCondition(cid,CONDITION_INFIGHT) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end

local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

if getCreatureStorage(cid,1443) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

local ti = p.time
local pos = p.pos
if newText == "temple" then
doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
doCreatureSetStorage(cid, 1440, os.time() + 300)
doSendMagicEffect({x = 1000, y = 1000, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "hunts" then
doTeleportThing(cid, {x = 892, y = 1030, z = 7})
doCreatureSetStorage(cid, 1441, os.time() + 300)
doSendMagicEffect({x = 892, y = 1030, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "quests" then
doTeleportThing(cid, {x = 862, y = 1025, z = 6})
doCreatureSetStorage(cid, 1442, os.time() + 300)
doSendMagicEffect({x = 862, y = 1025, z = 6}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "house" then
doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))))
doCreatureSetStorage(cid, 1443, os.time() + 300)
doSendMagicEffect(getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "trainers" then
doTeleportThing(cid, {x = 1194, y = 1080, z = 7})
doCreatureSetStorage(cid, 1444, os.time() + 300)
doSendMagicEffect({x = 1194, y = 1080, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
return true
end
end
return true
end
 
Last edited:
everything works now, you get teleported inside of your door when its closed with the cmd "house" but thats it. :) !! So glad everything works now, haha!

the cooldown doesnt exist either, u can teleport how much u want atm..
 
the cooldown is not working atm. no :/

i have tested the scroll and the problem is u can teleport while you are in battle with a monster, the cooldown ofc and under a PK with another player do i not know... but u cant teleport while having white skull so thats good :)
 
the cooldown is working or not?

EDIT:try the old script

Cooldown works now and you want run away from battle's too! the only thing is missing now is "house" cmd !! feels great to be so close so we can end this problem! Must say you're going a great job, im impressed and jelly because im not even near your scripting skills :p haha!
 
Code:
function onTextEdit(cid, item, newText)
local t = {
["temple"] = {pos = {x = 1000, y = 1000, z = 7}, storage = 1440, time = 300},
["hunts"] = {pos = {x = 892, y = 1030, z = 7}, storage = 1441, time = 300},
["quests"] = {pos = {x = 862, y = 1025, z = 6}, storage = 1442, time = 300},
["trainers"] = {pos = {x = 1194, y = 1080, z = 7}, storage = 1444, time = 300}
}
if item.itemid == 1948 then
if hasCondition(cid,CONDITION_INFIGHT) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end

local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

if getCreatureStorage(cid,1443) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

local ti = p.time
local pos = p.pos
if newText == "temple" then
doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
doCreatureSetStorage(cid, 1440, os.time() + 300)
doSendMagicEffect({x = 1000, y = 1000, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "hunts" then
doTeleportThing(cid, {x = 892, y = 1030, z = 7})
doCreatureSetStorage(cid, 1441, os.time() + 300)
doSendMagicEffect({x = 892, y = 1030, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "quests" then
doTeleportThing(cid, {x = 862, y = 1025, z = 6})
doCreatureSetStorage(cid, 1442, os.time() + 300)
doSendMagicEffect({x = 862, y = 1025, z = 6}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "house" then
doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))))
doCreatureSetStorage(cid, 1443, os.time() + 300)
doSendMagicEffect(getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "trainers" then
doTeleportThing(cid, {x = 1194, y = 1080, z = 7})
doCreatureSetStorage(cid, 1444, os.time() + 300)
doSendMagicEffect({x = 1194, y = 1080, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
return true
end
end
return true
end
 
Last edited:
Try Now

Code:
function onTextEdit(cid, item, newText)
local t = {
["temple"] = {pos = {x = 1000, y = 1000, z = 7}, storage = 1440, time = 300},
["hunts"] = {pos = {x = 892, y = 1030, z = 7}, storage = 1441, time = 300},
["quests"] = {pos = {x = 862, y = 1025, z = 6}, storage = 1442, time = 300},
["trainers"] = {pos = {x = 1194, y = 1080, z = 7}, storage = 1444, time = 300}
}
if item.itemid == 1948 then
if hasCondition(cid,CONDITION_INFIGHT) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end

local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

if getCreatureStorage(cid,1443) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

if newText == "house" and getHouseByPlayerGUID(getPlayerGUID(cid)) then
doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))),true)
doCreatureSetStorage(cid, 1443, os.time() + 300)
doSendMagicEffect(getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
else
doCreatureSay(cid, "You Don't Own Any House", TALKTYPE_MONSTER)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

local ti = p.time
local pos = p.pos
if newText == "temple" then
doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
doCreatureSetStorage(cid, 1440, os.time() + 300)
doSendMagicEffect({x = 1000, y = 1000, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "hunts" then
doTeleportThing(cid, {x = 892, y = 1030, z = 7})
doCreatureSetStorage(cid, 1441, os.time() + 300)
doSendMagicEffect({x = 892, y = 1030, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "quests" then
doTeleportThing(cid, {x = 862, y = 1025, z = 6})
doCreatureSetStorage(cid, 1442, os.time() + 300)
doSendMagicEffect({x = 862, y = 1025, z = 6}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "trainers" then
doTeleportThing(cid, {x = 1194, y = 1080, z = 7})
doCreatureSetStorage(cid, 1444, os.time() + 300)
doSendMagicEffect({x = 1194, y = 1080, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
return true
end
end
return true
end

that didnt work.. it says "you dont own a house" whatever i type in the scroll.. quests,hunts, temple or cookies doesnt work.. dunno why i wrote cookies though but i did :p
 
Thats What I Can Do

Code:
function onTextEdit(cid, item, newText)
local t = {
["temple"] = {pos = {x = 1000, y = 1000, z = 7}, storage = 1440, time = 300},
["hunts"] = {pos = {x = 892, y = 1030, z = 7}, storage = 1441, time = 300},
["quests"] = {pos = {x = 862, y = 1025, z = 6}, storage = 1442, time = 300},
["trainers"] = {pos = {x = 1194, y = 1080, z = 7}, storage = 1444, time = 300}
}
if item.itemid == 1948 then
if hasCondition(cid,CONDITION_INFIGHT) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end

local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

if getCreatureStorage(cid,1443) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

local ti = p.time
local pos = p.pos
if newText == "temple" then
doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
doCreatureSetStorage(cid, 1440, os.time() + 300)
doSendMagicEffect({x = 1000, y = 1000, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "hunts" then
doTeleportThing(cid, {x = 892, y = 1030, z = 7})
doCreatureSetStorage(cid, 1441, os.time() + 300)
doSendMagicEffect({x = 892, y = 1030, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "quests" then
doTeleportThing(cid, {x = 862, y = 1025, z = 6})
doCreatureSetStorage(cid, 1442, os.time() + 300)
doSendMagicEffect({x = 862, y = 1025, z = 6}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "house" then
doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), true)
doCreatureSetStorage(cid, 1443, os.time() + 300)
doSendMagicEffect(getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "trainers" then
doTeleportThing(cid, {x = 1194, y = 1080, z = 7})
doCreatureSetStorage(cid, 1444, os.time() + 300)
doSendMagicEffect({x = 1194, y = 1080, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
return true
end
end
return true
end
 
Thats What I Can Do

Code:
function onTextEdit(cid, item, newText)
local t = {
["temple"] = {pos = {x = 1000, y = 1000, z = 7}, storage = 1440, time = 300},
["hunts"] = {pos = {x = 892, y = 1030, z = 7}, storage = 1441, time = 300},
["quests"] = {pos = {x = 862, y = 1025, z = 6}, storage = 1442, time = 300},
["trainers"] = {pos = {x = 1194, y = 1080, z = 7}, storage = 1444, time = 300}
}
if item.itemid == 1948 then
if hasCondition(cid,CONDITION_INFIGHT) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end

local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

if getCreatureStorage(cid,1443) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

local ti = p.time
local pos = p.pos
if newText == "temple" then
doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
doCreatureSetStorage(cid, 1440, os.time() + 300)
doSendMagicEffect({x = 1000, y = 1000, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "hunts" then
doTeleportThing(cid, {x = 892, y = 1030, z = 7})
doCreatureSetStorage(cid, 1441, os.time() + 300)
doSendMagicEffect({x = 892, y = 1030, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "quests" then
doTeleportThing(cid, {x = 862, y = 1025, z = 6})
doCreatureSetStorage(cid, 1442, os.time() + 300)
doSendMagicEffect({x = 862, y = 1025, z = 6}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "house" then
doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), true)
doCreatureSetStorage(cid, 1443, os.time() + 300)
doSendMagicEffect(getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "trainers" then
doTeleportThing(cid, {x = 1194, y = 1080, z = 7})
doCreatureSetStorage(cid, 1444, os.time() + 300)
doSendMagicEffect({x = 1194, y = 1080, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
return true
end
end
return true
end


okay .. with this script - the problems is u can teleport 1x to every location and cmd "house" says Invalid location.. :/
 
Code:
function onTextEdit(cid, item, newText)
local t = {
["temple"] = {pos = {x = 1000, y = 1000, z = 7}, storage = 1440, time = 300},
["hunts"] = {pos = {x = 892, y = 1030, z = 7}, storage = 1441, time = 300},
["quests"] = {pos = {x = 862, y = 1025, z = 6}, storage = 1442, time = 300},
["trainers"] = {pos = {x = 1194, y = 1080, z = 7}, storage = 1444, time = 300}
}
if item.itemid == 1948 then
if hasCondition(cid,CONDITION_INFIGHT) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
local p = t[newText]

local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

if getCreatureStorage(cid,1443) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end

local ti = p.time
local pos = p.pos
if newText == "temple" then
doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
doCreatureSetStorage(cid, 1440, os.time() + 300)
doSendMagicEffect({x = 1000, y = 1000, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "hunts" then
doTeleportThing(cid, {x = 892, y = 1030, z = 7})
doCreatureSetStorage(cid, 1441, os.time() + 300)
doSendMagicEffect({x = 892, y = 1030, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "quests" then
doTeleportThing(cid, {x = 862, y = 1025, z = 6})
doCreatureSetStorage(cid, 1442, os.time() + 300)
doSendMagicEffect({x = 862, y = 1025, z = 6}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "house" then
doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), true)
doCreatureSetStorage(cid, 1443, os.time() + 300)
doSendMagicEffect(getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "trainers" then
doTeleportThing(cid, {x = 1194, y = 1080, z = 7})
doCreatureSetStorage(cid, 1444, os.time() + 300)
doSendMagicEffect({x = 1194, y = 1080, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
return true
end
end
return true
end
 
Code:
[22/01/2014 11:03:01] [Error - CreatureScript Interface]
[22/01/2014 11:03:01] data/creaturescripts/scripts/teleportpaper.lua:onTextEdit
[22/01/2014 11:03:01] Description:
[22/01/2014 11:03:01] data/creaturescripts/scripts/teleportpaper.lua:23: attempt to index local 'p' (a nil value)
[22/01/2014 11:03:01] stack traceback:
[22/01/2014 11:03:01]    data/creaturescripts/scripts/teleportpaper.lua:23: in function <data/creaturescripts/scripts/teleportpaper.lua:1>

and no respons ingame at all from it.. :/
 
Code:
function onTextEdit(cid, item, newText)
local t = {
["temple"] = {pos = {x = 1000, y = 1000, z = 7}, storage = 1440, time = 300},
["hunts"] = {pos = {x = 892, y = 1030, z = 7}, storage = 1441, time = 300},
["quests"] = {pos = {x = 862, y = 1025, z = 6}, storage = 1442, time = 300},
["trainers"] = {pos = {x = 1194, y = 1080, z = 7}, storage = 1444, time = 300}
}
if item.itemid == 1948 then
if hasCondition(cid,CONDITION_INFIGHT) then
doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locations', 'places', 'place'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
else
for i,v in pairs(t) do
if getCreatureStorage(cid, v.storage) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid,v.storage) - os.time() .. ' second' .. (getCreatureStorage(cid, v.storage) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end
end

if getCreatureStorage(cid,1443) > os.time() then
doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, 1443) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
return true
end
if newText == "temple" then
doTeleportThing(cid, {x = 1000, y = 1000, z = 7})
doCreatureSetStorage(cid, 1440, os.time() + 300)
doSendMagicEffect({x = 1000, y = 1000, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "hunts" then
doTeleportThing(cid, {x = 892, y = 1030, z = 7})
doCreatureSetStorage(cid, 1441, os.time() + 300)
doSendMagicEffect({x = 892, y = 1030, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "quests" then
doTeleportThing(cid, {x = 862, y = 1025, z = 6})
doCreatureSetStorage(cid, 1442, os.time() + 300)
doSendMagicEffect({x = 862, y = 1025, z = 6}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "house" then
doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), true)
doCreatureSetStorage(cid, 1443, os.time() + 300)
doSendMagicEffect(getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid))), CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
elseif newText == "trainers" then
doTeleportThing(cid, {x = 1194, y = 1080, z = 7})
doCreatureSetStorage(cid, 1444, os.time() + 300)
doSendMagicEffect({x = 1194, y = 1080, z = 7}, CONST_ME_TELEPORT)
doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
end
return true
end
end
return true
end
 
you did it! :D Thank you so much for your help!!!
cooldown = works
common teleport places = hunts, quests,temple and trainers works
house = works
and when you're in battle it doesnt work!

PERFECT!!
 
Back
Top