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

TFS 1.X+ Tfs 1.4+ cid:teleportTo(fromPosition, true) doesnt work

Sprrw

Well-Known Member
Joined
Jun 22, 2021
Messages
100
Reaction score
55
Location
Sweden
As the title says, I cant get this to work.
It does tp the player if I set a fixed value instead of the fromPosition. But I just cant get it to work
Here is my code:
Lua:
function onStepIn(cid, item, fromPosition, itemEx, toPosition)
    if(cid:getStorageValue(28003) > 0) then
        if cid:isPlayer() then
            print(position.x, position.y, position.z)
            print(fromPosition.x, fromPosition.y, fromPosition.z)
            print("This area is currently locked!")
            cid:teleportTo(fromPosition, true)
        end
    end
end

I get this in console

1673711142068.png
So its just the fromPosition thing that doesnt work :( Anyone got a clue?
 
Lua:
function onStepIn(creature, item, position, fromPosition)
   local player = creature:getPlayer()
   if not player then
      return false
   end

    if player:getStorageValue(28003) > 0 then
     print(position.x, position.y, position.z)
     print(fromPosition.x, fromPosition.y, fromPosition.z)
     print("This area is currently locked!")
     player:teleportTo(fromPosition, true)
   end

      return true
end
 
Lua:
function onStepIn(creature, item, position, fromPosition)
   local player = creature:getPlayer()
   if not player then
      return false
   end

    if player:getStorageValue(28003) > 0 then
     print(position.x, position.y, position.z)
     print(fromPosition.x, fromPosition.y, fromPosition.z)
     print("This area is currently locked!")
     player:teleportTo(fromPosition, true)
   end

      return true
end
Thanks a lot for your answer, but this just gives me the same thing as before :I
 
wait, but player has the storage?
Yea I figured it out just now tho, its the rest of the script that bugs it out, not that part. Your script work like a charm! Thanks a lot! So Ima remove everything and rewrite it step by step to figure out whats bugging me :p Thanks for your time +REP!
Im not sure how I mark your msg as the best answer, Im sorry fam :(
 
Back
Top