ValveSoftware / Source-1-Games

Source 1 based games such as TF2 and Counter-Strike: Source
634 stars 74 forks source link

[TF2][API] No Game Events for Overhealing, Headshots, Backstabs #910

Open StewartAtkins opened 11 years ago

StewartAtkins commented 11 years ago

While attempting to write a server plugin for TF2 I discovered that there appear to be no game events fired by the GameEventManager2 for actions such as overhealing (i.e. any healing past a player's 100% health does not fire player_heal events, and does not have it's own event, thus resulting in a large under-report of the amount of healing actually performed by medics), headshot kills, and backstabs (neither of which appear to have any kind of indicator in player_death, nor their own event).

All of these events are required for proper tracking of the in-game scoreboard (though if anybody knows how to get at that data directly from a C++ plugin, feel free to give me some pointers - literally or figuratively)

SizzlingCalamari commented 11 years ago

+1 A separate event or modified player_healed for overheals would be nice.

@StewartAtkins The player_death event has a "customkill" property that provides data such as headshots, backstabs and a bunch of other things. http://hg.alliedmods.net/sourcemod-central/file/47b1a26c996e/plugins/include/tf2_stocks.inc#l82

StewartAtkins commented 11 years ago

@SizzlingCalamari, thanks I hadn't noticed that, but I am sure that overhealing doesn't have any event, at least.

I notice that sourcemod file also has definitions for something called TFResourceType, it's a shame there's no easy way to access it from C++ (from what I can tell).

The entire source SDK seems somewhat poorly designed to be honest - these enums should be part of the SDK not reverse engineered by hand, and 'hacking' access to implementation classes to get at information shouldn't be necessary, but hey. We can but hope they do better with future versions of the engine, since it's extremely unlikely they'll fix ever the existing SDKs.

SizzlingCalamari commented 11 years ago

@StewartAtkins You're right that it's not easy, but there is a way.

You can read the m_ScoreData and m_RoundScoreData send props for each player entity to get the scoreboard information, but you'll need some code to enumerate the server classes and their send tables first (the send tables have the send props in them). The send props have byte offset values into the player entities for you to read.

You can start by using IServerGameDLL::GetAllServerClasses() to get the base server class list.

dy-dx commented 11 years ago

+1 for Overhealing events.

StewartAtkins commented 11 years ago

@SizzlingCalamari thanks for the tip, I'll look into it.

To add to this issue, I've also noticed that an event exists - player_bonuspoints but doesn't seem to be emitted by the server, and there isn't an alternative event with that type of information

AnAkkk commented 11 years ago

I've already had many requests to implement logging of such events in my plugin (TFTrue), so it would be nice to add them!