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

onLook script for signs tfs 1.5 8.6

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
hi, can someone help me with this script? I make it, and it showing popup, but when im look on others items like floor, it showing me popup :/ How to set default description for others items without actionid?

Code:
local test_sign = EventCallback

function test_sign.onLook(player, item, position, distance, description)
        if isPlayer(item) or isMonster(item) then
        return description
    end

    if player:getStorageValue(121212) >= os.time() then
        player:langcc("Too fast!", "Za szybko!")
        return true
    end

    if item:getId() == 1431 or item:getId() == 1429 then
        player:langred("-[ Sign ]-\n\nClick on the sign to get more informations.", "-[ Znak ]-\n\nKliknij na znak by otrzymac wiecej informacji.")
        return true
    end

    if player:getStorageValue(language_storage) == 1 then
        if item:getActionId() == 64900 then
            text = "-=-=[ Test English ]=-=-\n\n Blablablablabla"
        end
    else
        if item:getActionId() == 64900 then
            text = "-=-=[ Test Polish ]=-=-\n\n Blablablablabla"
        end
        player:popupFYI(text)
        player:setStorageValue(121212, os.time() + 10)
        return true
    end
end

test_sign:register()
 
Solution
Changed a bit at the end to make it cleaner, and fixed your if/else statement, so it wasn't catching everything.

Lua:
local test_sign = EventCallback

function test_sign.onLook(player, item, position, distance, description)
    if isPlayer(item) or isMonster(item) then
        return description
    end
    
    if player:getStorageValue(121212) >= os.time() then
        player:langcc("Too fast!", "Za szybko!")
        return true
    end
    
    if item:getId() == 1431 or item:getId() == 1429 then
        player:langred("-[ Sign ]-\n\nClick on the sign to get more informations.", "-[ Znak ]-\n\nKliknij na znak by otrzymac wiecej informacji.")
        return true
    end
    
    if item:getActionId() == 64900 then...
Changed a bit at the end to make it cleaner, and fixed your if/else statement, so it wasn't catching everything.

Lua:
local test_sign = EventCallback

function test_sign.onLook(player, item, position, distance, description)
    if isPlayer(item) or isMonster(item) then
        return description
    end
    
    if player:getStorageValue(121212) >= os.time() then
        player:langcc("Too fast!", "Za szybko!")
        return true
    end
    
    if item:getId() == 1431 or item:getId() == 1429 then
        player:langred("-[ Sign ]-\n\nClick on the sign to get more informations.", "-[ Znak ]-\n\nKliknij na znak by otrzymac wiecej informacji.")
        return true
    end
    
    if item:getActionId() == 64900 then
        if player:getStorageValue(language_storage) == 1 then
            text = "-=-=[ Test English ]=-=-\n\n Blablablablabla"
        else
            text = "-=-=[ Test Polish ]=-=-\n\n Blablablablabla"
        end
        player:popupFYI(text)
        player:setStorageValue(121212, os.time() + 10)
        return true
    end
    return true
end

test_sign:register()
 
Solution
Changed a bit at the end to make it cleaner, and fixed your if/else statement, so it wasn't catching everything.

Lua:
local test_sign = EventCallback

function test_sign.onLook(player, item, position, distance, description)
    if isPlayer(item) or isMonster(item) then
        return description
    end
   
    if player:getStorageValue(121212) >= os.time() then
        player:langcc("Too fast!", "Za szybko!")
        return true
    end
   
    if item:getId() == 1431 or item:getId() == 1429 then
        player:langred("-[ Sign ]-\n\nClick on the sign to get more informations.", "-[ Znak ]-\n\nKliknij na znak by otrzymac wiecej informacji.")
        return true
    end
   
    if item:getActionId() == 64900 then
        if player:getStorageValue(language_storage) == 1 then
            text = "-=-=[ Test English ]=-=-\n\n Blablablablabla"
        else
            text = "-=-=[ Test Polish ]=-=-\n\n Blablablablabla"
        end
        player:popupFYI(text)
        player:setStorageValue(121212, os.time() + 10)
        return true
    end
    return true
end

test_sign:register()

Thanks it work! But in last return, i must changed return true to return description, because when im look on normal items i don't see any desc ;p
 
Back
Top