[CS:GO] how to get the number of real people in the team

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
copyerfiled
Junior Member
Posts: 16
Joined: Wed Jan 23, 2019 9:40 am

[CS:GO] how to get the number of real people in the team

Postby copyerfiled » Tue Apr 30, 2019 9:48 am

Hello!
How to get the number of real people in the team? (without bots)
User avatar
Kami
Global Moderator
Posts: 153
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Re: [CS:GO] how to get the number of real people in the team

Postby Kami » Tue Apr 30, 2019 3:30 pm

Hey, this is how you could do it:

Syntax: Select all

def get_real_player_count(team_number):
count = 0
for player in PlayerIter('human'):
if player.team == team_number:
count += 1
return count


Available filters for PlayerIter should be:

Code: Select all

'all',
'bot',
'human',
'alive',
'dead',
'un',
'spec',
't',
'ct'
User avatar
Ayuto
Project Leader
Posts: 2022
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [CS:GO] how to get the number of real people in the team

Postby Ayuto » Tue Apr 30, 2019 3:47 pm

That could be shortened to:

Syntax: Select all

from filters.players import PlayerIter

def get_real_player_count(team):
return len(PlayerIter(['human', team]))
The team argument is one of the filters Kami has listed above.
User avatar
copyerfiled
Junior Member
Posts: 16
Joined: Wed Jan 23, 2019 9:40 am

Re: [CS:GO] how to get the number of real people in the team

Postby copyerfiled » Tue Apr 30, 2019 5:01 pm

Thank you all very much!

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 7 guests