Forum

> > CS2D > Scripts > Check how many buildings by Player X
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Check how many buildings by Player X

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Check how many buildings by Player X

Sarinoo
User Off Offline

Zitieren
Hello
How can I check how many buildings are on map from Player X (for example: Player 3 or Player 4).

I dont care about building type^^ just about count

Thanks

alt Re: Check how many buildings by Player X

DC
Admin Off Offline

Zitieren
Use cs2d lua cmd object

Untested:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function getBuildingCount(player)
	local count = 0
	local objectlist = object(0,"table")
	for _,id in pairs(objectlist) do
		-- only count building types
		if (object(id, "type") < 20) then
			-- only count buildings belonging to the player
			if (object(id, "player") == player) then
				count = count + 1
			end
		end
	end
	return count
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht