• 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 Help! People are entering inside others dp (pz)

1268995

Member
Joined
Sep 9, 2010
Messages
422
Reaction score
13
Hello guys, o have a bug on my otserver.

People can enter inside other people and steal their item on depot.

How can i solve that? I still want that people can pass throw others inside a PZ ZONE, but NOT ON DEPOT!

IDK if it can help, but the item of dp tile =
glowing switch.
ItemID: [11059]
 
Code:
if fromPosition.x == 0 or (fromPosition.x == position.x and fromPosition.y == position.y) then
     fromPosition = getTownTemplePosition(getPlayerTown(cid))
end
Under: if getTileInfo(position).creatures > 1 then
do what limos said, in the movement script just add else then the code limos put :p

I did:

Code:
function onStepIn(cid, item, position, fromPosition)

    if getTileInfo(position).creatures > 1 then
        doTeleportThing(cid, fromPosition, false)
    end
   
    if fromPosition.x == 0 or (fromPosition.x == position.x and fromPosition.y == position.y) then
        fromPosition = getTownTemplePosition(getPlayerTown(cid))
    end
       
end

And the problem still... When i log out, when i log in again i still on the tile of depot, so i can take itens of other player.
 
Under this line: if getTileInfo(position).creatures > 1 then
So right under it, it should be above doTeleportThing.
 
Under this line: if getTileInfo(position).creatures > 1 then
So right under it, it should be above doTeleportThing.

OH okey. The right code is:

Code:
function onStepIn(cid, item, position, fromPosition)

    if getTileInfo(position).creatures > 1 then
   
            if fromPosition.x == 0 or (fromPosition.x == position.x and fromPosition.y == position.y) then
            fromPosition = getTownTemplePosition(getPlayerTown(cid))
            end
           
        doTeleportThing(cid, fromPosition, false)
    end
          
end

Worked! But people are being teleported to his town temple.

Is there possible to teleport people 1sqm above? or 1 sqm left/right/down?
 
Code:
local p = getCreaturePosition(cid)
local pp = {
     {x = p.x + 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x - 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x, y = p.y + 1, z = p.z, stackpos = 0},
     {x = p.x, y = p.y - 1, z = p.z, stackpos = 0}
}
for x = 1, #pp do
     local thing = getThingFromPos(pp[x], false).uid
     if thing ~= 0 and not hasItemProperty(thing, CONST_PROP_BLOCKSOLID) then
         fromPosition = pp[x]
     end
end
 
Last edited:
Code:
local p = getCreaturePosition(cid)
local pp = {
     {x = p.x + 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x - 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x, y = p.y + 1, z = p.z, stackpos = 0},
     {x = p.x, y = p.y - 1, z = p.z, stackpos = 0}
}
for x = 1, #pp do
     local thing = getThingFromPos(pp[x], false).uid
     if thing ~= 0 and not hasItemProperty(thing, CONST_PROP_BLOCKSOLID) then
         fromPosition = pp[x]
     end
end

Thanks for the code but idk where to put it.

maybe:

Code:
local p = getCreaturePosition(cid)
local pp = {
     {x = p.x + 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x - 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x, y = p.y + 1, z = p.z, stackpos = 0},
     {x = p.x, y = p.y - 1, z = p.z, stackpos = 0}
}
for x = 1, #pp do
     local thing = getThingFromPos(pp[x], false).uid
     if thing ~= 0 and not hasItemProperty(thing, CONST_PROP_BLOCKSOLID) then
         fromPosition = pp[x]
     end
end

function onStepIn(cid, item, position, fromPosition)

    if getTileInfo(position).creatures > 1 then
  
            if fromPosition.x == 0 or (fromPosition.x == position.x and fromPosition.y == position.y) then
            fromPosition = getTownTemplePosition(getPlayerTown(cid))
            end
          
        doTeleportThing(cid, fromPosition, false)
    end
         
end
 
Instead of fromPosition = getTownTemplePosition(getPlayerTown(cid))

This way:

Code:
function onStepIn(cid, item, position, fromPosition)

if getTileInfo(position).creatures > 1 then

local p = getCreaturePosition(cid)
local pp = {
{x = p.x + 1, y = p.y, z = p.z, stackpos = 0},
{x = p.x - 1, y = p.y, z = p.z, stackpos = 0},
{x = p.x, y = p.y + 1, z = p.z, stackpos = 0},
{x = p.x, y = p.y - 1, z = p.z, stackpos = 0}
}
for x = 1, #pp do
local thing = getThingFromPos(pp[x], false).uid
if thing ~= 0 and not hasItemProperty(thing, CONST_PROP_BLOCKSOLID) then
fromPosition = pp[x]
end
end

doTeleportThing(cid, fromPosition, false)
end

end
?
 
No, just instead of this: fromPosition = getTownTemplePosition(getPlayerTown(cid)).
So fromPosition = getTownTemplePosition(getPlayerTown(cid)) removed, and what I posted on that place where you removed that line.
 
This:

Code:
function onStepIn(cid, item, position, fromPosition)

    if getTileInfo(position).creatures > 1 then
   
            if fromPosition.x == 0 or (fromPosition.x == position.x and fromPosition.y == position.y) then
           
            local p = getCreaturePosition(cid)
            local pp = {
                {x = p.x + 1, y = p.y, z = p.z, stackpos = 0},
                {x = p.x - 1, y = p.y, z = p.z, stackpos = 0},
                {x = p.x, y = p.y + 1, z = p.z, stackpos = 0},
                {x = p.x, y = p.y - 1, z = p.z, stackpos = 0}
                }
        for x = 1, #pp do
        local thing = getThingFromPos(pp[x], false).uid
            if thing ~= 0 and not hasItemProperty(thing, CONST_PROP_BLOCKSOLID) then
            fromPosition = pp[x]
            end
        end   
    end
        doTeleportThing(cid, fromPosition, false)
    end
