• 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 "He is a Tutor" onLook tfs 1.2-1.3

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys! i noticed i cant see this feature in my server, and i was reading some old post but those are any good because of too old tfs, does anyone know what do i have to do to make this work? i guess it's in sources, but i always have very careful before editing sources, i would like to be sure, what do i have to edit and where?
plzz tfs 1.2-1.3

Thanks!!
 
Solution
Lua:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    elseif thing:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. thing:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. thing:getStorageValue(rebirthStorage) .. "].")
        if...
not sure but maybe in data/xml/groups?
If im not mistaken, that file is to set the privileges of every group and few other config, but nothing to do with onLook, for what i have search, the missing deature should be in player.cpp, in here std::string Player::getDescription(int32_t lookDistance) const

But im not 100% sure, and also dont know what to put or how, seems very complicated for me
 
Do it via lua:
data/events/player.lua
Lua:
function Player:onLook(thing, position, distance)

Add after:
Lua:
description = "You see "..thing:getDescription(distance)

The following code:
Lua:
if Player(thing) then
   if thing:getGroup() == 2 then
       description = description.."\n He is a Tutor."
   end
end

Done.
 
Do it via lua:
data/events/player.lua
Lua:
function Player:onLook(thing, position, distance)

Add after:
Lua:
description = "You see "..thing:getDescription(distance)

The following code:
Lua:
if Player(thing) then
   if thing:getGroup() == 2 then
       description = description.."\n He is a Tutor."
   end
end

Done.
oh buddy, my function is a little different, i dont have that line, where should i put that code?

Lua:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    elseif thing:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. thing:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. thing:getStorageValue(rebirthStorage) .. "].")
    else
        description = description .. thing:getDescription(distance)
    end

    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)

            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end

            description = description .. '.'
            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:isPlayer() then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end

        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )

        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end   
       
end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInBattleList(creature, distance)
    local description = 'You see '
    if creature:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. creature:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. creature:getStorageValue(rebirthStorage) .. "].")
    else
        description = description .. creature:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        local str = '%s\nHealth: %d / %d'
        if creature:isPlayer() and creature:getMaxMana() > 0 then
                str = string.format('%s, Mana: %d / %d', str, creature:getMana(), creature:getMaxMana())
           end
        description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. '.'

        local position = creature:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )

        if creature:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(creature:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
Lua:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    if Player(thing) then
    if thing:getGroup() == 2 then
       description = description.."\n He is a Tutor."
     end
    end
    elseif thing:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. thing:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. thing:getStorageValue(rebirthStorage) .. "].")
    else
        description = description .. thing:getDescription(distance)
    end

    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)

            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end

            description = description .. '.'
            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:isPlayer() then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end

        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )

        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end 
       
end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInBattleList(creature, distance)
    local description = 'You see '
    if creature:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. creature:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. creature:getStorageValue(rebirthStorage) .. "].")
    else
        description = description .. creature:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        local str = '%s\nHealth: %d / %d'
        if creature:isPlayer() and creature:getMaxMana() > 0 then
                str = string.format('%s, Mana: %d / %d', str, creature:getMana(), creature:getMaxMana())
           end
        description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. '.'

        local position = creature:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )

        if creature:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(creature:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
Not exactly @Stanos, you're being redudant adding 2 player checks...

This is how it needs to look :p
Lua:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    elseif thing:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. thing:getDescription(distance)
      
       if thing:getGroup() == 2 then
           description = description.."\n He is a Tutor."
       end
        description = string.format('%s %s', description, "Rebirths [" .. thing:getStorageValue(rebirthStorage) .. "].")
    else
        description = description .. thing:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)
            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end
            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end
            description = description .. '.'
            local itemType = thing:getType()
            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end
            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:isPlayer() then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end
        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )
        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end 
      
end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
function Player:onLookInBattleList(creature, distance)
    local description = 'You see '
    if creature:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. creature:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. creature:getStorageValue(rebirthStorage) .. "].")
    else
        description = description .. creature:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        local str = '%s\nHealth: %d / %d'
        if creature:isPlayer() and creature:getMaxMana() > 0 then
                str = string.format('%s, Mana: %d / %d', str, creature:getMana(), creature:getMaxMana())
           end
        description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. '.'
        local position = creature:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )
        if creature:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(creature:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
Not exactly @Stanos, you're being redudant adding 2 player checks...

This is how it needs to look :p
Lua:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    elseif thing:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. thing:getDescription(distance)
     
       if thing:getGroup() == 2 then
           description = description.."\n He is a Tutor."
       end
        description = string.format('%s %s', description, "Rebirths [" .. thing:getStorageValue(rebirthStorage) .. "].")
    else
        description = description .. thing:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)
            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end
            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end
            description = description .. '.'
            local itemType = thing:getType()
            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end
            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:isPlayer() then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end
        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )
        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end
     
