View Single Post
Antithasys
Moderator
Join Date: Apr 2008
Old 12-15-2008 , 01:44   Re: [L4D] Achievement Notifier
Reply With Quote #4

Further suggestions. I always wonder why people hook the say command when all they want is the chat trigger. Sourcemod does all this for you. Creating your own console command is the way to go.

Replace:
PHP Code:
RegConsoleCmd("say"Command_SayChat);
 
public 
Action:Command_SayChat(clientargs)

 
decl String:text[192];
 if (!
GetConVarBool(cvPluginEnabled) ||
     
IsChatTrigger() ||
  
GetCmdArgString(textsizeof(text)) < 1)
  return 
Plugin_Continue;
 
 
ReplaceString(textsizeof(text), "\"""");
 
ReplaceString(textsizeof(text), " """);
 
 if (
StrEqual(text"!achievements"))
 {
  
DisplayAchievements(client);
  return 
Plugin_Handled;
 }
 
 return 
Plugin_Continue;

With:

PHP Code:
RegConsoleCmd("sm_achievements"Command_DisplayAchievements"Display Achievements");
 
public 
Action:Command_DisplayAchievements(clientargs)

 if (
GetConVarBool(cvPluginEnabled))
     
DisplayAchievements(client);
 return 
Plugin_Handled;

__________________
[my plugins]

When you think about asking a question... consider what have you tried?

Last edited by DJ Tsunami; 12-15-2008 at 07:49. Reason: Fixed some errors in your code :P
Antithasys is offline