Rnen / AdminToolbox

A SMod2 Server Administration Toolbox Plugin for SCP: Secret Lab
Creative Commons Attribution Share Alike 4.0 International
16 stars 10 forks source link

ATBAN reason parameter is broken, cannot handle spaces #84

Closed PatPeter closed 4 years ago

PatPeter commented 5 years ago

Version (please complete the following information):

Describe the bug

I typed the following on my server:

atban PatPeter 76561297984998697 1440 "He's a badmin"

It resulted in the following ban line:

PatPeter;76561297984998697;636891604550120450;"He's;|UGA|PatPeter;636890740550120450

To Reproduce

Steps to reproduce the behavior:

  1. Type atban YourName SteamID 1440 "Reason in quotes here"
  2. Open SteamIdBans.txt and scroll to the bottom.
  3. You will not see the entire reason for your ban.

Expected behavior

The ban file should contain the ban reason with spaces.

Additional text

Here's the code I use in my callvote plugin to get quoted command parameters without the command itself.

                    string[] quotedArgs = Regex.Matches(string.Join(" ", ev.Command), "[^\\s\"\']+|\"([^\"]*)\"|\'([^\']*)\'")
                        .Cast<Match>()
                        .Select(m => m.Value)
                        .ToArray()
                        .Skip(1)
                        .ToArray();

However, this code does not remove the quotations so you'll have to do a trim on the result.

Rnen commented 5 years ago

Yeah... that would be me doing an oopsie image

While its supposed to be image

Rnen commented 5 years ago

Or actually, this should properly do it image