Raised This Month: $32 Target: $400
 8% 

Replacement for NetworkIDValidated?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
showdax
Senior Member
Join Date: Dec 2004
Old 09-08-2005 , 07:48   Replacement for NetworkIDValidated?
Reply With Quote #1

Is there any way to get the functionality that IServerPluginCallbacks::NetworkIDValidated provided, with sourcemm? I'm writing a plugin that needs this information as soon as it's known. Getting it on ClientActive won't due.

I know you guys don't like the function because it doesn't give useful information, but for my purposes it's enough. If there's no way to use this with sourcemm, what's the best way to find out when a networkid has been set?
showdax is offline
Send a message via MSN to showdax
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 09-08-2005 , 13:11  
Reply With Quote #2

BAILOPAN:
Quote:
The client callbacks are quiet useless, you have, in the order they're called:
ClientConnect :: almost no useful info
ClientChanged
ClientNetworkIdValidated :: no useful info or edict
ClientPutInServer :: IPlayerInfo will be a corrupt pointer
ClientActive :: IPlayerInfo is valid, but ::IsConnected() returns false!

As you can see, it's not pretty...
If you still think you need NetworkIdValidated you can use it in sourcemm. See the sample_mm plugin for how to hook the callbacks.
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
showdax
Senior Member
Join Date: Dec 2004
Old 09-09-2005 , 00:10  
Reply With Quote #3

I can't seem to get a working instance of the interface. Both of the below return NULL:
Code:
m_ServerPluginCallbacks = (IServerPluginCallbacks *)((ismm->engineFactory())(INTERFACEVERSION_ISERVERPLUGINCALLBACKS, NULL));
Code:
m_ServerPluginCallbacks = (IServerPluginCallbacks *)((ismm->serverFactory())(INTERFACEVERSION_ISERVERPLUGINCALLBACKS, NULL));
showdax is offline
Send a message via MSN to showdax
showdax
Senior Member
Join Date: Dec 2004
Old 09-09-2005 , 06:33  
Reply With Quote #4

As per BAILOPAN's suggestion, I made it queue up players for checking in GameFrame() until their networkids are validated. Here's basically what I did:
Code:
bool Plugin::ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
{
	[add player to pending players list]

	if (strcmp([player's steamid via IVEngineServer::GetPlayerNetworkID], "STEAM_ID_PENDING") == 0)
		g_IsPending = true;

	RETURN_META_VALUE(MRES_HANDLED, true);
}
And then in GameFrame:

Code:
void Plugin::GameFrame(bool simulating)
{
	if (g_IsPending)
	{
		if (g_Globals->curtime > g_Timer) // g_Globals is CGlobalVars
		{
			g_Timer = g_Globals->curtime + 0.5;

			[function that checks each pending player's steamid and removes them from the pending list if they're validated]

			if ([count of pending player list] < 1)
				g_IsPending = false;

			RETURN_META(MRES_HANDLED);
		}
	}

	RETURN_META(MRES_IGNORED);
}
showdax is offline
Send a message via MSN to showdax
Mani
Veteran Member
Join Date: Dec 2004
Location: UK
Old 11-07-2005 , 08:16  
Reply With Quote #5

Strangley enough I've just implemented a similar version based on this as I need a proper edict on steam id validation (for admin level functionality).

Though in mine the cue is on ClientActive() which does have a valid edict pointer and at that time may also have a valid network ID so potentially saves overhead in GameFrame().

Mani
__________________
Installation files, documentation and help can be found at: -

www.mani-admin-plugin.com
Mani is offline
BAILOPAN
Join Date: Jan 2004
Old 11-07-2005 , 10:59  
Reply With Quote #6

He's only making gameframe "think" every .5 seconds so it's not adding any overhead (considering what the engine calculates every frame, doing a float comparison is a drop in the bucket).

I think technically a network id can be validated after ClientActive though? At least in HL1, it was rare, but it could even happen after PutInServer.
__________________
egg
BAILOPAN is offline
Mani
Veteran Member
Join Date: Dec 2004
Location: UK
Old 11-07-2005 , 14:13  
Reply With Quote #7

Quote:
Originally Posted by BAILOPAN
He's only making gameframe "think" every .5 seconds so it's not adding any overhead (considering what the engine calculates every frame, doing a float comparison is a drop in the bucket).

I think technically a network id can be validated after ClientActive though? At least in HL1, it was rare, but it could even happen after PutInServer.
Yeah I do mine once a second, like you say it's negligable overhead compared to what the source engine is doing

Looking at my logs in most cases the network id is already validated by the time ClientActive() is called in which case there is no point putting it on a list to be processed, you might as well call the substitute NetworkIDValidated() function. Occasionally however the network ID is not validated when ClientActive() is called (sometimes it's never validated !!) so that's when I put it on the list for processing during the game frame.

Mani
__________________
Installation files, documentation and help can be found at: -

www.mani-admin-plugin.com
Mani is offline
showdax
Senior Member
Join Date: Dec 2004
Old 11-07-2005 , 15:44  
Reply With Quote #8

This was for a reserved slot plugin, which is why I wanted the network ID as soon as it was known. It would be pretty annoying to join a server and completely load the level, only to find out the server doesn't have room for you.
showdax is offline
Send a message via MSN to showdax
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 10:38.


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