SA-MP Forums Archive
argument type mismatch - 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: argument type mismatch (/showthread.php?tid=651280)



argument type mismatch - IndependentGaming - 17.03.2018

Hello I'm trying to fix this problem but it keeps giving me errors I removed 2 things from those lines and it still says it doesn't match..

I'm currently trying to update the mysql plugin from R7 to the newest one but every line that has this :
Код:
cache_get_value_name_int(row,  szField, szResult);
it shows one of those errors below

Код:
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4282) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4288) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4292) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4296) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4300) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4304) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4308) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4312) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4316) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4320) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4324) : error 035: argument type mismatch (argument 3)
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4328) : error 035: argument type mismatch (argument 3)
PHP код:
for(new 0MAX_PLAYERTOYSi++)
                    {
                        
format(szFieldsizeof(szField), "pt%dModelID"i);
                        
cache_get_value_name_int(row,  szFieldszResult);
                        
PlayerToyInfo[extraid][i][ptModelID] = strval(szResult);
                        if(
PlayerToyInfo[extraid][i][ptModelID] != 0)
                        {
                            
format(szFieldsizeof(szField), "pt%dBone"i);
                            
cache_get_value_name_int(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptBone] = strval(szResult);
                            
format(szFieldsizeof(szField), "pt%dPosX"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptPosX] = floatstr(szResult);
                            
format(szFieldsizeof(szField), "pt%dPosY"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptPosY] = floatstr(szResult);
                            
format(szFieldsizeof(szField), "pt%dPosY"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptPosY] = floatstr(szResult);
                            
format(szFieldsizeof(szField), "pt%dPosZ"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptPosZ] = floatstr(szResult);
                            
format(szFieldsizeof(szField), "pt%dRotX"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptRotX] = floatstr(szResult);
                            
format(szFieldsizeof(szField), "pt%dRotY"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptRotY] = floatstr(szResult);
                            
format(szFieldsizeof(szField), "pt%dRotZ"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptRotZ] = floatstr(szResult);
                            
format(szFieldsizeof(szField), "pt%dScaX"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptScaleX] = floatstr(szResult);
                            
format(szFieldsizeof(szField), "pt%dScaY"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptScaleY] = floatstr(szResult);
                            
format(szFieldsizeof(szField), "pt%dScaZ"i);
                            
cache_get_value_name_float(row,  szFieldszResult);
                            
PlayerToyInfo[extraid][i][ptScaleZ] = floatstr(szResult);
                        }
                        else
                        {
                            
PlayerToyInfo[extraid][i][ptBone] = 0;
                            
PlayerToyInfo[extraid][i][ptPosX] = 0.0;
                            
PlayerToyInfo[extraid][i][ptPosY] = 0.0;
                            
PlayerToyInfo[extraid][i][ptPosZ] = 0.0;
                            
PlayerToyInfo[extraid][i][ptRotX] = 0.0;
                            
PlayerToyInfo[extraid][i][ptRotY] = 0.0;
                            
PlayerToyInfo[extraid][i][ptRotZ] = 0.0;
                            
PlayerToyInfo[extraid][i][ptScaleX] = 0.0;
                            
PlayerToyInfo[extraid][i][ptScaleY] = 0.0;
                            
PlayerToyInfo[extraid][i][ptScaleZ] = 0.0;
                        }
                    } 



Re: argument type mismatch - iKarim - 17.03.2018

You are fetching an integer but passing an array (string) to the function, thus a type mismatch. What you need to do is using the variable directly:

PHP код:
                            format(szFieldsizeof(szField), "pt%dBone"i); 
                            
cache_get_value_name_int(row,  szFieldPlayerToyInfo[extraid][i][ptBone]); 
Also this is pretty helpful: https://sampwiki.blast.hk/wiki/MySQL


Re: argument type mismatch - IndependentGaming - 17.03.2018

