Raised This Month: $ Target: $400
 0% 

register_clcmd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
olari9
Senior Member
Join Date: May 2009
Old 07-26-2013 , 06:54   register_clcmd
Reply With Quote #1

register_clcmd("amx_banmenu", "cmdSSmenu", ADMIN_BAN, "- displays ban menu")
If the line looks like this, then "cmdSSmenu" will be created or it will be called?
__________________
olari9 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 07-26-2013 , 07:17   Re: register_clcmd
Reply With Quote #2

I don't know too much about how this works, but I guess it will be called, it's something like:
Code:
public client_command(id) {     static cmd[32];     read_args(cmd, charsmax(cmd));         if (equal(cmd, "amw_banmenu"))     {         if (get_user_flags(id) & ADMIN_BAN)         {                       cmdSSmenu(id);         }     } } public cmdSSmenu(id) { }
TheDS1337 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-26-2013 , 17:39   Re: register_clcmd
Reply With Quote #3

Quote:
Originally Posted by DeagLe.Studio View Post
I don't know too much about how this works, but I guess it will be called, it's something like:
Code:
public client_command(id) {     static cmd[32];     read_args(cmd, charsmax(cmd));         if (equal(cmd, "amw_banmenu"))     {         if (get_user_flags(id) & ADMIN_BAN)         {                       cmdSSmenu(id);         }     } } public cmdSSmenu(id) { }
I don't know how many times you've been told to stop trying to help people but you really need to stop.
__________________
fysiks is offline
olari9
Senior Member
Join Date: May 2009
Old 07-26-2013 , 07:32   Re: register_clcmd
Reply With Quote #4

Okey thanks
__________________
olari9 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-26-2013 , 08:40   Re: register_clcmd
Reply With Quote #5

It's not exactly like this, cmdSSmenu is called for every player who type command in his console.
You have to check admin access then.

You have to check with cmd_access :

PHP Code:
public plugin_init()
{
    
register_clcmd("amx_banmenu""cmdSSmenu"ADMIN_BAN"- displays ban menu");
}

// here, accessLevel is ADMIN_BAN because it has been registered like this, and as long as you don't change it in configs/cmdaccess.ini
public cmdSSmenu(idaccessLevelcommandIndex)
{
    if( 
cmd_access(idaccessLevelcommandIndex0) )
    {
        
// execute code here
    
}
    return 
PLUGIN_HANDLED;

4th arg of cmd_access is the number of arguments required in order to the command can work correctly, command included, so in your case it's 1, but you can pass 0 as well, cmd_access will take in account that number as minimum, so if 1 arg is required, you can pass 0 or 1.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 07-26-2013 , 08:45   Re: register_clcmd
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
4th arg of cmd_access is the number of arguments required in order to the command can work correctly, command included, so in your case it's 1, but you can pass 0 as well, cmd_access will take in account that number as minimum, so if 1 arg is required, you can pass 0 or 1.
Now I get it, thank you for your explanation
TheDS1337 is offline
olari9
Senior Member
Join Date: May 2009
Old 08-12-2013 , 05:36   Re: register_clcmd
Reply With Quote #7

Thanks alot guys, it was really heplful
__________________
olari9 is offline
Old 10-02-2013, 04:32
Phant
This message has been deleted by ConnorMcLeod. Reason: Don't highjack other member threads, thanks
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 20:13.


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