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

Command: Cliport (TFS 1.0)

Enok

return x<min and min or(x>max and max or x)end
Joined
Jun 16, 2014
Messages
3
Reaction score
0
Add 'CLIPORT = false' to global.lua

Make a cliport.lua in data/talkactions/scripts and add this code http://pastebin.com/MvgYazVC

Add this to talkactions.xml <talkaction words="/cliport" separator=" " script="cliport.lua" />

Replace the onLook() function in data/events/scripts/player.lua with http://pastebin.com/QHBBYQiK

/cliport ingame will toggle it to either on or off. When it's on you'll teleport to things instead of looking at them and when it's off you'll recieve the normal description.

Very simple, very handy. I've been poking around the forum and I've seen a few things regarding this but nothing of acual value. Someone stated that it was impossible without modifying the server's source - whatever you were smoking, give it here please.
 
Last edited:
Ooooops, once a GM had typed /cliport, everyone could clickport! Fixed it anyhow.
 
how about wand?
Code:
function spellTP(cid, frompos, topos)
   Player(cid):teleportTo(topos)
   Position(topos):sendMagicEffect(CONST_ME_PURPLEENERGY)
   Position(topos):sendMagicEffect(CONST_ME_ENERGYAREA)
   Position(frompos):sendMagicEffect(CONST_ME_PURPLEENERGY)
   Position(frompos):sendMagicEffect(CONST_ME_ENERGYAREA)
end


function onUse(cid, item, frompos, item2, topos)
   if Player(cid):getAccountType() < ACCOUNT_TYPE_GOD then
     return false
   end
   
   local p = Player(cid)
   local i = getThingPos(item2.uid)
   if i.x > 0 and i.x < 65000 and i.y > 0 and i.y < 65000 then
     if p:isInGhostMode() then
       p:teleportTo(i)
       return true
     else
       local f = getThingPos(cid)
       Position(f):sendMagicEffect(CONST_ME_THUNDER)
       Position(i):sendMagicEffect(CONST_ME_THUNDER)
       addEvent(spellTP, 500, cid, f, i)
       return true
     end
   end   
return false
end
allowfaruse in actions.xml has to be 1
 
Oh, allowfaruse can come in handy, I didn't know you could do that, sweet. I feel it's inconvenient to add that kind of functionality to an item, but then again it is also pretty inconvenient to have it in a global event.. I'm looking into adding some kind of onMapclick to the source, though the lack of uncommented code in that project is highly disturbing.
 
how about multi-floor?
Code:
<action itemid="12318" script="admin_tp.lua" allowfaruse="1" blockwalls="0" checkFloor="0"/>
 
Add 'CLIPORT = false' to global.lua

Make a cliport.lua in data/talkactions/scripts and add this code [Lua] cliport.lua - Pastebin.com

Add this to talkactions.xml <talkaction words="/cliport" separator=" " script="cliport.lua" />

Replace the onLook() function in data/events/scripts/player.lua with [Lua] player.lua - Pastebin.com

/cliport ingame will toggle it to either on or off. When it's on you'll teleport to things instead of looking at them and when it's off you'll recieve the normal description.

Very simple, very handy. I've been poking around the forum and I've seen a few things regarding this but nothing of acual value. Someone stated that it was impossible without modifying the server's source - whatever you were smoking, give it here please.

It's a nice contribution mate, but I found a bug (Using TFS 1.2 and 10.95). Can't look anything if I replace my onLook function to the one of your post. It's pretty easy to fix:

Replace this in the onLook function you provide:
Lua:
    if(self:getAccountType() < ACCOUNT_TYPE_GOD) then
        self:sendTextMessage(MESSAGE_INFO_DESCR, description)
    else
        if(CLIPORT) then
            self:teleportTo(position)
            return false
        end
    end

with this:

Lua:
    if(CLIPORT and self:getAccountType() == ACCOUNT_TYPE_GOD) then
        self:teleportTo(position)
        return false
    else
        self:sendTextMessage(MESSAGE_INFO_DESCR, description)
    end
 
Back
Top