Raised This Month: $12 Target: $400
 3% 

FireGameEvent problem: no name and no data in events


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smaaps
New Member
Join Date: Dec 2004
Old 12-09-2004 , 08:12   FireGameEvent problem: no name and no data in events
Reply With Quote #1

I finally managed to compile (debian 3.0 testing / gcc342) the Serverplugin_Empty and make it load on my cssource server. (If anyone needs help there .. [email protected])

Unfortunaly I have a number of problems with the events that are passed through FireGameEvent ...

First of all, the sample code in the plugin
..
const char * name = event->GetName();
Msg( "CEmptyServerPlugin::FireGameEvent: Got event + \"%s\" + \n", name );
..
which tries just to show the name of the events does not give useful information. Most times it does not give a name at all, sometimes it gives odd characters live yyyyyyyoi.

Using the GetNameSymbol() method of the KeyValues class at least gives a unique number, that is supposed to identify the events. It would be more comfortable though if I could get strings so I wouldnt have to try to figure out what real events these numbers stand for. When i look at these nummbers on the server console, they seem to make sense because the same numbers appear, when I do similar actions in the game.

The second problem is, that these events seem to contain no data. When I use the sample code of the KeyValues.h file to iterate through the subkeyvalue of the event pairs ... i get nothing at all:

..
for ( KeyValues *pKey = event->GetFirstTrueSubKey(); pKey; pKey = pKey->GetNextTrueSubKey() )
{
Msg( "Key name: %s\n", pKey->GetName() );
}
..

So please. Does anyone know how to get the correct event names and how to access their data? It would really help in developing a plugin


SAMPLE LOG:
CEmptyServerPlugin::FireGameEvent: Got event + "684" +
CEmptyServerPlugin::FireGameEvent: Got event + "684" +
CEmptyServerPlugin::FireGameEvent: Got event + "684" +
L 12/09/2004 - 1271: "[CH]RaMpAgE<5><STEAM_0:1:5108607><TERRORIST>" triggered "Dropped_The_Bomb"
CEmptyServerPlugin::FireGameEvent: Got event + "1072" +
L 12/09/2004 - 1271: "bgm | smaaps<2><STEAM_0:0:6817><CT>" killed "[CH]RaMpAgE<5><STEAM_0:1:5108607><TERRORIST>" with "deagle"
CEmptyServerPlugin::FireGameEvent: Got event + "653" +
L 12/09/2004 - 1271: Team "CT" triggered "CTs_Win" (CT "6") (T "3")
L 12/09/2004 - 1271: Team "CT" scored "6" with "2" players
L 12/09/2004 - 1271: Team "TERRORIST" scored "3" with "3" players
L 12/09/2004 - 1271: World triggered "Round_End"
CEmptyServerPlugin::FireGameEvent: Got event + "933" +
CEmptyServerPlugin::FireGameEvent: Got event + "921" +
L 12/09/2004 - 1277: "[CH]RaMpAgE<5><STEAM_0:1:5108607><TERRORIST>" triggered "Got_The_Bomb"
CEmptyServerPlugin::FireGameEvent: Got event + "1085" +
L 12/09/2004 - 127:41: World triggered "Round_Start"
CEmptyServerPlugin::FireGameEvent: Got event + "684" +
L 12/09/2004 - 127:42: "[CH]RaMpAgE<5><STEAM_0:1:5108607><TERRORIST>" killed "nOOk<6><STEAM_0:1:2828226><TERRORIST>" with "galil" (headshot)
CEmptyServerPlugin::FireGameEvent: Got event + "653" +
smaaps is offline
XAD
Senior Member
Join Date: Mar 2004
Location: Sweden
Old 12-09-2004 , 08:50  
Reply With Quote #2

Had the same problem with the example code (ie no data)...

This is what I'm using with no problems...

Code:
#define VNAME "EMPTY"

// Data type
enum types_t
{
	TYPE_NONE = 0,
	TYPE_STRING,
	TYPE_INT,
	TYPE_FLOAT,
	TYPE_PTR,
	TYPE_WSTRING,
	TYPE_COLOR,
	TYPE_NUMTYPES, 
};

void CMembersServerPlugin::FireGameEvent( KeyValues * event )
{
	const char * name = event->GetName();
	Msg( "[%s] DEBUG: CMPS::FireGameEvent: Got event \"%s\"\n", VNAME, name );
	Msg( "( " );
	for( KeyValues *pKey = event->GetFirstSubKey(); pKey; pKey = pKey->GetNextKey() )
	{
		switch( pKey->GetDataType() )
		{
			case TYPE_STRING:
				Msg( "\"%s\" \"%s\"; ", pKey->GetName(), pKey->GetString() );
				break;
			case TYPE_INT:
				Msg( "\"%s\" %d; ", pKey->GetName(), pKey->GetInt() );
				break;
			case TYPE_FLOAT:
				Msg( "\"%s\" %f; ", pKey->GetName(), pKey->GetFloat() );
				break;
			default:
				Msg( "\"%s\" <#%d>; ", pKey->GetName(), pKey->GetDataType() );
				break;
		}
	}
	Msg( ")\n" );
}
XAD is offline
XAD
Senior Member
Join Date: Mar 2004
Location: Sweden
Old 12-09-2004 , 08:51  
Reply With Quote #3

ouch... quote instead of edit...
XAD is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode