Advertisement
Guest User

player.lua

a guest
Jun 17th, 2014
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Player:onLook(thing, position, distance)
  2.  
  3.     local description = "You see " .. thing:getDescription(distance)
  4.     if self:getGroup():getAccess() then
  5.         if thing:isItem() then
  6.             description = string.format("%s\nItemID: [%d]", description, thing:getId())
  7.  
  8.             local actionId = thing:getActionId()
  9.             if actionId ~= 0 then
  10.                 description = string.format("%s, ActionID: [%d]", description, actionId)
  11.             end
  12.            
  13.             local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
  14.             if uniqueId > 0 and uniqueId < 65536 then
  15.                 description = string.format("%s, UniqueId: [%d]", description, uniqueId)
  16.             end
  17.            
  18.             description = description .. "."
  19.             local itemType = thing:getType()
  20.            
  21.             local transformEquipId = itemType:getTransformEquipId()
  22.             local transformDeEquipId = itemType:getTransformDeEquipId()
  23.             if transformEquipId ~= 0 then
  24.                 description = string.format("%s\nTransformTo: [%d] (onEquip).", description, transformEquipId)
  25.             elseif transformDeEquipId ~= 0 then
  26.                 description = string.format("%s\nTransformTo: [%d] (onDeEquip).", description, transformDeEquipId)
  27.             end
  28.  
  29.             local decayId = itemType:getDecayId()
  30.             if decayId ~= -1 then
  31.                 description = string.format("%s\nDecayTo: [%d]", description, decayId)
  32.             end
  33.         elseif thing:isCreature() then
  34.             local str = "%s\nHealth: [%d / %d]"
  35.             if thing:getMaxMana() > 0 then
  36.                 str = string.format("%s, Mana: [%d / %d]", str, thing:getMana(), thing:getMaxMana())
  37.             end
  38.             description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
  39.         end
  40.        
  41.         local position = thing:getPosition()
  42.         description = string.format(
  43.             "%s\nPosition: [X: %d] [Y: %d] [Z: %d].",
  44.             description, position.x, position.y, position.z
  45.         )
  46.        
  47.         if thing:isCreature() then
  48.             if thing:isPlayer() then
  49.                 description = string.format("%s\nIP: [%s].", description, Game.convertIpToString(thing:getIp()))
  50.             end
  51.         end
  52.     end
  53.  
  54.     if(self:getAccountType() < ACCOUNT_TYPE_GOD) then
  55.         self:sendTextMessage(MESSAGE_INFO_DESCR, description)
  56.     else
  57.         if(CLIPORT) then
  58.             self:teleportTo(position)
  59.             return false
  60.         end
  61.     end
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement