AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HELP Unknown Command (https://forums.alliedmods.net/showthread.php?t=134152)

totalcsscripting 08-01-2010 13:10

HELP Unknown Command
 
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

RedRobster 08-01-2010 14:01

Re: HELP Unknown Command
 
Can you show your plugins_init() ?

totalcsscripting 08-01-2010 14:29

Re: HELP Unknown Command
 
register_concmd("guita","admin_givemoney",ADM IN_SLAY,"")

nikhilgupta345 08-01-2010 15:42

Re: HELP Unknown Command
 
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...)

fysiks 08-01-2010 16:36

Re: HELP Unknown Command
 
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.

Gadzislaw007 08-01-2010 19:15

Re: HELP Unknown Command
 
Check if all registers in plugin_init are valid! If one is bad, then all registers below won't be executed.

RedRobster 08-01-2010 20:52

Re: HELP Unknown Command
 
He says it is executed...


All times are GMT -4. The time now is 00:16.

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