AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Command Not Working -solved (https://forums.alliedmods.net/showthread.php?t=187268)

Liverwiz 06-11-2012 01:51

Command Not Working -solved
 
I've got a bunch of commands in this plugin that aren't working properly and i can't figure out why. Here is the specific code that isn't working (cut from the whole thing) and i attached the entire sma, just in case there is a problem in there. Can someone tell me where my shortcoming is? Kinda bugging me....

PHP Code:

//init
    
register_clcmd("say /buybk""cmdBuy")
    
register_clcmd("say /level""cmdLevel")
    
register_clcmd("say /frags""cmdBuy")

public 
cmdLevel(id)
{
    if(
get_pcvar_num(frags_pcvar) == 0)
        return 
PLUGIN_CONTINUE
        
    client_print_color
(idDontChange"^3[BKF] %L"id"LEVEL_MSG"getLevel(id))
    return 
PLUGIN_HANDLED
}
public 
cmdFrags(id)
{
    
client_print(idprint_chat"This is the /frags command.")
    if(
get_pcvar_num(frags_pcvar) == 0)
        return 
PLUGIN_CONTINUE
        
    client_print
(idprint_chat"The problem is in the ML")
    
client_print_color(idDontChange"^3[BKF] %L"id"FRAG_MSG"gi_playerFrags[id])
    return 
PLUGIN_HANDLED


Now....i'm aware that /frags gets forwarded to cmdBuy, but it still doesn't work. cmdBuy is proven to work from /buy. /level doesn't work, and the /frags original command didn't work either. it is really strange, maybe you guys can see something i didn't.

Here's my full init
PHP Code:

public plugin_init() 
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_dictionary_colored("fragsbrass.txt")
    
    
register_clcmd("say /buybk""cmdBuy")
    
register_clcmd("team_say /buybk""cmdBuy")
    
register_clcmd("say /BUYBK""cmdBuy")        //
    
register_clcmd("say /BuyBk""cmdBuy")        //    Commands entered by liverwiz to
    
register_clcmd("say /BuyBK""cmdBuy")        //    negate case sensitivity
    
register_clcmd("say /Buybk""cmdBuy")        //
    
register_clcmd("say /buyBK""cmdBuy")
    
register_clcmd("say /buyBk""cmdBuy")
    
register_clcmd("say /bkhelp""cmdHelp")     //inserted by liverwiz as simple client help
    
register_clcmd("say /bk""cmdHelp"
    
register_clcmd("say /resetlevel""resetLevel")  //EDIT: this was calling a stock function
    
register_clcmd("say /level""cmdLevel")
    
register_clcmd("say /frags""cmdBuy")
    
register_clcmd("say /savefrags""cmdSave")
    
register_concmd("bkf_admin""cmdAdminMenu"ADMIN_KICK)
    
register_concmd("bkf_setlevel""cmdSetLevel"ADMIN_KICK)
    
register_concmd("bkf_setfrags""cmdSetFrags"ADMIN_KICK)
    
register_concmd("bkf_givefrags""cmdGiveFrags"ADMIN_KICK)
    
register_concmd("bkf_vaultprune""cmdPrune"ADMIN_BAN)
    
    if( 
get_pcvar_num(frags_pcvar) == && get_pcvar_num(toggle_pcvar) == 1)
    {
    
g_vaultHandle nvault_open("brass_frags")
    if(
g_vaultHandle == -1)
        
log_amx("[BKF] nVault failed to open. Frags will not be persistent.")
    }


interesting thing is, as far as i can tell, NOTHING after the /bk register works.

NOTE: when i put bkf_admin in console it returns to me "Unknown Command"

Liverwiz 06-11-2012 02:25

Re: Command Not Working
 
Well looky there....seems like my derp ass decided to think it was OK to call a stock function from a register_clcmd. It was /resetlevel calling a stock function, which then caused all the others to fail loading.

Note to all: only call public functions in register_ hooks.
I'm an idiot.

Above post has been edited to remove things that aren't needed. (mostly just to keep more code in proper places)


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

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