AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [Any?] Double Quote Fix (https://forums.alliedmods.net/showthread.php?t=271137)

ddhoward 09-06-2015 03:50

[Any?] Double Quote Fix
 
[Any?] Double Quote Fix
v. 18.0220.0

This plugin aims to provide a fix bandaid to the issue that exists in CS:GO, TF2, and probably other games, wherein any chat message which is sent through the chat box (and not through the console) has all double quote characters ( " ) changed to single quote characters ( ' ) by the client. This causes issues when typing commands with arguments enclosed in quotation marks.

The plugin works as follows:
  1. The plugin first listens for all incoming commands that aren't say or say_team, but were triggered through say or say_team. If such a command is detected, we move on to step 2, then 3.
  2. If sm_doublequotefix_doubles is set appropriately, the plugin will search for any pair of consecutive single quote characters ( '' ) and change them into a single doublequote character ( " ).
  3. If sm_doublequotefix_smartchange is set appropriately, the plugin will attempt to intelligently change any pair of remaining single quotes into double quotes. This will only happen if:
    • Two single quotes are found.
    • The first single quote is either preceded by a space, or is the first character in the argstring.
    • The second single quote is followed by either a space or the null terminator.
    • No double quote is found between the two single quotes.

Normally, the plugin should allow you to use doublequote marks as normal. However, if your argument, enclosed in quotes, contains an apostrophe, you may need to enclose the argument in FOUR quote characters (of either type) with two on each side.

The results speak for themselves. Expand the spoiler box below for a demonstration. Notice how the plugin doesn't always get it right.

Spoiler





ConVars
  • sm_doublequotefix_update 2 - Controls Updater compatibility
    • 0 : Completely disables Updater integration
    • 1 : Updater will notify you in Updater.log if an update becomes available.
    • 2 : Updater will automatically download any updates. They will be installed on the next server start or map change.
    • 3 : Updater will automatically download and immediately install any updates.

  • sm_doublequotefix_doubles 2 : (0/1/2/3) Should the plugin attempt to change all pairs of consecutive single quotes into double quotes?
    • 0 : Never do this. Completely disable this feature.
    • 1 : No by default, but allow individual players to enable it for themselves with the /settings menu.
    • 2 : Yes by default, but allow individual players to disable it for themselves with the /settings menu.
    • 3 : Always do this.


  • sm_doublequotefix_smartchange 2 : (0/1/2/3) Should the plugin attempt to intelligently change any remaining pairs of single quotes into double quotes?
    • 0 : Never do this. Completely disable this feature.
    • 1 : No by default, but allow individual players to enable it for themselves with the /settings menu.
    • 2 : Yes by default, but allow individual players to disable it for themselves with the /settings menu.
    • 3 : Always do this.

Changelog
Spoiler



Installation:
To install, simply ensure that your Sourcemod installation is up to date, and place the SMX in your plugins folder.

Please also consider installing Updater. This will let you automatically keep your plugins up-to-date.
Compiling:
The plugin requires custom includes. As such, it does not compile here on the forums. Includes required to compile the plugin are:

Downloads:
If you like what you see here, please consider donating~
http://www.paypalobjects.com/en_US/i..._donate_SM.gif

Randommagic 09-11-2015 12:16

Re: [TF2/CS:GO] Double Quote Fix
 
works like a charm. thanks.

ddhoward 09-17-2015 02:23

Re: [TF2/CS:GO] Double Quote Fix
 
Uploading new version 15.0916. Changes are:
  • Added client preferences support through clientprefs' /settings menu. Code borrowed from the Aim Names plugin, as I've never messed with menus before.

  • Changed how the cvars work, see the first post for more info. Relates to the previously listed change.

  • The "smart change" feature of the plugin will no longer replace single quote pairs if a double quote character is found between them.


Please let me know if you run into any issues. Please also consider installing Updater if you haven't already!

FlaminSarge 10-03-2016 00:21

Re: [Any?] Double Quote Fix
 
Just noticed this plugin, and was wondering: is there a reason for using a command listener rather than OnClientSayCommand()?

ddhoward 10-03-2016 00:28

Re: [Any?] Double Quote Fix
 
PHP Code:

if (!StrEqual(command"say") && !StrEqual(command"say_team") && IsChatTrigger()) { 

My plugin's code only runs when the command being sent is NEITHER of the chat commands, but was triggered through a chat command. OnClientSayCommand only fires when I don't need it to.

Further, OnClientSayCommand does not fire when the client uses a registered command with the silent trigger ('/' by default.)

I originally tried modifying the message earlier, so the modifications even show up in the chat, but it ended up being too buggy and complicated. And I still had the OnClientSayCommand problem mentioned above.

FlaminSarge 10-03-2016 18:54

Re: [Any?] Double Quote Fix
 
Hurp, I can't read.

Nice work.

Out of curiousity, if a client uses "say !<command>", does the command listener fire twice? Once for say, once for the command?

ddhoward 10-03-2016 19:09

Re: [Any?] Double Quote Fix
 
I don't think that this will cause any problems with regards to that, no. However, you've made me realize that I could probably run a StrContains near the top of the function to check for any true doublequotes. If any are found, then immediately return Plugin_Continue. [I]This paragraph was written in response to a part of the previous post that has been edited out.

In regards to the listener firing twice, that shouldn't be an issue.

BReeZ 10-03-2016 19:34

Re: [Any?] Double Quote Fix
 
could i get a quick tl;dr for what benefits this has? Other than looking nice in the chat

ddhoward 10-03-2016 19:43

Re: [Any?] Double Quote Fix
 
Quote:

Originally Posted by banjomus99 (Post 2458976)
could i get a quick tl;dr for what benefits this has? Other than looking nice in the chat

It does not look nice in the chat. This plugin does not affect the modification of doublequotes as they appear in the chat messages. The benefits are summarized in the first paragraph of the first post, and relate to doublequotes being delimiters for command arguments. Please review the spoilered demonstration with the sm_rename command, also found in the first post.

BReeZ 10-04-2016 08:03

Re: [Any?] Double Quote Fix
 
Quote:

Originally Posted by ddhoward (Post 2458978)
It does not look nice in the chat. This plugin does not affect the modification of doublequotes as they appear in the chat messages. The benefits are summarized in the first paragraph of the first post, and relate to doublequotes being delimiters for command arguments. Please review the spoilered demonstration with the sm_rename command, also found in the first post.

Ah i see :). Cheers for the answer.


All times are GMT -4. The time now is 19:49.

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