AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Error: Number of arguments does not match definition on line 778 (https://forums.alliedmods.net/showthread.php?t=221827)

timmiesgubbe 07-26-2013 21:15

Error: Number of arguments does not match definition on line 778
 
Fixed :D

Code:
public CmdMenuHandle ( iPlayer, menu, item ) {     if ( item == MENU_EXIT )     {         menu_destroy ( menu )         return PLUGIN_HANDLED     }         new data [ 6 ], gName [ 64 ]     new access, callback         menu_item_getinfo ( menu, item, access, data, sizeof ( data ) - 1, gName, sizeof ( gName ) - 1, callback )         new key = str_to_num ( data )     switch ( key )     {         case 1: CmdPlayerShow ( iPlayer )         case 2: CmdItemShow ( iPlayer )         case 3: CmdWeapShow ( iPlayer )         case 4:         {             if ( VIPLevel [ iPlayer ] >= 1 )             {                 ColorChat ( iPlayer, GREY, "%s You are already^4 VIP^3!", prefix )                 return PLUGIN_HANDLED             }             else if ( iMoney [ iPlayer ] < VIPPrice )             {                 ColorChat ( iPlayer, GREY, "%s You need more money to buy^4 VIP^3!", prefix )                 return PLUGIN_HANDLED             }             else             {                 ColorChat ( iPlayer, GREY, "%s You bought^4 VIP^3!", prefix )                 VIPLevel [ iPlayer ] += 1                 //Save ( iPlayer )             }         } this is line 778        case 5: CmdDonateMenu ( iPlayer )     }     return PLUGIN_HANDLED }
]


Code:
public CmdMenuShow ( iPlayer ) {     new title [ 190 ]     formatex ( title, sizeof ( title ) - 1, "\r[EG]\w Money Mod^n\y- Main Menu\w" )         new menu = menu_create ( title, "CmdMenuHandle" )         new Temp [ 190 ]     menu_additem ( menu, "Player Info^n", "1", 0 )     menu_additem ( menu, "Item Upgrades^n", "2", 0 )     menu_additem ( menu, "Weapon Upgrades^n^n", "3", 0 )     if ( VIPLevel [ iPlayer ] >= 1 )         formatex ( Temp, sizeof ( Temp ) - 1, "\yVIP:\w Yes (\r1 Extra Bullet\w)" )     else if ( iMoney [ iPlayer ] < VIPPrice )         formatex ( Temp, sizeof ( Temp ) - 1, "\dVIP:\w No (\r1 Extra Bullet\w)\d $%i", VIPPrice )     else         formatex ( Temp, sizeof ( Temp ) - 1, "VIP: No (\r1 Extra Bullet\w)\y $%i", VIPPrice )     menu_additem ( menu, Temp, "4", 0 )     menu_additem ( menu, "Donate Money^n", "5", 0 )     menu_display ( iPlayer, menu, 0 )     return PLUGIN_HANDLED }

akcaliberg 07-26-2013 21:27

Re: Error: Number of arguments does not match definition on line 778
 
use [pawn] or [php] bbcodes

Edit: Show CmdDonateMenu() function

timmiesgubbe 07-26-2013 21:45

Re: Error: Number of arguments does not match definition on line 778
 
Quote:

Originally Posted by akcaliberg (Post 1999584)
use [pawn] or [php] bbcodes

Edit: Show CmdDonateMenu() function

Like This: case 5: Show CmdDonateMenu ( iPlayer )
??

akcaliberg 07-26-2013 21:57

Re: Error: Number of arguments does not match definition on line 778
 
okay but where you are creating that function ? I mean where is

public CmdDonateMenu

akcaliberg 07-26-2013 22:12

Re: Error: Number of arguments does not match definition on line 778
 
Compiler says that:
CmdDonateShow function requires two more parameter which are level and cid.

you can fix this error by changing function parameters like that

public CmdDonateShow( iPlayer, level, cid)

->

public CmdDonateShow( iPlayer )

and remove the cmd_access line. These are not necessary. If you want to require an access flag to function, you must define it in register_concmd.

timmiesgubbe 07-26-2013 22:16

Re: Error: Number of arguments does not match definition on line 778
 
Quote:

Originally Posted by akcaliberg (Post 1999607)
Compiler says that:
CmdDonateShow function requires two more parameter which are level and cid.

you can fix this error by changing function parameters like that

public CmdDonateShow( iPlayer, level, cid)

->

public CmdDonateShow( iPlayer )

and remove the cmd_access line. These are not necessary. If you want to require an access flag to function, you must define it in register_concmd.


Thanks


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

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