Raised This Month: $ Target: $400
 0% 

[ Solved ] register_concmd (vers fast ^^)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-17-2012 , 04:55   [ Solved ] register_concmd (vers fast ^^)
Reply With Quote #1

Hello,

Can someone explain to me one of this argument :
Code:
register_concmd("hnsxp_give_xp", "CmdGiveXP", ADMIN_RCON, "<nick, #userid, authid> <xp>");

Only this : "<nick, #userid, authid> <xp>"
why they are < ... , ... , ... > < ... > and not < ... > < ... > < ... > < ... > or < ... > < ... , ... > etc ...

and why they are a # before userid ?

Thanks
__________________
Pawn ? Useless
Aooka is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-17-2012 , 04:59   Re: [REQ] register_concmd (vers fast ^^)
Reply With Quote #2

It is just the description, it does not do anything.

But, the reason why there are 3 values in the first one is because it will accept any of those 3 as the first arg

The # in front of userid is required by cmd_target, otherwise it assumes you are searching by nick.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-17-2012 , 05:09   Re: [REQ] register_concmd (vers fast ^^)
Reply With Quote #3

Okay thanks a lot

Solved
__________________
Pawn ? Useless
Aooka is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2012 , 12:25   Re: [REQ] register_concmd (vers fast ^^)
Reply With Quote #4

Also, it is common to represent required arguments with <...> and optional arguments with [...].
__________________
fysiks is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-17-2012 , 12:31   Re: [REQ] register_concmd (vers fast ^^)
Reply With Quote #5

Like this :
Code:
register_concmd( "amx_givem4a1" , "CmdGive" , ADMIN_ADMIN , "<nick> [#userid] <xp>");
?
__________________
Pawn ? Useless
Aooka is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2012 , 12:35   Re: [REQ] register_concmd (vers fast ^^)
Reply With Quote #6

Quote:
Originally Posted by Aooka View Post
Like this :
Code:
register_concmd( "amx_givem4a1" , "CmdGive" , ADMIN_ADMIN , "<nick> [#userid] <xp>");
?
Kind of but you can't have required arguments after your first optional argument. Also, there is no point in having two arguments that refer to the same thing. The three types of things that you can put in the first argument as shown in your first post should not be broken up into multiple arguments.

A good example of optional arguments is amx_ban:

PHP Code:
    register_concmd("amx_ban""cmdBan"ADMIN_BAN"<name or #userid> <minutes> [reason]"
You can ban someone without giving a reason which is totally acceptable.
__________________
fysiks is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-17-2012 , 12:40   Re: [REQ] register_concmd (vers fast ^^)
Reply With Quote #7

Oh thanks i understand
__________________
Pawn ? Useless
Aooka 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 06:13.


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