Код:
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4336) : error 017: undefined symbol "cache_get_value_name__float"
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4339) : error 017: undefined symbol "cache_get_value_name__float"
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4342) : error 017: undefined symbol "cache_get_value_name__float"
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4345) : error 017: undefined symbol "cache_get_value_name__float"
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4348) : error 017: undefined symbol "cache_get_value_name__float"
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4351) : error 017: undefined symbol "cache_get_value_name__float"
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4354) : error 017: undefined symbol "cache_get_value_name__float"
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4357) : error 017: undefined symbol "cache_get_value_name__float"
C:\Users\marlb\Desktop\MCRP\gamemodes\MCRP.pwn(4360) : error 017: undefined symbol "cache_get_value_name__float"
I changed everything see:


PHP код:
for(new 0MAX_PLAYERTOYSi++)
                     {
                          
format(szFieldsizeof(szField), "pt%dModelID"i);
                        
cache_get_value_name_int(row,  szFieldPlayerToyInfo[extraid][i][ptBone]);

                          if(
PlayerToyInfo[extraid][i][ptModelID] != 0)
                        {
                               
format(szFieldsizeof(szField), "pt%dBone"i);
                            
cache_get_value_name_int(row,  szFieldPlayerToyInfo[extraid][i][ptBone]);

                            
format(szFieldsizeof(szField), "pt%dPosX"i);
                            
cache_get_value_name__float(row,  szFieldPlayerToyInfo[extraid][i][ptPosX]);

                               
format(szFieldsizeof(szField), "pt%dPosY"i);
                            
cache_get_value_name__float(row,  szFieldPlayerToyInfo[extraid][i][ptPosY]);

                            
format(szFieldsizeof(szField), "pt%dPosZ"i);
                            
cache_get_value_name__float(row,  szFieldPlayerToyInfo[extraid][i][ptPosZ]);

                            
format(szFieldsizeof(szField), "pt%dRotX"i);
                            
cache_get_value_name__float(row,  szFieldPlayerToyInfo[extraid][i][ptRotX]);

                            
format(szFieldsizeof(szField), "pt%dRotY"i);
                            
cache_get_value_name__float(row,  szFieldPlayerToyInfo[extraid][i][ptRotY]);

                            
format(szFieldsizeof(szField), "pt%dRotZ"i);
                            
cache_get_value_name__float(row,  szFieldPlayerToyInfo[extraid][i][ptRotZ]);

                            
format(szFieldsizeof(szField), "pt%dScaX"i);
                            
cache_get_value_name__float(row,  szFieldPlayerToyInfo[extraid][i][ptScaX]);

                            
format(szFieldsizeof(szField), "pt%dScaY"i);
                            
cache_get_value_name__float(row,  szFieldPlayerToyInfo[extraid][i][ptScaY]);

                            
format(szFieldsizeof(szField), "pt%dScaZ"i);
                            
cache_get_value_name__float(row,  szFieldPlayerToyInfo[extraid][i][ptScaZ]);
                        }
                        else
                        {
                            
PlayerToyInfo[extraid][i][ptBone] = 0;
                            
PlayerToyInfo[extraid][i][ptPosX] = 0.0;
                            
PlayerToyInfo[extraid][i][ptPosY] = 0.0;
                            
PlayerToyInfo[extraid][i][ptPosZ] = 0.0;
                            
PlayerToyInfo[extraid][i][ptRotX] = 0.0;
                            
PlayerToyInfo[extraid][i][ptRotY] = 0.0;
                            
PlayerToyInfo[extraid][i][ptRotZ] = 0.0;
                            
PlayerToyInfo[extraid][i][ptScaleX] = 0.0;
                            
PlayerToyInfo[extraid][i][ptScaleY] = 0.0;
                            
PlayerToyInfo[extraid][i][ptScaleZ] = 0.0;
                        }
                    } 



Re: argument type mismatch - iKarim - 17.03.2018

You have double underscores "__" instead of a single one in the float functions, they should be:

PHP код:
cache_get_value_name_float