Raised This Month: $ Target: $400
 0% 

HELP Unknown Command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
totalcsscripting
BANNED
Join Date: Jul 2010
Old 08-01-2010 , 13:10   HELP Unknown Command
Reply With Quote #1

I have this simple pluguin with gives money
PHP Code:
public admin_givemoney(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 
adminAuthid[36], adminName[32]
    
get_user_authid(id,adminAuthid,35)
    
get_user_name(id,adminName,31)
    
    new 
amount str_to_num(arg2)
    if(
amount 0) {
        
console_print(id,"%L"LANG_PLAYERAMX_SUPER_AMOUNT_GREATER)
        return 
PLUGIN_HANDLED
    
}
    
    if(
arg[0] == '@')
    {
        new 
players[32], pnumi;
        if(
containi(arg"ALL") != -1get_players(playerspnum)
        else 
get_players(playerspnum"ae", (containi(arg"CT") != -1) ? "CT" "TERRORIST");
        if(!
pnum) return PLUGIN_HANDLED;
        new 
pidmoney;
        for(
0pnumi++)
        {
            
pid players[i];
            
money amount cs_get_user_money(pid);
            if(
money 16000money 16000;
            
cs_set_user_money(pidmoney)
        }
        switch(
get_pcvar_num(amx_show_activity))
        {
            case 
2client_print(0print_chat"%L"LANG_PLAYER"AMX_SUPER_GIVEMONEY_TEAM_CASE2"adminNameamountarg[1]);
            case 
1client_print(0print_chat"%L"LANG_PLAYER"AMX_SUPER_GIVEMONEY_TEAM_CASE1"amountarg[1]);
        }
        
console_print(id"%L"LANG_PLAYER"AMX_SUPER_GIVEMONEY_TEAM_MSG"amountarg[1]);
        
log_amx("%L"LANG_SERVER"AMX_SUPER_GIVEMONEY_TEAM_LOG"adminNameadminAuthidamountarg[1]);
    }
    else
    {
        
        new 
player cmd_target(id,arg,2)
        if(!
player) return PLUGIN_HANDLED
    
        
new playerName[32]
        
get_user_name(player,playerName,31)
        
        new 
playerAuthid[36]
        
get_user_authid(player,playerAuthid,35)
    
        
cs_set_user_money(player,cs_get_user_money(player)+amount)
        
        switch(
get_pcvar_num(amx_show_activity))
        {
            case 
2client_print(0,print_chat,"%L"LANG_PLAYER"AMX_SUPER_GIVEMONEY_TEAM_CASE2",adminName,amount,playerName)
            case 
1client_print(0,print_chat,"%L"LANG_PLAYER"AMX_SUPER_GIVEMONEY_TEAM_CASE1",amount,playerName)
        }
        
        
console_print(id,"%L"LANG_PLAYER"AMX_SUPER_GIVEMONEY_TEAM_MSG",amount,playerName,amount)
        
log_amx("%L"LANG_SERVER"AMX_SUPER_GIVEMONEY_TEAM_LOG",adminName,adminAuthid,amount,playerName,playerAuthid)

    }
    return 
PLUGIN_HANDLED

But when i used it, it prints unknown command. It works pefectlly but that unknown command message is driving me crazy.

I have a diccionary with al the variables which appear but still.



Thanks
totalcsscripting is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-01-2010 , 14:01   Re: HELP Unknown Command
Reply With Quote #2

Can you show your plugins_init() ?
RedRobster is offline
totalcsscripting
BANNED
Join Date: Jul 2010
Old 08-01-2010 , 14:29   Re: HELP Unknown Command
Reply With Quote #3

register_concmd("guita","admin_givemoney",ADM IN_SLAY,"")
totalcsscripting is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-01-2010 , 15:42   Re: HELP Unknown Command
Reply With Quote #4

If you copy and pasted that, then there is no space between M and I. Then, you don't need "" as the fourth parameter.

Also, in the console print, wouldn't you put console_print(0, "%L", LANG_PLAYER, Etc...)
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-01-2010 , 16:36   Re: HELP Unknown Command
Reply With Quote #5

All you need to do is return PLUGIN_HANDLED at the end of the function to prevent the "Unknown command" warning.

EDIT: Looks like you do, that's strange. It shouldn't show that warning.
__________________
fysiks is offline
Gadzislaw007
Senior Member
Join Date: Nov 2009
Old 08-01-2010 , 19:15   Re: HELP Unknown Command
Reply With Quote #6

Check if all registers in plugin_init are valid! If one is bad, then all registers below won't be executed.
Gadzislaw007 is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-01-2010 , 20:52   Re: HELP Unknown Command
Reply With Quote #7

He says it is executed...
RedRobster 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 00:16.


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