• 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 [TFS 1.2] Change floor talk action

guiismiti

Well-Known Member
Joined
May 19, 2014
Messages
315
Solutions
3
Reaction score
68
Hello again,

I'm trying to add a parameter to my change floor talkaction - I want to be able to go up or down more than once at a time.
This is the code I'm using for the up function, and it's not working, I'm stuck and couldn't find related threads in the forum.

Code:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
  
    local n = 1
    if(param ~= '') then
        n = math.max(0, tonumber(param))
    end
  
    local position = player:getPosition()
    position.z = position.z - n
    player:teleportTo(position)
    return false
end

So, /up takes me up one floor, but /up 2 or /up, 2 does not take me anywhere.
Does anybody know why? I've got no errors or warnings from the console.
 
Try playing with this.. still at work.. sneaking this one in.. :p
Code:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
   
    local position = player:getPosition()
    position.z = (tonumber(param) < 1 ) and position.z - 1 or position.z - tonumber(param)
    player:teleportTo(position)
    return false
end
 
Wasn't you retired? I saw u blaming and insulting the otland community on a thread!! None of ur scripts actually works anyway Huheueheuheuehue!!!
Then why do you bother copy and pasting them into your server?

Edit:
I just want to tell you, I don't care what you think of me or what you have to say, at least I make an attempt to try to and help others or learn from my mistakes, all you seem to do is remain clueless and ignorant, being a premium account doesn't mean squat..

Bye bye attention seeker :)
 
Last edited:
There's no need to be hostile towards one another. You could have sent that in private, if you really needed to speak with him regarding his previous behaviour, warranted or not.

@Topic.
@guiismiti

I copied then edited this script for tfs 0.3.7 years ago.
I believe it should provide you with everything your looking for.
Code:
function onSay(cid, words, param, channel)
   local n = 1
   if(param ~= '' and tonumber(param)) then
     n = math.max(0, tonumber(param))
   end

   local tmp, pos = getCreaturePosition(cid), getCreaturePosition(cid)
   if(words:sub(2, 2) == "u") then
     pos.z = pos.z - n
   else
     pos.z = pos.z + n
   end

   pos = getClosestFreeTile(cid, pos, false, false)
   if(not pos or isInArray({pos.x, pos.y}, 0)) then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
     return true
   end

   if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then
     doSendMagicEffect(tmp, CONST_ME_POFF)
     doSendMagicEffect(pos, CONST_ME_TELEPORT)
   end

   return true
end
 
Last edited:
I had to remove the getClosestFreeTile function, since it's not in TFS 1.2.

Still won't work and I have no idea why.
That's the code I was using when I used TFS 0.3.7.
 
Hello again,

I'm trying to add a parameter to my change floor talkaction - I want to be able to go up or down more than once at a time.
This is the code I'm using for the up function, and it's not working, I'm stuck and couldn't find related threads in the forum.

Code:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
 
    local n = 1
    if(param ~= '') then
        n = math.max(0, tonumber(param))
    end
 
    local position = player:getPosition()
    position.z = position.z - n
    player:teleportTo(position)
    return false
end

So, /up takes me up one floor, but /up 2 or /up, 2 does not take me anywhere.
Does anybody know why? I've got no errors or warnings from the console.

Did you put separator=" " in the XML tag?
 
Back
Top