Raised This Month: $ Target: $400
 0% 

register_concmd not working?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 07-01-2020 , 15:47   Re: register_concmd not working?
Reply With Quote #1

I was trying to help some guy on this forum, I got to here, but I only get Unknown Command
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define VERSION "1.8"

public plugin_init()
{
    
register_plugin("Client Side Cvar? Kinda"VERSION"Mr. Boopsy");
    
register_concmd("amx_hasbeenbanned","check_for_cvar",ADMIN_BAN,"<nick> <value>");
}

public 
client_authorized(id)
{
    static 
szInfo[32];
    
get_user_info(id"is_good_guy"szInfocharsmax(szInfo));

    if(
str_to_num(szInfo) == 1//change 1 for any assigned value
    
{
        
//this will be executed if user has his "cvar" set to 1
    
}
}

public 
check_for_cvar()
{
    new 
name[32];     
    
read_argvname 31 );   

    new 
arg[2];
    
read_argvarg 1)

    new 
tempID get_user_index(name);

    
set_user_info(tempID"is_good_guy"arg);

__________________
Contact! || Discord:
Mr_Boopsy_#2066
supertrio17 is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 07-01-2020 , 15:56   Re: register_concmd not working?
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #define VERSION "1.8" public plugin_init() {     register_plugin("Client Side Cvar? Kinda", VERSION, "Mr. Boopsy");     register_concmd("amx_hasbeenbanned","check_for_cvar",ADMIN_BAN,"<nick> <value>"); } public client_authorized(id) {     static szInfo[32];     get_user_info(id, "is_good_guy", szInfo, charsmax(szInfo));     if(str_to_num(szInfo) == 1) //change 1 for any assigned value     {         //this will be executed if user has his "cvar" set to 1     } } public check_for_cvar(id,level,cid) {     if(!cmd_access(id,level,cid,3))         return PLUGIN_HANDLED;     new arg[32], arg2[32];             read_argv(1,arg,32);     read_argv(2,arg2,31);         new name = cmd_target(id,arg,2);     if(!player) return PLUGIN_HANDLED;         new value = str_to_num(arg2);     client_cmd(name, "is_good_guy ^"%s^"", value)         return PLUGIN_HANDLED; }

Code:
if(!player) return PLUGIN_HANDLED;
To --->
Code:
if(!name) return PLUGIN_HANDLED;

Last edited by alferd; 07-02-2020 at 04:09. Reason: fixed
alferd is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-01-2020 , 16:41   Re: register_concmd not working?
Reply With Quote #3

Quote:
Originally Posted by supertrio17 View Post
I was trying to help some guy on this forum, I got to here, but I only get Unknown Command
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define VERSION "1.8"

public plugin_init()
{
    
register_plugin("Client Side Cvar? Kinda"VERSION"Mr. Boopsy");
    
register_concmd("amx_hasbeenbanned","check_for_cvar",ADMIN_BAN,"<nick> <value>");
}

public 
client_authorized(id)
{
    static 
szInfo[32];
    
get_user_info(id"is_good_guy"szInfocharsmax(szInfo));

    if(
str_to_num(szInfo) == 1//change 1 for any assigned value
    
{
        
//this will be executed if user has his "cvar" set to 1
    
}
}

public 
check_for_cvar()
{
    new 
name[32];     
    
read_argvname 31 );   

    new 
arg[2];
    
read_argvarg 1)

    new 
tempID get_user_index(name);

    
set_user_info(tempID"is_good_guy"arg);

Also answer the second question ans do the debugging step I suggestes. Or just take the fixed code and call it a day lol.
__________________
HamletEagle 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 17:13.


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