end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
function Player:onLookInBattleList(creature, distance)
    local description = 'You see '
    if creature:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. creature:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. creature:getStorageValue(rebirthStorage) .. "].")
    else
        description = description .. creature:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        local str = '%s\nHealth: %d / %d'
        if creature:isPlayer() and creature:getMaxMana() > 0 then
                str = string.format('%s, Mana: %d / %d', str, creature:getMana(), creature:getMaxMana())
           end
        description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. '.'
        local position = creature:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )
        if creature:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(creature:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
O shit, okay :D
 
Since most people have more groups and not every character is a male:
Lua:
if thing:getGroup():getId() > 1 and not thing:getGroup():getAccess() then
  if thing:getSex() == 0 then
   description = string.format("%s\nShe is a %s.", description, thing:getGroup():getName())
  else
    description = string.format("%s\nHe is a %s.", description, thing:getGroup():getName())
  end
end

Different version, just sends group name bigger than Player in square brackets.
Lua:
if thing:getGroup():getId() > 1 and not thing:getGroup():getAccess() then
   description = string.format("%s\n[%s]", description, string.upper(thing:getGroup():getName()))
end
 
Last edited:
Since most people have more groups and not every character is a male:
Lua:
if thing:getGroup():getId() > 1 then
  if thing:getSex() == 0 then
   description = string.format("%s\nShe is a %s.", description, thing:getGroup():getName())
  else
    description = string.format("%s\nHe is a %s.", description, thing:getGroup():getName())
  end
end

Different version, just sends group name bigger than Player in square brackets.
Lua:
if thing:getGroup():getId() > 1 then
   description = string.format("%s\n[%s]", description, string.upper(thing:getGroup():getName()))
end

On the last one, or even on your 2 examples, remember that >GM's has their own "custom desc" via sources, so it would be something like he/she is gm x2, that's why i didn't made it like that xD
 
On the last one, or even on your 2 examples, remember that >GM's has their own "custom desc" via sources, so it would be something like he/she is gm x2, that's why i didn't made it like that xD
Oh, i see. Then we should also check if group doesnt have access then.
Should do the trick i guess.
 
Hello guys, i tried what azhel tried but didnt work for me, this is what i currently have:


Lua:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    elseif thing:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. thing:getDescription(distance)
    
       if thing:getGroup() == 2 then
           description = description.."\n He is a Tutor."
       end
        description = string.format('%s %s', description, "Rebirths [" .. thing:getStorageValue(rebirthStorage) .. "].")
    else
        description = description .. thing:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)
            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end
            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end
            description = description .. '.'
            local itemType = thing:getType()
            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end
            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:isPlayer() then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end
        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )
        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end
       
    
end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
Lua:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    elseif thing:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. thing:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. thing:getStorageValue(rebirthStorage) .. "].")
        if thing:getGroup():getName():lower() == "tutor" then
            description = description .. " He is a Tutor."
        end
    else
        description = description .. thing:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)
            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end
            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end
            description = description .. '.'
            local itemType = thing:getType()
            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end
            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:isPlayer() then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end
        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )
        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
Lua:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    elseif thing:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. thing:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. thing:getStorageValue(rebirthStorage) .. "].")
        if thing:getGroup():getName():lower() == "tutor" then
            description = description .. " He is a Tutor."
        end
    else
        description = description .. thing:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)
            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end
            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end
            description = description .. '.'
            local itemType = thing:getType()
            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end
            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:isPlayer() then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end
        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )
        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
Hey buddy sorry this didnt work, not showing tutor
 
Last edited:
Lua:
function Player:onLook(thing, position, distance)
    local description = 'You see '
    if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. 'a honeyflower patch.'
        elseif thing.actionid == 5641 then
            description = description .. 'a banana palm.'
        else
            description = description .. thing:getDescription(distance)
        end
    elseif thing:isPlayer() then
        local rebirthStorage = 99997 -- CHANGE THIS SO YOU HAVE SAME STORAGE AS IN NPC FILE
        description = description .. thing:getDescription(distance)
        description = string.format('%s %s', description, "Rebirths [" .. thing:getStorageValue(rebirthStorage) .. "].")
        if thing:getAccountType() == ACCOUNT_TYPE_TUTOR then
            description = description .. " He is a Tutor."
        end
    else
        description = description .. thing:getDescription(distance)
    end
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format('%s\nItem ID: %d', description, thing.itemid)
            local actionId = thing.actionid
            if actionId ~= 0 then
                description = string.format('%s, Action ID: %d', description, actionId)
            end
            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format('%s, Unique ID: %d', description, uniqueId)
            end
            description = description .. '.'
            local itemType = thing:getType()
            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onEquip)', description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format('%s\nTransforms to: %d (onDeEquip)', description, transformDeEquipId)
            end
            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format('%s\nDecays to: %d', description, decayId)
            end
        elseif thing:isCreature() then
            local str = '%s\nHealth: %d / %d'
            if thing:isPlayer() then
                str = string.format('%s, Mana: %d / %d', str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. '.'
        end
        local position = thing:getPosition()
        description = string.format(
            '%s\nPosition: %d, %d, %d',
            description, position.x, position.y, position.z
        )
        if thing:isCreature() and thing:isPlayer() then
            description = string.format('%s\nIP: %s.', description, Game.convertIpToString(thing:getIp()))
        end
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
Last edited:
Solution

Similar threads

Back
Top