SA-MP Forums Archive
number of arguments does not match definition - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: number of arguments does not match definition (/showthread.php?tid=629735)



number of arguments does not match definition - Jihanz - 03.03.2017

can you help me ?

PHP код:
public Loadrumah() {
    new 
num_rows,num_fields;
    
cache_get_data(num_rows,num_fields);
    if(
num_rows)
    {
        for(new 
r=0cache_get_row_count(); r++)
        {
            
RumahInfo[r][rumahID] = cache_get_row_int (r0); 
            
RumahInfo[r][pemilik] = cache_get_row    (,1);
        }
    }
    return 
1;

Код:
D:\data aji\Samp server\gamemodes\percobaan.pwn(135) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Line 135 RumahInfo[r][pemilik] = cache_get_row (r ,1);


Re: number of arguments does not match definition - JessThompson - 03.03.2017

Код:
cache_get_row(row, field_idx, destination[], connectionHandle = 1, max_len = sizeof(destination))
Your missing the destination

If the other line is a int you need you can just go

Код:
public Loadrumah() { 
    new num_rows,num_fields; 
    cache_get_data(num_rows,num_fields); 
    if(num_rows) 
    { 
        for(new r=0; r < cache_get_row_count(); r++) 
        { 
            RumahInfo[r][rumahID] = cache_get_row_int (r, 0);  
            RumahInfo[r][pemilik] = cache_get_row_int    (r ,1); 
        } 
    } 
    return 1; 
}



Re: number of arguments does not match definition - Jihanz - 03.03.2017

Quote:
Originally Posted by JessThompson
Посмотреть сообщение
Код:
cache_get_row(row, field_idx, destination[], connectionHandle = 1, max_len = sizeof(destination))
Your missing the destination

If the other line is a int you need you can just go

Код:
public Loadrumah() { 
    new num_rows,num_fields; 
    cache_get_data(num_rows,num_fields); 
    if(num_rows) 
    { 
        for(new r=0; r < cache_get_row_count(); r++) 
        { 
            RumahInfo[r][rumahID] = cache_get_row_int (r, 0);  
            RumahInfo[r][pemilik] = cache_get_row_int    (r ,1); 
        } 
    } 
    return 1; 
}
sorry im newbie what is destination[] ?


Re: number of arguments does not match definition - JessThompson - 03.03.2017

Try this code this should compile okay

Код:
public Loadrumah() { 
    new num_rows,num_fields; 
    cache_get_data(num_rows,num_fields); 
    if(num_rows) 
    { 
        for(new r=0; r < cache_get_row_count(); r++) 
        { 
            RumahInfo[r][rumahID] = cache_get_row_int (r, 0);  
            cache_get_row(r, 1, RumahInfo[r][pemilik]);
        } 
    } 
    return 1; 
}
Explanation:

[number of arguments does not match definition] This error means there is too many or too less arguments to the function within that line. So for example

You used

Код:
cache_get_row(row, field_idx, destination[], connectionHandle = 1, max_len = sizeof(destination))
that requires 3 arguments you only provided 2
Код:
RumahInfo[r][pemilik] = cache_get_row_int    (r ,1);
I recoded it to the correct definition of that function

Код:
cache_get_row(r, 1, RumahInfo[r][pemilik]);



Re: number of arguments does not match definition - renatog - 03.03.2017

What is this variable?:
Код:
RumahInfo[r][pemilik]
If it's an int, you have to change the line 135 to:
Код:
RumahInfo[r][pemilik] = cache_get_row_int(r ,1);
If it's a string you have to change the line 135 to:
Код:
cache_get_row(r, 1, RumahInfo[r][pemilik]);
Look at this documentation (MySQL R33): https://sampwiki.blast.hk/wiki/MySQL/R33#cache_get_row

@Edit
Jess was faster


Re: number of arguments does not match definition - Jihanz - 03.03.2017

Quote:
Originally Posted by renatog
Посмотреть сообщение
What is this variable?:
Код:
RumahInfo[r][pemilik]
If it's an int, you have to change the line 135 to:
Код:
RumahInfo[r][pemilik] = cache_get_row_int(r ,1);
If it's a string you have to change the line 135 to:
Код:
cache_get_row(r, 1, RumahInfo[r][pemilik]);
Look at this documentation (MySQL R33): https://sampwiki.blast.hk/wiki/MySQL/R33#cache_get_row

@Edit
Jess was faster
ITS WORK THANKS


Re: number of arguments does not match definition - JessThompson - 03.03.2017

No problem ;P