SA-MP Forums Archive
Argument type mismatch (argument 1) when getting info from MySQL database - 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 (argument 1) when getting info from MySQL database (/showthread.php?tid=517538)



Argument type mismatch (argument 1) when getting info from MySQL database - kamiliuxliuxliux - 05.06.2014


Hey, the code there
pawn Код:
new admin_name[25], prz[60], data[20], s[200], s1[2000], tipas;
                    while(mysql_retrieve_row(1))
                    {
                        mysql_get_field("admin_name", admin_name);
                        mysql_get_field("prz", prz);
                        mysql_get_field("data", data);
                        mysql_get_field("tipas", tipas); // error line! I tried to delete it and then everything went good, but when I wrote it again, it gives me an error again! :((
                        if(tipas == 1) {format(s, 2000, "{FFFFFF}[{B36666}ban{FFFFFF}](%s) {15FF0F}ADM: %s {FF8000}(%s)\n", data, admin_name, prz);}
                        else if(tipas == 0) {format(s, 2000, "{FFFFFF}[{B36666}kick{FFFFFF}](%s) {15FF0F}ADM: %s {FF8000}(%s)\n", data, admin_name, prz);}
                        strcat(s1, s);
                    }
What should I do?



Re: Argument type mismatch (argument 1) when getting info from MySQL database - Konstantinos - 05.06.2014

The 2nd argument is wrong. It should be an array/string but you used an integer. Store it to a temporary string and then use strval and store the output to "tipas".


Re: Argument type mismatch (argument 1) when getting info from MySQL database - kamiliuxliuxliux - 05.06.2014

Ok, now with this everything's fine. But now it returns me errors in if and else if statements, that array must be indexed, what now?



Re: Argument type mismatch (argument 1) when getting info from MySQL database - kamiliuxliuxliux - 05.06.2014

Thanks bro!