AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Unknown command for mapchooser plugin (https://forums.alliedmods.net/showthread.php?t=125782)

KadiR 05-02-2010 09:50

Unknown command for mapchooser plugin
 
I just added this 2 lines in plugin_init, and it gives me an Unknown command message in the console:

PHP Code:

    register_clcmd"startvote" "voteNextmap" ADMIN_RCON);
    
register_clcmd"mapvote" "voteNextmap" ADMIN_RCON); 

And voteNextmap is called like that (didn't change anything) :

PHP Code:

public voteNextmap()
{
    new 
winlimit get_cvar_num("mp_winlimit")
    new 
maxrounds get_cvar_num("mp_maxrounds")
    
    if (
winlimit)
    {
        new 
winlimit 2
        
        
if ((g_teamScore[0]) && (g_teamScore[1]))
        {
            
g_selected false
            
return
        }
    }
    else if (
maxrounds)
    {
        if ((
maxrounds 2) > (g_teamScore[0] + g_teamScore[1]))
        {
            
g_selected false
            
return
        }
    } else {
        new 
timeleft get_timeleft()
        
        if (
timeleft || timeleft 129)
        {
            
g_selected false
            
return
        }
    }

    if (
g_selected)
        return

    
g_selected true
    
    
new menu[512], amkeys = (1<<SELECTMAPS 1)

    new 
pos format(menu511g_coloredMenus "\y%L:\w^n^n" "%L:^n^n"LANG_SERVER"CHOOSE_NEXTM")
    new 
dmax = (g_mapNums SELECTMAPS) ? SELECTMAPS g_mapNums
    
    
for (g_mapVoteNum 0g_mapVoteNum dmax; ++g_mapVoteNum)
    {
        
random_num(0g_mapNums 1)
        
        while (
isInMenu(a))
            if (++
>= g_mapNums0
        
        g_nextName
[g_mapVoteNum] = a
        pos 
+= format(menu[pos], 511"%d. %a^n"g_mapVoteNum 1ArrayGetStringHandle(g_mapNamea));
        
mkeys |= (1<<g_mapVoteNum)
        
g_voteCount[g_mapVoteNum] = 0
    
}
    
    
menu[pos++] = '^n'
    
g_voteCount[SELECTMAPS] = 0
    g_voteCount
[SELECTMAPS 1] = 0
    
    
new mapname[32]
    
get_mapname(mapname31)

    if ((
winlimit maxrounds) == && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")))
    {
        
pos += format(menu[pos], 511"%d. %L^n"SELECTMAPS 1LANG_SERVER"EXTED_MAP"mapname)
        
mkeys |= (1<<SELECTMAPS)
    }

    
format(menu[pos], 511"%d. %L"SELECTMAPS+2LANG_SERVER"NONE")
    new 
MenuName[64]
    
    
format(MenuName63"%L""en""CHOOSE_NEXTM")
    
show_menu(0mkeysmenu15MenuName)
    
set_task(15.0"checkVotes")
    
client_print(0print_chat"%L"LANG_SERVER"TIME_CHOOSE")
    
client_cmd(0"spk Gman/Gman_Choose%i"random_num(12));
    
//client_cmd(0, "spk Gman/Gman_Choose2")
    
log_amx("[AMXX] Vote: Voting for the nextmap started!")



fysiks 05-02-2010 11:12

Re: Unknown command for mapchooser plugin
 
Does the function run?

If yes:

PHP Code:

return PLUGIN_HANDLED 


Exolent[jNr] 05-02-2010 12:48

Re: Unknown command for mapchooser plugin
 
If the command is issued through console, you will want to return PLUGIN_HANDLED[_MAIN] to prevent it from saying "Unknown command..." in console.

KadiR 05-02-2010 13:10

Re: Unknown command for mapchooser plugin
 
Well, the function doesn't run at all. :|

drekes 05-02-2010 20:30

Re: Unknown command for mapchooser plugin
 
Quote:

Originally Posted by Exolent[jNr] (Post 1167900)
If the command is issued through console, you will want to return PLUGIN_HANDLED[_MAIN] to prevent it from saying "Unknown command..." in console.

Sorry for borrowing your thread, Kadir.
Do i return at the end of the function called by the command? Or where do i do it, because i have this problem.

fysiks 05-02-2010 20:55

Re: Unknown command for mapchooser plugin
 
Quote:

Originally Posted by drekes (Post 1168583)
Sorry for borrowing your thread, Kadir.
Do i return at the end of the function called by the command? Or where do i do it, because i have this problem.

Where ever you want the function to stop functioning. If you need the whole function to execute then you put it last.

KadiR 05-03-2010 11:33

Re: Unknown command for mapchooser plugin
 
Drekes, stop doing that please. :|

drekes 05-03-2010 12:22

Re: Unknown command for mapchooser plugin
 
Quote:

Originally Posted by KadiR (Post 1169183)
Drekes, stop doing that please. :|

sorry, i just don't want to spam threads


All times are GMT -4. The time now is 03:33.

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