Match End Event?

Please post any questions about developing your plugin here. Please use the search function before posting!
SkinN
Junior Member
Posts: 25
Joined: Fri Jul 19, 2013 7:29 am

Match End Event?

Postby SkinN » Fri Nov 06, 2015 1:31 am

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Nov 06, 2015 2:07 am

Try this one:
http://wiki.sourcepython.com/pages/Event-csgo:cs_win_panel_match

You can check the team scores to know who won.
Image
SkinN
Junior Member
Posts: 25
Joined: Fri Jul 19, 2013 7:29 am

Postby SkinN » Fri Nov 06, 2015 3:41 pm

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?
Predz
Senior Member
Posts: 158
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Postby Predz » Fri Nov 06, 2015 3:56 pm

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 :)
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Fri Nov 06, 2015 4:10 pm

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).
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Nov 06, 2015 4:12 pm

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.
Image
Predz
Senior Member
Posts: 158
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Postby Predz » Fri Nov 06, 2015 4:14 pm

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:

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 57 guests