• 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+ Check player coordinate

CastorFlynn

Member
Joined
Aug 29, 2021
Messages
89
Reaction score
8
I would like to check if a player is in a coordinate above X. It is for a talkaction, if he is in a coordinate above X he could not execute it.
 
Solution
I don't know what you want to do, but I'll show you some examples of what I think you want to find out.
Lua:
    local position = player:getPosition()
    if position.x > 1000 then
        -- We do something if the player is in a position X greater than 1000
    end

    if position.y > 1000 then
        -- We do something if the player is in a position Y greater than 1000
    end

    if position.z > 7 then
        -- We do something if the player is in a position Z greater than 7
    end

    if position:isInRange(Position(500, 500, 7), Position(1000, 1000, 7)) then
        -- We do something if the player is in this area 500,500,7 to 1000, 1000, 7
    end
I don't know what you want to do, but I'll show you some examples of what I think you want to find out.
Lua:
    local position = player:getPosition()
    if position.x > 1000 then
        -- We do something if the player is in a position X greater than 1000
    end

    if position.y > 1000 then
        -- We do something if the player is in a position Y greater than 1000
    end

    if position.z > 7 then
        -- We do something if the player is in a position Z greater than 7
    end

    if position:isInRange(Position(500, 500, 7), Position(1000, 1000, 7)) then
        -- We do something if the player is in this area 500,500,7 to 1000, 1000, 7
    end
 
Solution
I don't know what you want to do, but I'll show you some examples of what I think you want to find out.
Lua:
    local position = player:getPosition()
    if position.x > 1000 then
        -- We do something if the player is in a position X greater than 1000
    end

    if position.y > 1000 then
        -- We do something if the player is in a position Y greater than 1000
    end

    if position.z > 7 then
        -- We do something if the player is in a position Z greater than 7
    end

    if position:isInRange(Position(500, 500, 7), Position(1000, 1000, 7)) then
        -- We do something if the player is in this area 500,500,7 to 1000, 1000, 7
    end
Thanks
 
Back
Top