Raised This Month: $ Target: $400
 0% 

Number Of Arguments - Help..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alfanan123
Junior Member
Join Date: Sep 2011
Old 09-14-2013 , 08:48   Number Of Arguments - Help..
Reply With Quote #1

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.. :/

Last edited by YamiKaitou; 09-14-2013 at 18:02.
Alfanan123 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-14-2013 , 09:01   Re: Number Of Arguments - Help..
Reply With Quote #2

Show TransferMenu function.
HINT: The error is in plain english. There should be no confusion here.
__________________

Last edited by Black Rose; 09-14-2013 at 09:01.
Black Rose is offline
Alfanan123
Junior Member
Join Date: Sep 2011
Old 09-14-2013 , 09:02   Re: Number Of Arguments - Help..
Reply With Quote #3

Quote:
Originally Posted by Black Rose View Post
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 is offline
Old 09-14-2013, 09:02
dark_style
This message has been deleted by dark_style.
Alfanan123
Junior Member
Join Date: Sep 2011
Old 09-14-2013 , 09:04   Re: Number Of Arguments - Help..
Reply With Quote #4

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;
}

Last edited by Alfanan123; 09-14-2013 at 09:04.
Alfanan123 is offline
Old 09-14-2013, 09:06
Alfanan123
This message has been deleted by Alfanan123.
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 09-14-2013 , 09:08   Re: Number Of Arguments - Help..
Reply With Quote #5

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.
__________________



dark_style is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 09-14-2013 , 09:12   Re: Number Of Arguments - Help..
Reply With Quote #6

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.
__________________

Last edited by <VeCo>; 09-14-2013 at 09:14.
<VeCo> is offline
Alfanan123
Junior Member
Join Date: Sep 2011
Old 09-14-2013 , 09:15   Re: Number Of Arguments - Help..
Reply With Quote #7

Quote:
Originally Posted by <VeCo> View Post
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

Last edited by Alfanan123; 09-14-2013 at 09:17.
Alfanan123 is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 09-14-2013 , 10:11   Re: Number Of Arguments - Help..
Reply With Quote #8

Quote:
Originally Posted by Alfanan123 View Post
Fixed, delete this thread
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
akcaliberg is offline
Alfanan123
Junior Member
Join Date: Sep 2011
Old 09-22-2013 , 12:53   Re: Number Of Arguments - Help..
Reply With Quote #9

Quote:
Originally Posted by akcaliberg View Post
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
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 :&
Alfanan123 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 19:06.


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