CounterStrikeSharp icon indicating copy to clipboard operation
CounterStrikeSharp copied to clipboard

EventPlayerChat.Text only includes the first piece of a say bind

Open charliethomson opened this issue 2 years ago • 0 comments

Given a bind is created as bind <key> say multiple space separated words or bind <key> say "multiple space separated words"

NOTE The bind "appears" to remove the quotes around the message in the say command, the chat box interprets say with n arguments as space separated image

image image

image image

https://github.com/roflmuffin/CounterStrikeSharp/blob/7b45a884d461c362f21f6aa101515a3757402795/src/core/managers/chat_manager.cpp#L65

I've fixed this in one of my plugins where I listen to the say and say_team commands (src below), but as a result of issues with RemoveCommandListener, I'm trying to replicate the same behavior in the event handler instead.

public static string GetArgRest(this CommandInfo info, int startIndex)
{
    var args = new List<string>();
    while (startIndex < info.ArgCount)
        args.Add(info.GetArg(startIndex++));

    return string.Join(" ", args);
}

charliethomson avatar Dec 29 '23 22:12 charliethomson