• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Diablo 2 teleport

beliar34

Member
Joined
Feb 28, 2012
Messages
307
Solutions
7
Reaction score
11
Code:
function onUse(cid, item, frompos, item2, topos)
local temple = getPlayerMasterPos(cid)
if hasCondition(cid, CONDITION_INFIGHT) == false then
if getPlayerStorageValue(cid, 80000) == 0 then
doSendMagicEffect(temple, 41)
setPlayerStorageValue(cid,80001,frompos)
setPlayerStorageValue(cid,80000,1)
doSendMagicEffect(temple, 41)
doTeleportThing(cid,temple)
doSendMagicEffect(temple, 41)
elseif getPlayerStorageValue(cid, 80000) == 1 then
doTeleportThing(cid, getPlayerStorageValue(cid, 80001))
setPlayerStorageValue(cid,80000,0)
end
else
doPlayerSendCancel(uid,"You can't use this scroll if you've in fight or get skull")
end
end

Teleport to temple but dont teleport back to exp, tfs 0.3.5, no errors in console
 
Solution
Code:
function onUse(cid, item, frompos, item2, topos)
    local temple = getPlayerMasterPos(cid)
    local graczpos = getPlayerPosition(cid)
    if hasCondition(cid, CONDITION_INFIGHT) == false then
    if ((getPlayerStorageValue(cid, 80000) == 0) or (getPlayerStorageValue(cid, 80000) == -1)) then
            setPlayerStorageValue(cid,80001,graczpos.x)
            setPlayerStorageValue(cid,80002,graczpos.y)
            setPlayerStorageValue(cid,80003,graczpos.z)
            setPlayerStorageValue(cid,80000,1)
            doTeleportThing(cid,temple)
            doSendMagicEffect(temple, 41)
        elseif getPlayerStorageValue(cid, 80000) == 1 then
            doTeleportThing(cid, {x = getPlayerStorageValue(cid, 80001), y =...
LUA:
function onUse(cid, item, frompos, item2, topos)
    local temple = getPlayerMasterPos(cid)
    if hasCondition(cid, CONDITION_INFIGHT) == false then
        if getPlayerStorageValue(cid, 80000) == 0 then
            setPlayerStorageValue(cid,80001,frompos.x)
            setPlayerStorageValue(cid,80002,frompos.y)
            setPlayerStorageValue(cid,80003,frompos.z)
            setPlayerStorageValue(cid,80000,1)
            doTeleportThing(cid,temple)
            doSendMagicEffect(temple, 41)
        elseif getPlayerStorageValue(cid, 80000) == 1 then
            doTeleportThing(cid, {x = getPlayerStorageValue(cid, 80001), y = getPlayerStorageValue(cid, 80002), z = getPlayerStorageValue(cid, 80003)})
            setPlayerStorageValue(cid,80000,0)
        end
    else
        doPlayerSendCancel(uid,"You can't use this scroll if you've in fight or get skull")
    end
end
 
Last edited:
Code:
function onUse(cid, item, frompos, item2, topos)
    local temple = getPlayerMasterPos(cid)
    local graczpos = getPlayerPosition(cid)
    if hasCondition(cid, CONDITION_INFIGHT) == false then
    if ((getPlayerStorageValue(cid, 80000) == 0) or (getPlayerStorageValue(cid, 80000) == -1)) then
            setPlayerStorageValue(cid,80001,graczpos.x)
            setPlayerStorageValue(cid,80002,graczpos.y)
            setPlayerStorageValue(cid,80003,graczpos.z)
            setPlayerStorageValue(cid,80000,1)
            doTeleportThing(cid,temple)
            doSendMagicEffect(temple, 41)
        elseif getPlayerStorageValue(cid, 80000) == 1 then
            doTeleportThing(cid, {x = getPlayerStorageValue(cid, 80001), y = getPlayerStorageValue(cid, 80002), z = getPlayerStorageValue(cid, 80003)})
            setPlayerStorageValue(cid,80000,0)
        end
    else
        doCreatureSay(cid, "Cant teleport with PZ.", TALKTYPE_ORANGE_1)
    end
end

Working code :)
 
Solution
Back
Top