end
 
No, just instead of this: fromPosition = getTownTemplePosition(getPlayerTown(cid)).
So fromPosition = getTownTemplePosition(getPlayerTown(cid)) removed, and what I posted on that place where you removed that line.

The right code is:
Code:
function onStepIn(cid, item, position, fromPosition)

    if getTileInfo(position).creatures > 1 then
   
            if fromPosition.x == 0 or (fromPosition.x == position.x and fromPosition.y == position.y) then
            local p = getCreaturePosition(cid)
            local pp = {
     {x = p.x + 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x - 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x, y = p.y + 1, z = p.z, stackpos = 0},
     {x = p.x, y = p.y - 1, z = p.z, stackpos = 0}
                        }
                       
for x = 1, #pp do
     local thing = getThingFromPos(pp[x], false).uid
     if thing ~= 0 and not hasItemProperty(thing, CONST_PROP_BLOCKSOLID) then
         fromPosition = pp[x]
     end
end
            end
           
        doTeleportThing(cid, fromPosition, false)
    end

end

THANK YOU LIMOS, WORKED PERFECTLYYY!!!!!!!!!!!!!!!!!!!!!!!!!!!!11
 
Now limos can make a script for me 0.3.6 TFS CD to allow players in PZ to walk through eachother. With an array of tiles that doesn't allow you to walk through them.
 
Err, not solved yet @Limos .

I maded the code on my windows machine at my house and all worked fine.

When i pass all codes to my linux machine hoster, appear this error on console:

[20:21:08.963] [Error - MoveEvents Interface]
[20:21:08.964] data/movements/scripts/dptile.lua:eek:nStepIn
[20:21:08.964] Description:
[20:21:08.964] (luaGetThingFromPosition) Tile not found

I am using this code:

Code:
function onStepIn(cid, item, position, fromPosition)

    if getTileInfo(position).creatures > 1 then

            if fromPosition.x == 0 or (fromPosition.x == position.x and fromPosition.y == position.y) then
            local p = getCreaturePosition(cid)
            local pp = {
     {x = p.x + 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x - 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x, y = p.y + 1, z = p.z, stackpos = 0},
     {x = p.x, y = p.y - 1, z = p.z, stackpos = 0}
                        }
                    
for x = 1, #pp do
     local thing = getThingFromPos(pp[x], false).uid
     if thing ~= 0 and not hasItemProperty(thing, CONST_PROP_BLOCKSOLID) then
         fromPosition = pp[x]
     end
end
            end
        
        doTeleportThing(cid, fromPosition, false)
    end

end

Code:
<movevent type="StepIn" itemid="11059" event="script" value="dptile.lua"/>
 
Try to remove , false.

Wich , false are u talking about?

I tested with this one:

Code:
 doTeleportThing(cid, fromPosition, false)
and let:
doTeleportThing(cid, fromPosition)

And do not work.. but exist this false too:
local thing = getThingFromPos(pp[x], false).uid

Are this second false u tlaking about? Sorry i cant test too much because players hate that server goes down (as i said, on my windows are ok, only linux = bugged)
 
The one from getThingFromPos, the error is from that.

You compeltly right!
Problem solved!

The code for linux are:

Code:
function onStepIn(cid, item, position, fromPosition)

    if getTileInfo(position).creatures > 1 then
   
            if fromPosition.x == 0 or (fromPosition.x == position.x and fromPosition.y == position.y) then
            local p = getCreaturePosition(cid)
            local pp = {
     {x = p.x + 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x - 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x, y = p.y + 1, z = p.z, stackpos = 0},
     {x = p.x, y = p.y - 1, z = p.z, stackpos = 0}
                        }
                       
for x = 1, #pp do
     local thing = getThingFromPos(pp[x]).uid
     if thing ~= 0 and not hasItemProperty(thing, CONST_PROP_BLOCKSOLID) then
         fromPosition = pp[x]
     end
end
            end
           
        doTeleportThing(cid, fromPosition, false)
    end

end

THANK YA AGAIN LIMOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
HOW CAN I KISS U MANNNNNNNNNNNN SZZZZ BYE BYEEEEEEEEEEEEEEE
 
You compeltly right!
Problem solved!

The code for linux are:

Code:
function onStepIn(cid, item, position, fromPosition)

    if getTileInfo(position).creatures > 1 then
  
            if fromPosition.x == 0 or (fromPosition.x == position.x and fromPosition.y == position.y) then
            local p = getCreaturePosition(cid)
            local pp = {
     {x = p.x + 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x - 1, y = p.y, z = p.z, stackpos = 0},
     {x = p.x, y = p.y + 1, z = p.z, stackpos = 0},
     {x = p.x, y = p.y - 1, z = p.z, stackpos = 0}
                        }
                      
for x = 1, #pp do
     local thing = getThingFromPos(pp[x]).uid
     if thing ~= 0 and not hasItemProperty(thing, CONST_PROP_BLOCKSOLID) then
         fromPosition = pp[x]
     end
end
            end
          
        doTeleportThing(cid, fromPosition, false)
    end

end

THANK YA AGAIN LIMOSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
HOW CAN I KISS U MANNNNNNNNNNNN SZZZZ BYE BYEEEEEEEEEEEEEEE
She* Anyways you requested so you can walk thru people right in pz?
What TFS you use? I have summer vacation now and i have nothing to do. so i help you digging in the sources.
 
Back
Top