AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ Solved ] register_concmd (vers fast ^^) (https://forums.alliedmods.net/showthread.php?t=187729)

Aooka 06-17-2012 04:55

[ Solved ] register_concmd (vers fast ^^)
 
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

YamiKaitou 06-17-2012 04:59

Re: [REQ] register_concmd (vers fast ^^)
 
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.

Aooka 06-17-2012 05:09

Re: [REQ] register_concmd (vers fast ^^)
 
Okay thanks a lot :D

Solved :D

fysiks 06-17-2012 12:25

Re: [REQ] register_concmd (vers fast ^^)
 
Also, it is common to represent required arguments with <...> and optional arguments with [...].

Aooka 06-17-2012 12:31

Re: [REQ] register_concmd (vers fast ^^)
 
Like this :
Code:
register_concmd( "amx_givem4a1" , "CmdGive" , ADMIN_ADMIN , "<nick> [#userid] <xp>");
?

fysiks 06-17-2012 12:35

Re: [REQ] register_concmd (vers fast ^^)
 
Quote:

Originally Posted by Aooka (Post 1730561)
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.

Aooka 06-17-2012 12:40

Re: [REQ] register_concmd (vers fast ^^)
 
Oh thanks i understand :D


All times are GMT -4. The time now is 06:13.

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