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

Registering a Console Command.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vodka00
Veteran Member
Join Date: Jun 2012
Location: Los Angeles
Old 05-10-2014 , 20:23   Registering a Console Command.
Reply With Quote #1

Hi,

There is a serverhop plugin that has a command registered in such way that the plugin to hide chat triggers doesn't pick it up.

Code:
public Action:Command_Say( client, args )
{
  new String:text[MAX_STR_LEN];
  new startidx = 0;

  if ( !GetCmdArgString( text, sizeof( text ) ) ) {
    return Plugin_Continue;
  }

  if ( text[strlen( text) - 1] == '"' ) {
    text[strlen( text )-1] = '\0';
    startidx = 1;
  }

  new String:trigger[MAX_STR_LEN];
  GetConVarString( cv_hoptrigger, trigger, sizeof( trigger ) );

  if ( strcmp( text[startidx], trigger, false ) == 0 || strcmp( text[startidx], "!hop", false ) == 0 ) {
    ServerMenu( client );
  }

  return Plugin_Continue;
}
I tried to do RegConsoleCmd("sm_hop", ServerMenu(client), "Hop servers."); but that didn't work lol
Is there a way to use RegConsoleCmd with this without a major rewrite of the plugin?
Thanks for any help!
__________________
cw main:

cw speedruns:

Last edited by vodka00; 05-10-2014 at 20:24.
vodka00 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-10-2014 , 21:55   Re: Registering a Console Command.
Reply With Quote #2

You'd have to create a stub for the command, like this:

PHP Code:
public Action:Command_Hop(clientargs)
{
    
ServerMenu(client);
    return 
Plugin_Handled;

and then do a RegConsoleCmd on that instead:

PHP Code:
RegConsoleCmd("sm_hop"Command_Hop"Hop servers."); 
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-10-2014 at 21:55.
Powerlord is offline
vodka00
Veteran Member
Join Date: Jun 2012
Location: Los Angeles
Old 05-10-2014 , 23:07   Re: Registering a Console Command.
Reply With Quote #3

It worked perfectly, thank you!
__________________
cw main:

cw speedruns:
vodka00 is offline
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 05-11-2014 , 18:35   Re: Registering a Console Command.
Reply With Quote #4

But this will register !hop public chat trigger still.
xf117 is offline
Send a message via ICQ to xf117
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 05-12-2014 , 00:58   Re: Registering a Console Command.
Reply With Quote #5


fuck I hate to see kz_yonkoma before I have to leave home

on-topic:
remove the "say" and "say_team" command registers
__________________
retired
shavit 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 10:35.


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