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

[scroll.lua] TP SCROLL FIX?!

ziomek14b

New Member
Joined
Dec 26, 2007
Messages
98
Reaction score
0
Hi, i want to have a tp scroll fixed.
Tp scroll should work anywhere even if you have pk.
Also when you press on scroll you teleport like when you press on it you dont have to wait any seconds.

This is script, if someone could fix it for me, this would be great!

local Time1 = 0
local Use1 = 0
local timecount = 0

local function exhaust(cid, storevalue, exhausttime)
-- Exhaustion function by Alreth, v1.1 2006-06-24 01:31
-- Returns 1 if not exhausted and 0 if exhausted

newExhaust = os.time()
oldExhaust = getPlayerStorageValue(cid, storevalue)
if (oldExhaust == nil or oldExhaust < 0) then
oldExhaust = 0
end
if (exhausttime == nil or exhausttime < 0) then
exhausttime = 1
end
diffTime = os.difftime(newExhaust, oldExhaust)
if (diffTime >= exhausttime or diffTime < 0) then
setPlayerStorageValue(cid, storevalue, newExhaust)
return 1
else
return 0
end
end

local function onTime1(z)
if isPlayer(z.cid) == 1 then
ppos = getPlayerPosition(z.cid)
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 1 then
stopEvent(time1)
stopEvent(Use1)
doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled Because of IN-FIGHT!")
else
if timecount > 0 then
Time1 = addEvent(onTime1, 1000, z)
end
timecount = timecount-1
doPlayerSendTextMessage(z.cid, 21, "Teleporting in " .. timecount .. " second.")
doSendMagicEffect(ppos, 53)
end
else
stopEvent(time1)
stopEvent(Use1)
end
end
local function onUse1(z)
if isPlayer(z.cid) == 1 then
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then
ppos = getPlayerPosition(z.cid)
stopEvent(time1)
if z.item.itemid == 7727 then
npos = {x=1000, y=1000, z=7}
doTeleportThing(z.cid, npos)
doPlayerSendTextMessage(z.cid, 21, "You have been Teleported.")
doSendMagicEffect(npos,40)
doSendMagicEffect(npos,10)
doSendMagicEffect(ppos,10)
stopEvent(time1)
end
else
stopEvent(time1)
doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled.")
end
end
end

function onUse(cid, item, ppos, frompos, item2, topos)
local z = {cid = cid, item = item, ppos = ppos, item2 = item2, topos = topos}
if isPremium(cid) then
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then
if (exhaust(cid, 9143, 11) > 0) then
Time1 = addEvent(onTime1, 1000, z)
Use1 = addEvent(onUse1, 11000, z)
timecount = 10
else
doPlayerSendCancel(cid, "You cannot use a teleport scroll again until you have been teleported.")
doSendMagicEffect(frompos, 2)
end
else
doPlayerSendCancel(cid, "You cannot use a teleport scroll when you are in a fight.")
doSendMagicEffect(frompos, 2)
end
else
doPlayerSendCancel(cid, "Only players with a Premium account can use teleport scroll.")
doSendMagicEffect(frompos, 2)
end
return 1
end
 
If you just whant a simple Teleport Scroll then use this one:

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
		local telePos = {x=149 , y=388 , z=7}
		doTeleportThing(cid, telePos)
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doSendMagicEffect(telePos, 10)
		doPlayerSendTextMessage(cid, 22, "You got teleported!")
	return TRUE
end
 
not tested \

