Raised This Month: $51 Target: $400
 12% 

AddCommandListener arguments bug?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 09-22-2015 , 22:24   AddCommandListener arguments bug?
Reply With Quote #1

Is this a bug? I'm using the current stable sourcemod build 5255, running on TF2.

Whenever you type something in chat for example "hello world a b c", the number of arguments printed out is always 1.

But if you type "say hello world a b c" in the console, the number of arguments printed is 5.

Here was a test i was doing., unless i'm doing something wrong.
PHP Code:
#pragma newdecls required
#include <sourcemod>

public void OnPluginStart() {
    
AddCommandListener(OnCommandSay"say");
    
AddCommandListener(OnCommandSay"say_team");
}

public 
Action OnCommandSay(int client, const char[] commandint args) {
    
PrintToChatAll("%d"args);

__________________
Chaosxk is offline
psychonic

BAFFLED
Join Date: May 2008
Old 09-22-2015 , 22:55   Re: AddCommandListener arguments bug?
Reply With Quote #2

It's not a bug.

In the first case, the game client is sending the full chat text as quoted, so literally:
Code:
say "hello world a b c"
Unlike when you manually type this in console:
Code:
say hello world a b c
This was a relatively recent change in the TF2 game client, and much more recent in other games on the same branch (CS:S, DoD:S, etc.).

As an aside, you should ideally just listen to the OnClientSayCommand forward, rather than manually adding listeners for say and say_team.
psychonic is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 09-22-2015 , 23:22   Re: AddCommandListener arguments bug?
Reply With Quote #3

Ah, thanks for the clarification.

OnClientSayCommand. this is going to be handy. Thanks.
__________________
Chaosxk is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:15.


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