Page 1 of 1

How to get args using SayCommand?

Posted: Fri Sep 02, 2016 12:34 pm
by Kill
Hello,

I've been trying to use SayCommand, but can't figure out how to get arguments(!respawn <PLAYER>), how do args work with SayCommand? Is it the right thing to use?

Re: How to get args using SayCommand?

Posted: Fri Sep 02, 2016 12:46 pm
by Ayuto

Syntax: Select all

from commands.say import SayCommand

@SayCommand('!respawn')
def on_respawn(command, index, team_only):
print('Arg 0:', command[0])
print('All args:', tuple(command))

Though, if you want a more intelligent and secure way, you should take a look at this:
http://wiki.sourcepython.com/developing ... mands.html

Re: How to get args using SayCommand?

Posted: Fri Sep 02, 2016 12:49 pm
by Kill
Ayuto wrote:

Syntax: Select all

from commands.say import SayCommand

@SayCommand('!respawn')
def on_respawn(command, index, team_only):
print('Arg 0:', command[0])
print('All args:', tuple(command))

Though, if you want a more intelligent and secure way, you should take a look at this:
http://wiki.sourcepython.com/developing ... mands.html


Awesome, thank You sir :)

EDIT; what is the team_only?

Re: How to get args using SayCommand?

Posted: Fri Sep 02, 2016 12:53 pm
by satoon101
Whether 'say' or 'say_team' was used when issuing the command.

Re: How to get args using SayCommand?

Posted: Fri Sep 02, 2016 1:31 pm
by Kill
satoon101 wrote:Whether 'say' or 'say_team' was used when issuing the command.


Does it support(SayCommand) silent commands?

Re: How to get args using SayCommand?

Posted: Fri Sep 02, 2016 1:48 pm
by Ayuto
Yes, all you need to do is returning CommandReturn.BLOCK. If nothing was returned, it will handle it like CommandReturn.CONTINUE.

Re: How to get args using SayCommand?

Posted: Fri Sep 02, 2016 1:49 pm
by Kill
Ayuto wrote:Yes, all you need to do is returning CommandReturn.BLOCK. If nothing was returned, it will handle it like CommandReturn.CONTINUE.


Thanks!

offtopic: whats the point of "Notifications"(Forums)? It doesnt notify me if someone posted on my thread

Re: How to get args using SayCommand?

Posted: Fri Sep 02, 2016 1:57 pm
by decompile
Ayuto wrote:

Syntax: Select all

from commands.say import SayCommand

@SayCommand('!respawn')
def on_respawn(command, index, team_only):
print('Arg 0:', command[0])
print('All args:', tuple(command))

Though, if you want a more intelligent and secure way, you should take a look at this:
http://wiki.sourcepython.com/developing ... mands.html


Cool!
Never heard of that secure way, gonna save that link :)

Re: How to get args using SayCommand?

Posted: Fri Sep 02, 2016 2:19 pm
by L'In20Cible
Kill wrote:offtopic: whats the point of "Notifications"(Forums)? It doesnt notify me if someone posted on my thread

You should see the number of notifications you have above the following icon:

notifications.PNG
notifications.PNG (30.03 KiB) Viewed 10272 times


If you click on that bell, you will be redirected to your notifications feed: ucp.php?i=ucp_notifications

You can configurate your notifications in your user panel: ucp.php?i=ucp_notifications&mode=notification_options

Re: How to get args using SayCommand?

Posted: Fri Sep 02, 2016 2:30 pm
by Kill
L'In20Cible wrote:
Kill wrote:offtopic: whats the point of "Notifications"(Forums)? It doesnt notify me if someone posted on my thread

You should see the number of notifications you have above the following icon:

notifications.PNG

If you click on that bell, you will be redirected to your notifications feed: ucp.php?i=ucp_notifications

You can configurate your notifications in your user panel: ucp.php?i=ucp_notifications&mode=notification_options



Ye ye, I had everything configured, for some reason now it notified me :P Thanks