AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Number Of Arguments - Help.. (https://forums.alliedmods.net/showthread.php?t=226159)

Alfanan123 09-14-2013 08:48

Number Of Arguments - Help..
 
Ive been working on a menu and it worked fine b4, but now i just get the damn Number Of Arguments does not match error definition, after i added a transfer menu.

1:
Code:

public cmdAdminMenu(iPlayer)
{
if(!(get_user_flags(iPlayer) & ADMIN_IMMUNITY)) //Flag: A
{
ChatColor(iPlayer, "!g[%s]!y You don't got access to this command.", TAG);
return PLUGIN_HANDLED;
}

new szText[555 char];
formatex(szText, charsmax(szText), "\yAdmin Menu")
new AdminMenu = menu_create(szText, "AdminMenuHandle")

formatex(szText, charsmax(szText), "\yTransfer Menu")
menu_additem(AdminMenu, szText, "1", 0)

menu_setprop(AdminMenu, MPROP_EXIT, MEXIT_ALL)
menu_display(iPlayer, AdminMenu, 0)

return PLUGIN_HANDLED;
}

2:
Code:

public AdminMenuHandle(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED;
}

new data[6], iName[64], access, callback
menu_item_getinfo(menu, item, access, data, charsmax(data), iName, charsmax(iName), callback )
new key = str_to_num(data)

switch(key)
{
case 1: TransferMenu(id) //Here's the error
}

return PLUGIN_HANDLED;
}

Tell me if you see something wrong.. :/

Black Rose 09-14-2013 09:01

Re: Number Of Arguments - Help..
 
Show TransferMenu function.
HINT: The error is in plain english. There should be no confusion here.

Alfanan123 09-14-2013 09:02

Re: Number Of Arguments - Help..
 
Quote:

Originally Posted by Black Rose (Post 2034349)
Show TransferMenu function.
HINT: The error is in plain english. There should be no confusion here.

It's not that.. i know what the error means and so but i cant seem to find where it is "defined" how many arguments is allowed.. :C

Alfanan123 09-14-2013 09:04

Re: Number Of Arguments - Help..
 
Here's the function.
Code:

public TransferMenu(id, menu, item)
{
        if( item == MENU_EXIT )
        {
                menu_destroy(menu);
                cmdAdminMenu(id)
                return PLUGIN_HANDLED;
        }
       
        new data[6], iName[64];
        new player = str_to_num(data)
       
        if(!player)
        {
                switch(tTransfer[id])
                {
                        case 2: tTransfer[id]=0
                        default: tTransfer[id]++
                }
                showtransfermenu(id)
                return PLUGIN_CONTINUE;
        }
       
        new name[2][32]
        get_user_name(player,name[1],31)
        get_user_name(id,name[0],31)
       
        switch(tTransfer[id])
        {
                case 0:
                {
                        cs_set_user_team(player, CS_TEAM_CT)
                        user_silentkill(player)
                        ChatColor(0, "!g[%s]!team %s !ytransfered !team%s!y to the!g 'Counter-Terrorists'!y.", TAG, name[0], name[1])
                }
               
                case 1:
                {
                        cs_set_user_team(player, CS_TEAM_T)
                        user_silentkill(player)
                        ChatColor(0, "!g[%s]!team %s !ytransfered !team%s!y to the!g 'Terrorists'!y.", TAG, name[0], name[1])
                }
               
                case 2:
                {
                        cs_set_user_team(player, CS_TEAM_SPECTATOR)
                        user_silentkill(player)
                        ChatColor(0, "!g[%s]!team %s !ytransfered !team%s!y to the!g 'Spectators'!y.", TAG, name[0], name[1])
                }
        }
        showtransfermenu(id)
        return PLUGIN_CONTINUE;
}


dark_style 09-14-2013 09:08

Re: Number Of Arguments - Help..
 
The quote had to be addressed to me. I deleted my post since I was late to help you, Black Rose already asked what is needed.

<VeCo> 09-14-2013 09:12

Re: Number Of Arguments - Help..
 
You are trying to call the menu's handler instead of the menu itself.
You have already posted the right function that you need to call, in the first post.

Alfanan123 09-14-2013 09:15

Re: Number Of Arguments - Help..
 
Quote:

Originally Posted by <VeCo> (Post 2034363)
You are trying to call the menu's handler instead of the menu itself.
You have already posted the right function that you need to call, in the first post.

omg, how did i not see that.... 0.o

Code:

    switch(key)
    {
        case 1: showtransfermenu(id)
    }

Well it's fixed now, thx XD

---
Calling the handler instead of the "menu".... Daaang

akcaliberg 09-14-2013 10:11

Re: Number Of Arguments - Help..
 
Quote:

Originally Posted by Alfanan123 (Post 2034343)
Fixed, delete this thread :P

You don't need to delete your message, when you fixed the problem. If someone is having this problem too, they should be able to find the solution by these threads.

What you did is just selfishness :nono:

Alfanan123 09-22-2013 12:53

Re: Number Of Arguments - Help..
 
Quote:

Originally Posted by akcaliberg (Post 2034421)
You don't need to delete your message, when you fixed the problem. If someone is having this problem too, they should be able to find the solution by these threads.

What you did is just selfishness :nono:

Well, i keeped the answers? Didnt i.. :C
And it was just a basic "Error" that i seemed to miss... XD
I only had to change one word :&


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

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