• 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 Player teleport function help.

Croow

learning LUA :)
Joined
Aug 17, 2015
Messages
25
Reaction score
4
Hello I wrote this simple script:
Code:
function onStepIn(cid, item)
if item.actionid == 8000 then
doPlayerSetVocation(cid,1)
   else
       doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You have chosen fire emblemant!")
   end
   return 1
end

but I don't have idea how I can do that player will be also teleported to x.y.z positon.
Can someone help me add it to the script? I will appreciate it.
 
Last edited:
Code:
local newpos = {x = xxx, y = xxx, z = xx} --New position
function onStepIn(cid, item)
if item.actionid == 8000 then
doPlayerSetVocation(cid,1)
doTeleportThing(cid, newpos)
doSendMagicEffect(newpos,10)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You have chosen fire emblemant!")
end
return 1
end
 
well I used
Code:
doTeleportPlayer(cid)
instead of
Code:
doTeleportThing(cid)
that's the reason that my one didin't work.. Anyway thank you very much. @heba
 
Code:
    local c = {
        voc = 1, -- vocation to change them to
        effect = 10, -- the magic effect
        sendTo = {x = xxx, y = xxx, z = xx}, -- New position
        msg = {
            "You have chosen fire emblemant!", -- msg 1
            "You have already chosen the fire emblemant" -- msg 2
        }
    }
   
    function onStepIn(cid, item)
        local vocation = getPlayerVocation(cid)
        if item.actionid == 8000 and vocation ~= c.voc then
            doPlayerSetVocation(cid, c.voc)
            doTeleportThing(cid, c.sendTo)
            doSendMagicEffect(c.sendTo, c.effect)
        end
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, vocation ~= c.voc and c.msg[1] or c.msg[2])
        return true
    end
 
Back
Top