Entities

Understanding the entity system can be a bit complicated. With some examples and explanations, I hope you get to know them well!

"GetLocalInfo" returns a table of 4 elements.

local local_info = GetLocalInfo()
Print(tostring(local_info[1])) --returns the local pawn address
Print(tostring(local_info[2])) --returns the local controller address
Print(tostring(local_info[3])) --returns the local index
Print(tostring(local_info[4])) --returns the local team

"GetEntities" returns multiple tables of 4 elements.

The entity list does not contain the local player, you can get that via "GetLocalInfo".

local entity_list = GetEntities()
for i = 1, #entity_list do
Print(tostring(entity_list[i][1])) --returns the entity pawn address
Print(tostring(entity_list[i][2])) --returns the entity controller address
Print(tostring(entity_list[i][3])) --returns the entity index
Print(tostring(entity_list[i][4])) --returns the entity team
end

"IsVisible" returns whether or not a player is visible based on the VPK parser built into Orbit.

It takes in the entity index as the argument.

local entity_list = GetEntities()
for i = 1, #entity_list do
if IsVisible(entity_list[i][3]) then --remember, this returns the entity index
--entity is visible
end
end

"SetWhiteList" can make an entity be completely ignored by Orbit.

It takes in the entities table index - 1, and an int state as arguments.

1 is true, 0 is false.

local Entities = GetEntities()
for i=1, #Entities do
SetWhiteList(i - 1, 1) --lua indexes from 1, but cpp from 0
end


On This Page
Entities