Raised This Month: $ Target: $400
 0% 

number of arguments does not match definition


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 09-18-2012 , 12:21   number of arguments does not match definition
Reply With Quote #1

1.
PHP Code:
BuildMapVoteMenu() {
    
g_iMapVoteBodyLenght copy(g_iMapVoteBody511"\rMap Vote:^n");
    
    for(new 
i=1i<10i++) {
        
g_iMapVoteBodyLenght += copy(g_iMapVoteBody[g_iMapVoteBodyLenght], (511-g_iMapVoteBodyLenght), "^n\r%d\y. \w%s"ig_iPickedMaps[i]);
    }
    
    return 
PLUGIN_HANDLED;

2.
PHP Code:
BuildTeamsTypeVoteMenu() {
    
copy(g_iTeamsTypeVoteBody149"\rTeams Type Vote:^n^n\r1\y. \w%s^n\r2\y. \w%s^n\r3\y. \w%s^n^n\r0\y. \yEXIT"TEAMS_TYPE_VOTE1TEAMS_TYPE_VOTE2TEAMS_TYPE_VOTE3);
    
    return 
PLUGIN_HANDLED;

3.
PHP Code:
BuildOverTimeVoteMenu() {
    
copy(g_iOverTimeVoteBody149"\rOver Time Vote:^n^n\r1\y. \w%s^n\r2\y. \w%s^n^n\r0\y. \yEXIT"YESNO);
    
    return 
PLUGIN_HANDLED;

All these functions are returning this error: "error 088: number of arguments does not match definition"

How is it that the arguments does not match, am i not allowed to to use the %s?
If i am not allowed, then what should i do? What alternative should i adopt?

Please explain, i am confused.

Thanks in advance...
__________________

Last edited by n0br41ner; 09-18-2012 at 12:27.
n0br41ner is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-18-2012 , 13:04   Re: number of arguments does not match definition
Reply With Quote #2

Code:
Syntax
copy ( dest[], len, const src[] )
You can't format the string. Use formatex() instead
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 09-18-2012 at 13:04.
Alka is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 09-18-2012 , 13:22   Re: number of arguments does not match definition
Reply With Quote #3

Can you make an example?

Transform #3 using formatex... cause i can't see the formatex in the func wiki
__________________
n0br41ner is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-18-2012 , 13:33   Re: number of arguments does not match definition
Reply With Quote #4

Quote:
Originally Posted by n0br41ner View Post
Can you make an example?

Transform #3 using formatex... cause i can't see the formatex in the func wiki
use the include files.

Quote:
/* Same as format(), except does not perform a "copy back" check.
* This means formatex() is faster, but DOES NOT ALLOW this type
* of call:
* formatex(buffer, len, "%s", buffer)
* formatex(buffer, len, buffer, buffer)
* formatex(buffer, len, "%s", buffer[5])
* This is because the output is directly stored into "buffer",
* rather than copied back at the end.
*/
native formatex(output[] ,len ,const format[] , any:...);
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 09-18-2012 , 13:37   Re: number of arguments does not match definition
Reply With Quote #5

Alright thanks a lot.
__________________
n0br41ner is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 09-18-2012 , 19:10   Re: number of arguments does not match definition
Reply With Quote #6

Can anyone check if i implemented it correctly? (commented line is the old one)
PHP Code:
for(new i=1i<10i++) {
        
g_iMapVoteBodyLenght += format(g_iMapVoteBody[g_iMapVoteBodyLenght], (511-g_iMapVoteBodyLenght), "^n\r%d\y. \w%s"ig_iPickedMaps[i]);
        
// g_iMapVoteBodyLenght += copy(g_iMapVoteBody[g_iMapVoteBodyLenght], (511-g_iMapVoteBodyLenght), "^n\r%d\y. \w%s", i, g_iPickedMaps[i]);
    

__________________
n0br41ner is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-18-2012 , 19:27   Re: number of arguments does not match definition
Reply With Quote #7

Quote:
Originally Posted by n0br41ner View Post
Can anyone check if i implemented it correctly? (commented line is the old one)
PHP Code:
for(new i=1i<10i++) {
        
g_iMapVoteBodyLenght += format(g_iMapVoteBody[g_iMapVoteBodyLenght], (511-g_iMapVoteBodyLenght), "^n\r%d\y. \w%s"ig_iPickedMaps[i]);
        
// g_iMapVoteBodyLenght += copy(g_iMapVoteBody[g_iMapVoteBodyLenght], (511-g_iMapVoteBodyLenght), "^n\r%d\y. \w%s", i, g_iPickedMaps[i]);
    

Why did you not listen to the advice given? Also, test it yourself. You will find out very quickly if it works or not.
__________________
fysiks is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-19-2012 , 09:17   Re: number of arguments does not match definition
Reply With Quote #8

where did anyone say anything about format? Use formatex. Its more efficient and required to get a plugin approved. Maybe not officially, but if you're doing that...."its poorly coded"

Also use charsmax(g_iMapVoteBody) - g_iMapVoteBodyLength instead of 511. It'll make things easier in the future. I promise.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz 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 08:22.


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