Script to output world origin coords of named entities.

This could probably be done fairly easily. Something to output the world coords of all named entities, and their type (Or just the world coords of all func_doors, func_door_rotating and prop_door_rotating.)

Preferably into console.

So you want a script that finds all of a certain entity and outputs the position?
Sure:
[lua]
concommand.Add(“showallents”, function(ply, cmd, args)
for k,v in pairs(ents.GetAll()) do
if args[1] != nil then
if v:GetClass() == args[1] then
print(“Class: " … tostring(v:GetClass())…”
Position: "…tostring(v:GetPos()) … "
")
end
else
print(“Class: " … tostring(v:GetClass())…”
Position: "…tostring(v:GetPos()) … "
")
end
end
end)
[/lua]

Now put that into a clientside or serverside file and type “showallents” into console.
If you don’t put anything after the command, all of the maps entities will be printed. If you put an argument, it will print just entities of that class-name.
E.g. “showallents player” will show the position of all of the player entities.
“showallents func_door” will show the position of all “func_door” entities.

Enjoy!

Legendary, thanks. Credits will be dispensed.

[editline]11:54PM[/editline]

The actual purpose of this (I forgot to mention) was to make coding doorscripts (For tacoscript RP maps, see) a fatload easier, so I took the liberty of making the script also output the name of the entity in question.



concommand.Add("showallents", function(ply, cmd, args)
	for k,v in pairs(ents.GetAll()) do
		if args[1] != nil then
			if v:GetClass() == args[1] then
				print("Class: " .. tostring(v:GetClass()).."
 	Position: "..tostring(v:GetPos()) .. "
" ..tostring(v:GetName()).."
")
			end
		else
			print("Class: " .. tostring(v:GetClass()).."
 	Position: "..tostring(v:GetPos()) .. "
" ..tostring(v:GetName()).."
")
		end
	end
end)

Is the revised version.

Thanks a lot, zemaster.