• 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+ block push players in certain area

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
Tfs 1.3
Hi i created one "Event", that players stay in area
Frompos = 367, 480, 7
topos = 373, 488, 7

how can i put so that inside this area is prohibited to push other players?
 
Solution
Try this out:
data/events/scripts/player.lua (REPLACE the existing Player:eek:nMoveCreature, or add the if statement if you already have a custom function)
Make sure it's enabled in events.xml as well.
Lua:
function Position.isInArea(self, area)
    if self.x >= area.from.x and self.x <= area.to.x then
        if self.y >= area.from.y and self.y <= area.to.y then
            if self.z >= area.from.z and self.z <= area.to.z then
                return true
            end
        end
    end
    return false
end

local event_blocked_push = {
    from = Position(367, 480, 7),
    to = Position(373, 488, 7)
}

function Player:onMoveCreature(creature, fromPosition, toPosition)
    if fromPosition:isInArea(event_blocked_push) then...
Try this out:
data/events/scripts/player.lua (REPLACE the existing Player:eek:nMoveCreature, or add the if statement if you already have a custom function)
Make sure it's enabled in events.xml as well.
Lua:
function Position.isInArea(self, area)
    if self.x >= area.from.x and self.x <= area.to.x then
        if self.y >= area.from.y and self.y <= area.to.y then
            if self.z >= area.from.z and self.z <= area.to.z then
                return true
            end
        end
    end
    return false
end

local event_blocked_push = {
    from = Position(367, 480, 7),
    to = Position(373, 488, 7)
}

function Player:onMoveCreature(creature, fromPosition, toPosition)
    if fromPosition:isInArea(event_blocked_push) then
        return false
    end
    return true
end
 
Solution
Back
Top