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

FindCommand("endround") doesn't work in 1.1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 10-23-2005 , 16:53   FindCommand("endround") doesn't work in 1.1
Reply With Quote #1

I used FindCommand to dispatch the endround con command without turning on sv_cheats 1. But since the update to mms 1.1, FindCommand("endround") returns NULL.

Code:
	ConCommandBase *cmds = NULL;
	ConCommand *endround = NULL;
	if (m_CVar)
	{
		cmds = m_CVar->GetCommands();
		endround = (ConCommand *)cmds->FindCommand("endround");
		if (endround)
		{
			endround->Dispatch();
		}
		else
		{
			META_LOG(g_PLAPI, "Error: can't end round");
		}
	}
I've tried with other commands (like "status") and those are found and dispatched.
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 10-23-2005 , 22:07  
Reply With Quote #2

Sorry, this was supposed to be in the coding section of the forum.
L. Duke is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 10-24-2005 , 16:24  
Reply With Quote #3

I hear that some people are having trouble with hooking the "say" command. Also, there are a lot of posts in the CSSDM section about "guns" not working. I assume that is a problem hooking the say command also.

Has any one figured out why it's not working or gotten it to work again?
L. Duke is offline
BAILOPAN
Join Date: Jan 2004
Old 10-24-2005 , 20:02  
Reply With Quote #4

Try doing it in AllPluginsLoaded() instead of Load(). My guess is similarly why it stopped working in CS:S DM 0.71. Load() occurs before DLLInit(), AllPluginsLoaded() occurs after, as stated in the 1.1 coding changes.

I've not tested it but I think that's the problem.
__________________
egg
BAILOPAN is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 10-24-2005 , 22:00  
Reply With Quote #5

I'm actually not hooking it, just calling Dispatch() so I can run the command without turning sv_cheats on. I search for the command each time I use it.

So FindCommand() is returning NULL much later than just Load or AllPluginsLoaded.

It works fine with "status" but returns NULL for "endround" or "say." I haven't tested any other commands.
L. Duke is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 11-10-2005 , 09:25  
Reply With Quote #6

Im having some problems with that too.

I can find the command pointer, but I cant hook it
Code:
void Gore::AllPluginsLoaded()
{
	ConCommandBase	*pCmd = m_CVar->GetCommands(); 

	while ( pCmd ) 
	{ 
		if ( pCmd->IsCommand() )
		{
			if ( FStrEq( pCmd->GetName(), "rcon" ) ) 
			{
				//rcon
				pRconCmd = (ConCommand *)pCmd; 
				SH_ADD_HOOK_STATICFUNC( ConCommand, Dispatch, pRconCmd, RconCommand, true );  
				break;
			}
		}
		pCmd = const_cast<ConCommandBase *>(pCmd->GetNext()); 
	}
}
If I check for pRconCmd its not NULL, but the hooked function is never called, same as with the say command, its found but never hooked.
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 11-10-2005 , 10:03  
Reply With Quote #7

Can't help you there. My problem was just that FindCommand stopped working. I finally figured out that looping through the commands and searching for it worked fine.
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
Reply



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 01:05.


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