Page 1 of 1

Match End Event?

Posted: Fri Nov 06, 2015 1:31 am
by SkinN
Hi,

I looked over this link: https://wiki.alliedmods.net/Counter-Strike:_Global_Offensive_Events
And I couldn't find any event that triggers on the match end, the purpose on is to know which team has won the game.

Thanks in advance.

Posted: Fri Nov 06, 2015 2:07 am
by satoon101
Try this one:
http://wiki.sourcepython.com/pages/Event-csgo:cs_win_panel_match

You can check the team scores to know who won.

Posted: Fri Nov 06, 2015 3:41 pm
by SkinN
satoon101 wrote:Try this one:
http://wiki.sourcepython.com/pages/Event-csgo:cs_win_panel_match

You can check the team scores to know who won.


Recording to https://wiki.alliedmods.net/Counter-Strike:_Global_Offensive_Events#cs_win_panel_match that event does have any info, how can I check the team who won then?

Posted: Fri Nov 06, 2015 3:56 pm
by Predz
SkinN using the new events update to SourcePython, you can iterate through the GameEvent object. Just use a for loop and it works like a python dictionary :)

Posted: Fri Nov 06, 2015 4:10 pm
by Ayuto
No, you can't iterate. You can iterate over the "variables" attribute of the GameEvent object (or just print it). Example:

Syntax: Select all

from events import Event

@Event('cs_win_panel_match')
def cs_win_panel_match(event):
print(event.variables.as_dict())
However, I just checked that in CS:GO and it does not have any event variables (only CS:S).

Posted: Fri Nov 06, 2015 4:12 pm
by satoon101
Since there are no variables, you have to loop through the cs_team_manager entities:
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/addons/source-python/data/source-python/teams/csgo.ini

When looping through, check the team number of each to make sure it's 2 or 3, then check the score of the team:
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/addons/source-python/data/source-python/entities/csgo/CTeam.ini

If you have access to the server's console, you might set net_showevents to 2 and it will show you the events and their variables when they fire. Note that you need to either enable cheats or remove the cheat flag from net_showevents before setting it to 2.

Posted: Fri Nov 06, 2015 4:14 pm
by Predz
Ayuto wrote:No, you can't iterate. You can iterate over the "variables" attribute of the GameEvent object (or just print it). Example:

Syntax: Select all

from events import Event

@Event('cs_win_panel_match')
def cs_win_panel_match(event):
print(event.variables.as_dict())
However, I just checked that in CS:GO and it does not have any event variables (only CS:S).


Sorry, misinterpreted how you finally implemented it :rolleyes: