Entity Idx

Is the Idx of a entity static or dynamic?

[lua]

function GetIdx(ply)
local tr = ply:GetEyeTrace()
if ValidEntity(tr.Entity) then
ply:ChatPrint(tr.Entity.EntIndex())
end
end
concommand.Add(“rp_getidx”,GetIdx)

[/lua]

Why does that always print 0 when looking at a entity?

tr.Entity:EntIndex()

[editline]29th December 2010[/editline]

it’s static until the game ends.

It also changes depending on how many slots a server is and etc, so don’t bother relying on it for more than a single map’s duration.

Not sure what Uberpwns thinks, but this is true.

entity.EntIndex(entity) or entity:EntIndex(), since it’s defined as a method.