AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   Triggers (https://forums.alliedmods.net/showthread.php?t=67098)

theY4Kman 02-15-2008 18:22

Triggers
 
3 Attachment(s)
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 :grrr:

Comments? Suggestions? REQUESTS? Tell me!

Extreme_One 02-15-2008 19:12

Re: Triggers
 
:shock:

This will be cool :up:

Thank you.

Quick Query:

If I did this:

Code:

!url C say /? url
Client types !url and that would trigger the client to say /? url

Or would I need to do:

Code:

!url C say "/? url"
or maybe

Code:

!url C "say /? url"
I just want to make sure I get the syntax correct. ;)

theY4Kman 02-15-2008 20:09

Re: Triggers
 
They all would work.

The plugin parses the config by finding the first space, then selecting all the text behind it for the message. Next, it takes the letter after that first space for the type. Finally, it takes all of the text after the space behind the type character for the command. So...
Code:

!url C say /? url
!url C "say /? url"
!url C say "/? url"

...all do the same exact thing.

Extreme_One 02-16-2008 05:10

Re: Triggers
 
Thanks theY4Kman

Extreme_One 02-16-2008 15:44

Re: Triggers
 
This has quite limited use :(

Code:

!url C say /? url
Code:

Extreme_One's Σvîl †ŵiή :  !url
FCVAR_SERVER_CAN_EXECUTE prevented server running command: say


theY4Kman 02-16-2008 16:35

Re: Triggers
 
I shall fix it when I get home.

Yeah, it's more of an announcement for anyone else using the plugin :P

Extreme_One 02-16-2008 17:45

Re: Triggers
 
Quote:

Originally Posted by theY4Kman (Post 586179)
I shall fix it when I get home.

Yeah, it's more of an announcement for anyone else using the plugin :P


yeah the fix will be great :up:

theY4Kman 02-18-2008 00:11

Re: Triggers
 
The new version is up! It still doesn't have multi-word functionality for the message, but I think I'll program that in only when someone needs it. Yeah, screw you; I'm lazy. I want to play TF2.

Extreme_One 02-18-2008 15:14

Re: Triggers
 
Nice one.

Thanks for the update.

Rebell 02-19-2008 02:40

Re: Triggers
 
GOODY ^^


All times are GMT -4. The time now is 20:17.

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