Thread: Triggers
View Single Post
Author Message
theY4Kman
Join Date: Jun 2007
Location: Yak
Old 02-15-2008 , 18:22   Triggers
Reply With Quote #1

To remedy FS#1059, I created this plugin. It does the same exact thing as commandlist.txt does for Mani Admin Plugin. EDIT: This plugin now offers more advanced features than Mani's commandlist.txt, such as variables and multiple flags.

You create a commandlist.txt (or commandlist.cfg) file in your sourcemod/configs directory and enter the commands.

I have written down all the instructions in the default commandlist.txt, which you can find in the archive files, or look at the copy and paste here:
Code:
// Triggers configuration file 
//       by theY4Kman 
// 
// So, here's the rundown! 
// Commands are entered using the format "<command> <flags> <replacement>" 
//  
// For example: 
//    die C kill 
//  
// When the player types "die" into chat, it will run "kill" on them, 
// forcing them to suicide. 
// 
// Here are the core flags (One needs at least one of these flags to do anything): 
//  R - Rcon command 
//      To run this, the user must have Rcon or Root access 
//  C - Client command 
//      Run on the player 
//      Note: only commands with FCVAR_SERVER_CAN_EXECUTE will run 
//  F - Fake client command 
//      Runs a networked command as if a player had done it 
//  S - Fake client say command 
//      Convenience flag that runs a fake client command with "say" in front of it 
//      So "hi S Hi!" is the same as "hi F say Hi!" 
//  
// These next flags are optional: 
//  v - No variables (Disables the parsing of variables) 
//      "hi S Hi, I'm %n!" will actually display "Hi, I'm %n!" 
//  d - Do not display the player's message
//  f - Begins a block denoting the flags necessary to run the trigger.
//      After the letter, a block beginning with '{' and ending with '}' will contain
//      admin flags required for this trigger. For example:
//         "kick Rf{c} sm_kick"
//      This will let any admin with the kick admin flag execute this trigger.
//      If this flag is left out, Triggers will use the admin flags in the cvar "triggers_rcon"
//      If one wishes to simply have a command without permissions, use a lone 'f' character.
//         e.g., "killme Rf sm_slay %n" is the same as "killme Rf{} sm_slay %n" 
// 
// Yes, there are variables in this, if only a few. 
// The variables are in C-type format, meaning they are a percent sign followed by a single character: 
//  %i - The IP of the server 
//  %s - The Steam ID of the player whom triggered the command 
//  %n - The name of the player whom triggered the command 
//  %u - The user ID of the player whom triggered the command 
//  %h - The hostname of the server
//  %c - Begins a custom ConVar block.
//       This allows one to access ConVars besides "ip" and "hostname"
//       To utilize it, use the same syntax as for the `f` flag:
//          %c{convar_name}
// To display a literal '%', prepend it with a backslash ('\') 
// 
// The only comment type available is the single line comment. 
// To use it, place "//" IN FRONT OF THE LINE. It will not work anywhere else 
// 
// Note: For chat messages, the longest a message can be is 127 characters long. 
//       This includes players' names, hostname, etc!
Notes:
  • 'message' can currently only be one word -- I don't see this changing in the future. It's unnecessary most of the time, and would require work. Work. THIS IS AN OUTRAGE!
Commands/Cvars:
  • triggers_version: The version of Triggers
  • triggers_reload: Clears the commandlist in memory and loads a new one. You can specify a filename to use for loading by calling it by "triggers_reload file"
  • triggers_rcon: The SourceMod Admin flags that allow someone to run an Rcon command. The person must have at least one of the flags (Flag reference here). (v2.2.0: This convar can be overridden on a per-trigger basis)
Changelog:
  • 1.0.0
    * Initial upload
    * Basic functionality: Run a command when something is said
  • 1.1.0
    * Bug fix: Added 'F' and 'S' flags for fake client commands.
  • 1.2.0
    * Bug fix: Fixed the permission issues
  • 2.0.0
    * Multiple flags for each command
    * Variables
  • 2.1.0
    * triggers_rcon convar, allowing for custom access to Rcon triggers.
  • 2.1.1
    * Fixed command replacement parsing.
  • 2.2.0
    * Per-trigger RCON permissions
  • 2.2.1
    * Fixed per-trigger RCON permissions to allow empty permissions.
  • 2.3.0
    * Added custom ConVar variable
    * Added user ID variable
teame06 is dumb

Comments? Suggestions? REQUESTS? Tell me!
Attached Files
File Type: sp Get Plugin or Get Source (triggers.sp - 3287 views - 13.7 KB)
File Type: rar triggers.7z.rar (10.7 KB, 1303 views)
File Type: zip triggers.zip (11.4 KB, 1970 views)
__________________
http://y4kstudios.com
Is that loud enough? Oh, while I have you, check out Viper.

Last edited by theY4Kman; 09-19-2008 at 23:19. Reason: New version: 2.3.0
theY4Kman is offline
Send a message via ICQ to theY4Kman Send a message via AIM to theY4Kman Send a message via MSN to theY4Kman Send a message via Yahoo to theY4Kman Send a message via Skype™ to theY4Kman