'command' variable doesn't seem right in the SayCommand listener

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

'command' variable doesn't seem right in the SayCommand listener

Postby BackRaw » Sun Jan 25, 2015 2:10 pm

Hi,

I have the following code:

Syntax: Select all

from commands.say import SayCommand

from players.helpers import index_from_playerinfo

from messages import SayText2


@SayCommand("flashtop")
def saycommand_flashtop(playerinfo, teamonly, command):
"""
Gets called whenever a player types 'flashtop' in the chat.
"""

SayText2(message="command: {0}, {1}".format(command[0], command[1]).send(index_from_playerinfo(playerinfo))
The output is

Code: Select all

flashtop 4
=> say, flashtop 4
Was this intended or is there something wrong? lol
My Github repositories:

Source.Python: https://github.com/backraw
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Jan 25, 2015 3:23 pm

Technically this is 100% correct. 'say' is a server command and it gets passed along with the Command instance that we pass. We 'might' look to change it in the future to not pass the actual command, since we pass the teamonly value (which is determined by whether 'say' or 'say_team' is used).

For reference:
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/commands/say_commands_wrap.cpp#L69
Image
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Postby BackRaw » Sun Jan 25, 2015 4:07 pm

satoon101 wrote:Technically this is 100% correct. 'say' is a server command and it gets passed along with the Command instance that we pass. We 'might' look to change it in the future to not pass the actual command, since we pass the teamonly value (which is determined by whether 'say' or 'say_team' is used).

For reference:
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/commands/say_commands_wrap.cpp#L69


Makes sense. I'm fine with it :)
My Github repositories:

Source.Python: https://github.com/backraw

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 17 guests