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

edit function

qruczu

New Member
Joined
Jan 8, 2012
Messages
104
Reaction score
0
Code:
function searchThingText(fromPos, toPos)
    local distance = 0
    local direction = 0
    local level = 0

    local dx = fromPos.x - toPos.x
    local dy = fromPos.y - toPos.y
    local dz = fromPos.z - toPos.z
    level = (dz > 0) and 0 or (dz < 0) and 1 or 2

    if math.abs(dx) < 5 and math.abs(dy) < 5 then
        distance = 0
    else
        local tmp = dx * dx + dy * dy
        distance = (tmp < 10000) and 1 or (tmp < 75625) and 2 or 3
    end
    local tang = (dx ~= 0) and dy / dx or 10
    if math.abs(tang) < 0.4142 then
        direction = (dx > 0) and 3 or 2       
    else if math.abs(tang) < 2.4142 then
        direction = (tang > 0) and ((dy > 0) and 5 or 6) or ((dx > 0) and 7 or 4)
    else
        direction = (dy > 0) and 0 or 1
    end
    local texts = {
        --distance
        [0] = {
            --level
            [0] = "is above you",
            [1] = "is below you",
            [2] = "is stangding next to you"
        },
        [1] = {
            [0] = "is on a higher level to the",
            [1] = "is on a lower level to the",
            [2] = "is to the"
        },
        [2] = "is far to the",
        [3] = "is very far to the"
    }
    local dirs = {
        [0] = "north",
        [1] = "south",
        [2] = "east",
        [3] = "west",
        [4] = "north-east",
        [5] = "north-west",
        [6] = "south-east",
        [7] = "south-west"
    }
    return ((type(text[distance]) == "table") and text[distance][level] or text[distance])..((distance ~= 0) and dirs[direction] or '')
end
end
need to change the script. if target player have storage 2222
then player uses the spell gets error message.
please help me.
 
Back
Top