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

Cant catch commands...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 12-04-2004 , 23:19   Cant catch commands...
Reply With Quote #1

Code:
class myadmin : public IServerPluginCallbacks, public IGameEventListener {
public:
	myadmin();
	~myadmin();
	virtual bool			Load(	CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory );
	virtual PLUGIN_RESULT	ClientCommand( edict_t *pEntity );
	virtual void			ClientPutInServer( edict_t *pEntity, char const *playername );
	alevels					lookUpAccess(char const *playerID);
private:

};

PLUGIN_RESULT myadmin::ClientCommand(edict_t *pEntity) 
{
	const char *pcmd = eng->Cmd_Argv(0);

	Msg("myadmin::ClientCommand() got command %s\n",pcmd);


	if ( !pEntity || pEntity->IsFree() ) 
	{
		return PLUGIN_CONTINUE;
	}

	if ( FStrEq( pcmd, "n_listadmins" ) )
	{
		if (g_accUsed == 0) {
			eng->ClientPrintf(pEntity,"No admins loaded");
		}
		for (int i=0;i<g_accUsed;i++) {
			char temp[512];
			sprintf(temp,"%s /t %s",acc[i].steamid,acc[i].access);
			eng->ClientPrintf(pEntity,temp);
		}
		return PLUGIN_STOP;
	}
	return PLUGIN_CONTINUE;
}
I have that stuff. But it wont catch an of the commands, I don't even get a myadmin::ClientCommand() got command %s\n
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
BAILOPAN
Join Date: Jan 2004
Old 12-04-2004 , 23:21  
Reply With Quote #2

I think Alfred mentioned in hlcoders that this was not working right.

I could be wrong.

You might have to use the CON_COMMAND() interface to do it or register a cvar as a client variable... he talked about it.
BAILOPAN is offline
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 12-04-2004 , 23:22  
Reply With Quote #3

Ah, ok.
I'll try that.

The weird thing is, I see the event firing in the base empty plugin. I can't get it to fire in mine though :/
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 12-04-2004 , 23:24  
Reply With Quote #4

Probably because the arg isn't passed (at all?) correctly into the function?

PM is offline
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 12-04-2004 , 23:52  
Reply With Quote #5

Nm. Stupid mistake, forgot:

EXPOSE_SINGLE_INTERFACE_GLOBALVAR(myadmin, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, g_Admin);
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 12-05-2004 , 02:02  
Reply With Quote #6

Quote:
Originally Posted by devicenull
Nm. Stupid mistake, forgot:

EXPOSE_SINGLE_INTERFACE_GLOBALVAR(myadmin, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, g_Admin);
whats the definition for g_Admin?
BeetleFart is offline
BAILOPAN
Join Date: Jan 2004
Old 12-05-2004 , 02:18  
Reply With Quote #7

g_Admin would be his global instantiation of myadmin
BAILOPAN is offline
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 12-05-2004 , 02:21  
Reply With Quote #8

Quote:
Originally Posted by BAILOPAN
g_Admin would be his global instantiation of myadmin
Yeah so I figured, for now I just used the g_EmtpyServerPlugin thats already defined...
Ill have to comeup with an admin class to test it out.
Thanks
BeetleFart is offline
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 12-05-2004 , 11:23  
Reply With Quote #9

Quote:
Originally Posted by BeetleFart
Quote:
Originally Posted by BAILOPAN
g_Admin would be his global instantiation of myadmin
Yeah so I figured, for now I just used the g_EmtpyServerPlugin thats already defined...
Ill have to comeup with an admin class to test it out.
Thanks
If your just modifying the empty plugin, you don't need to add that line, I just made a new class because it was easier then replacing cemptyserverplugin everywhere, imo
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 12-05-2004 , 11:26  
Reply With Quote #10

Yea I started to create my own project and couldn't get it to work so I used the empty plugin and renamed everything.

Device did you have to add all the header files that were in the emptyplugin to your new project?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
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 22:17.


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