PHP:
local CONFIG =
{
    {pos = {x=1000, y=1000, z=7}, lvl = 80, pa = FALSE} -- Teleport Scroll
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
   if getCreatureCondition(cid, CONDITION_INFIGHT) == 0 then
        if isPremium(cid) == CONFIG[item.actionid].pa then
            if getPlayerLevel(cid) >= CONFIG[item.actionid].lvl then
                doTeleportThing(cid,CONFIG[item.actionid].pos)
                doSendMagicEffect(getPlayerPosition(cid),10)
            else
        doCreatureSay(cid, "You cannot use a teleport scroll when you are in a fight.", TALKTYPE_ORANGE_1)
            end
        else
        doCreatureSay(cid, "Only players with a Premium account can use teleport scroll.", TALKTYPE_ORANGE_1)
        end
    else
        doCreatureSay(cid, "Only Players Level 80 or more can use this teleport scroll", TALKTYPE_ORANGE_1)
    end
    return TRUE
end
 
Last edited:
not tested \

PHP:
local CONFIG =
{
    [12850]={pos = {x=1000, y=1000, z=7}, lvl = 80, pa = FALSE}, -- Teleport Scroll
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
   if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then
        if isPremium(cid) == CONFIG[item.actionid].pa then
            if getPlayerLevel(cid) >= CONFIG[item.actionid].lvl then
                doTeleportThing(cid,CONFIG[item.actionid].pos)
                doSendMagicEffect(getPlayerPosition(cid),10)
                doRemoveItem(cid, item.uid, 1)
          else
        doCreatureSay(cid, "You cannot use a teleport scroll when you are in a fight.", TALKTYPE_ORANGE_1)
            end
        else
        doCreatureSay(cid, "Only players with a Premium account can use teleport scroll.", TALKTYPE_ORANGE_1)
        end
    else
        doCreatureSay(cid, "Only Players Level 80 can use this teleport scroll", TALKTYPE_ORANGE_1)
    end
    return TRUE
end

so the scroll will get removed :p
 
PHP:
local CONFIG =
{
    [12850]={pos = {x=1000, y=1000, z=7}, lvl = 80, pa = FALSE}, -- Teleport Scroll
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
   if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then
        if isPremium(cid) == CONFIG[item.actionid].pa then
            if getPlayerLevel(cid) >= CONFIG[item.actionid].lvl then
                doTeleportThing(cid,CONFIG[item.actionid].pos)
                doSendMagicEffect(getPlayerPosition(cid),10)
          else
        doCreatureSay(cid, "You cannot use a teleport scroll when you are in a fight.", TALKTYPE_ORANGE_1)
            end
        else
        doCreatureSay(cid, "Only players with a Premium account can use teleport scroll.", TALKTYPE_ORANGE_1)
        end
    else
        doCreatureSay(cid, "Only Players Level 80 can use this teleport scroll", TALKTYPE_ORANGE_1)
    end
    return TRUE
end
Josejunioers, just that the scroll doesn't removes.
 
PHP:
local CONFIG =
{
     [12850]={pos = {x=1000, y=1000, z=7}, lvl = 80, pa = TRUE}, -- Teleport Scroll
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
   if getCreatureCondition(cid, CONDITION_INFIGHT) == 0 then
        if isPremium(cid) == CONFIG[item.actionid].pa then
            if getPlayerLevel(cid) >= CONFIG[item.actionid].lvl then
                doTeleportThing(cid,CONFIG[item.actionid].pos)
                doSendMagicEffect(getPlayerPosition(cid),10)
                doRemoveItem(cid, item.uid, 1)
          else
        doCreatureSay(cid, "You cannot use a teleport scroll when you are in a fight.", TALKTYPE_ORANGE_1)
            end
        else
        doCreatureSay(cid, "Only players with a Premium account can use teleport scroll.", TALKTYPE_ORANGE_1)
        end
    else
        doCreatureSay(cid, "Only Players Level 80 can use this teleport scroll", TALKTYPE_ORANGE_1)
    end
    return TRUE
end

Josejunioers, just that the scroll doesn't removes.

better now d:
 
this doesnt work for me. Script should be done like when you have pz you can teleport and you dont need any level for it, also you dont have to wait any seconds to teleport. thanks
 
PHP:
local CONFIG =
{
     {pos = {x=1000, y=1000, z=7})
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
   if getCreatureCondition(cid, CONDITION_INFIGHT) == 0 then
                doTeleportThing(cid,CONFIG.pos)
                doRemoveItem(cid, item.uid, 1)
          else
        doCreatureSay(cid, "You cannot use a teleport scroll when you are in a fight.", TALKTYPE_ORANGE_1)
            end
    return TRUE
end

if it doenst work, I can't help you \:
 
This one works, tested :)
function onUse(cid, item, fromPosition, itemEx, toPosition)
local telePos = {x=714 , y=767 , z=7}
doTeleportThing(cid, telePos)
doSendMagicEffect(getPlayerPosition(cid), 10)
doSendMagicEffect(telePos, 10)
doRemoveItem(cid, item.uid, 1)
doPlayerSendTextMessage(cid, 22, "You got teleported!")
return TRUE
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
doTeleportThing(cid, {x=714 , y=767 , z=7})
doSendMagicEffect(getPlayerPosition(cid), 10)
doRemoveItem(cid, itemEx.uid, 1)
doPlayerSendTextMessage(cid, 22, "You got teleported!")
return true
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
        local telePos = {x=149 , y=388 , z=7} 
        doTeleportThing(cid, telePos) 
        doSendMagicEffect(getPlayerPosition(cid), 10) 
        doSendMagicEffect(telePos, 10) 
        doPlayerSendTextMessage(cid, 22, "You got teleported!") 
        doRemoveItem(item.uid)
    return TRUE 
end
REP++ ME IF I HELPED! :ninja:
 
Does somebody know how to make it if character have pz its not teleporting. If player doesnt have pz it will teleport in 8 seconds and is counting down ?

Repp ++
 
Post your problem, which script you use, what the problems are with that, which errors you got, which server you use etc.

Just "help" isn't really useful information.
 
Back
Top