How to get args using SayCommand?

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

How to get args using SayCommand?

Postby Kill » Fri Sep 02, 2016 12:34 pm

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?
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: How to get args using SayCommand?

Postby Ayuto » Fri Sep 02, 2016 12:46 pm

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
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: How to get args using SayCommand?

Postby Kill » Fri Sep 02, 2016 12:49 pm

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?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: How to get args using SayCommand?

Postby satoon101 » Fri Sep 02, 2016 12:53 pm

Whether 'say' or 'say_team' was used when issuing the command.
Image
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: How to get args using SayCommand?

Postby Kill » Fri Sep 02, 2016 1:31 pm

satoon101 wrote:Whether 'say' or 'say_team' was used when issuing the command.


Does it support(SayCommand) silent commands?
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: How to get args using SayCommand?

Postby Ayuto » Fri Sep 02, 2016 1:48 pm

Yes, all you need to do is returning CommandReturn.BLOCK. If nothing was returned, it will handle it like CommandReturn.CONTINUE.
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: How to get args using SayCommand?

Postby Kill » Fri Sep 02, 2016 1:49 pm

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
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: How to get args using SayCommand?

Postby decompile » Fri Sep 02, 2016 1:57 pm

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 :)
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: How to get args using SayCommand?

Postby L'In20Cible » Fri Sep 02, 2016 2:19 pm

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 6262 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
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: How to get args using SayCommand?

Postby Kill » Fri Sep 02, 2016 2:30 pm

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

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 24 guests