Error 035: argument type mismatch
#1

Getting rather annoyed with this error now as I don't have a clue what is causing it. Now bare with me as I'm still learning.

Quote:

(2370) : error 035: argument type mismatch (argument 1)
(2372) : error 035: argument type mismatch (argument 1)
(2374) : error 035: argument type mismatch (argument 1)
(2376) : error 035: argument type mismatch (argument 1)
(237 : error 035: argument type mismatch (argument 1)
(2380) : error 035: argument type mismatch (argument 1)
(2382) : error 035: argument type mismatch (argument 1)
(2384) : error 035: argument type mismatch (argument 1)
(2386) : error 035: argument type mismatch (argument 1)
(238 : error 035: argument type mismatch (argument 1)
(2390) : error 035: argument type mismatch (argument 1)
(2392) : error 035: argument type mismatch (argument 1)
(2394) : error 035: argument type mismatch (argument 1)
(2396) : error 035: argument type mismatch (argument 1)
(239 : error 035: argument type mismatch (argument 1)
(2400) : error 035: argument type mismatch (argument 1)

Code: Lines 2358 - 2412
Код:
stock LoadVehicleID(vehicleid, playerid)
{
	new query[1021];
	new fetchVal[100];
	format(query, sizeof(query), "SELECT * FROM pvehicles WHERE id= %d", vehicleid);
	mysql_query(query);
	mysql_store_result();
	if(mysql_num_rows())
	if(mysql_fetch_row(query))
	{
			mysql_fetch_field("id", fetchVal);
            vehicleinfo[vehicleid][vvid] = strval(fetchVal);
            mysql_fetch_field("model", fetchVal);
            vehicleinfo[vehicleid][Model] = strval(fetchVal);
            mysql_fetch_field("color1", fetchVal);
            vehicleinfo[vehicleid][Color1] = strval(fetchVal);
            mysql_fetch_field("color2", fetchVal);
            vehicleinfo[vehicleid][Color2] = strval(fetchVal);
           	mysql_fetch_field("x", fetchVal);
            vehicleinfo[vehicleid][possx] = strval(fetchVal);
          	mysql_fetch_field("y", fetchVal);
            vehicleinfo[vehicleid][possy] = strval(fetchVal);
          	mysql_fetch_field("z", fetchVal);
            vehicleinfo[vehicleid][possz] = strval(fetchVal);
       	 	mysql_fetch_field("a", fetchVal);
            vehicleinfo[vehicleid][possa] = strval(fetchVal);
            mysql_fetch_field("name", fetchVal);
            format(vehicleinfo[vehicleid][Name], 50, fetchVal);
          	mysql_fetch_field("owner", fetchVal);
            format(vehicleinfo[vehicleid][Owner], 50, fetchVal);
          	mysql_fetch_field("lock", fetchVal);
            vehicleinfo[vehicleid][Lock] = strval(fetchVal);
         	mysql_fetch_field("parked", fetchVal);
            vehicleinfo[vehicleid][Parked] = strval(fetchVal);
          	mysql_fetch_field("spawned", fetchVal);
            vehicleinfo[vehicleid][Spawned] = strval(fetchVal);
         	mysql_fetch_field("destroyed", fetchVal);
            vehicleinfo[vehicleid][Destroyed] = strval(fetchVal);
        	mysql_fetch_field("licenses", fetchVal);
            vehicleinfo[vehicleid][Licenses] = strval(fetchVal);
         	mysql_fetch_field("engine", fetchVal);
            vehicleinfo[vehicleid][Engine] = strval(fetchVal);
          	mysql_fetch_field("type", fetchVal);
            vehicleinfo[vehicleid][vtype] = strval(fetchVal);
	    	vkey[playerid] = CreateVehicle(vehicleinfo[vehicleid][Model],vehicleinfo[vehicleid][possx],vehicleinfo[vehicleid][possy],vehicleinfo[vehicleid][possz],vehicleinfo[vehicleid][possa],vehicleinfo[vehicleid][Color1],vehicleinfo[vehicleid][Color2], 60*10000);
            SetVehicleZAngle(vkey[playerid], vehicleinfo[vehicleid][possa]);
			printf("result: %d",vkey[playerid]);
			vvkey[vkey[playerid]] = vehicleid;
			new engine,lights,alarm,doors,bonnet,boot,objective;
			GetVehicleParamsEx(vkey[playerid],engine,lights,alarm,doors,bonnet,boot,objective);
			SetVehicleParamsEx(vkey[playerid],0,lights,alarm,doors,bonnet,boot,objective);
			vehicleinfo[vehicleid][Engine] = 0;
			printf("type = %d", vehicleinfo[vehicleid][vtype]);
	}
}
Reply
#2

This error only happens when I include a command into the script, when I remove the command the error doesn't happen.

the command being:

Код:
CMD:vget(playerid, params[]){
	new string[256];
	new x_v[256];
	new idx;
	new x_vehicles[256];
	x_v = strtok(params, idx);
	x_vehicles = strtok(params, idx);
	if(!strlen(x_vehicles))
	{
		(playerid,COLOR_YELLOW2," /vget (id) ");
		return true;
	}
	if(vkey[playerid] > 0)
	{
		SendClientMessage(playerid, COLOR_RED,"You can only have one vehicle spawned!");
		return 1;
	}
	if(strcmp(x_vehicles,"1",true) == 0)
	{
		if(playerkeys[playerid][0] == 0)
		{
			SendClientMessage(playerid, COLOR_RED,"You don't have any vehicle on this slot!");
			return 1;
		}
		LoadVehicleID(playerkeys[playerid][0], playerid);
    }
	if(strcmp(x_vehicles,"2",true) == 0)
	{
		if(playerkeys[playerid][1] == 0)
		{
			SendClientMessage(playerid, COLOR_RED,"You don't have any vehicle on this slot!");
			return 1;
		}
		LoadVehicleID(playerkeys[playerid][1], playerid);
	}
	if(strcmp(x_vehicles,"3",true) == 0)
	{
    	if(playerkeys[playerid][2] == 0)
		{
			SendClientMessage(playerid, COLOR_RED,"You don't have any vehicle on this slot!");
			return 1;
		}
		LoadVehicleID(playerkeys[playerid][2], playerid);
	}
	if(strcmp(x_vehicles,"4",true) == 0)
	{
		if(playerkeys[playerid][3] == 0)
		{
			SendClientMessage(playerid, COLOR_RED,"You don't have any vehicle on this slot!");
			return 1;
		}
		LoadVehicleID(playerkeys[playerid][3], playerid);
	}
	if(strcmp(x_vehicles,"5",true) == 0)
	{
		if(playerkeys[playerid][4] == 0)
		{
			SendClientMessage(playerid, COLOR_RED,"You don't have any vehicle on this slot!");
			return 1;
		}
		LoadVehicleID(playerkeys[playerid][4], playerid);
	}
	return 1;
}
Reply
#3

https://sampwiki.blast.hk/wiki/MySQL#mysql_fetch_field

Also missing bracket starting at line 2366
Reply
#4

Ah, didn't notice that >.<

I apologize, I'm new to this whole SAMP scripting thing and still learning. I've had problems with MySQL since day 1 and find it quite difficult to integrate it with the script hah... What are you saying by linking me to the mysql_fetch_field ?
Reply
#5

mysql_fetch_field uses field index, not name.

pawn Код:
//Bad
mysql_fetch_field("wafflez", str);
//Good
mysql_fetch_field(0, str);
You need mysql_fetch_field_row (mysql_get_field macro to be exact)
pawn Код:
mysql_fetch_field("WAFFLEZ", fetchVal);
//changes to
mysql_get_field("WAFFLEZ", fetchVal);
Reply
#6

Quote:
Originally Posted by Misiur
Посмотреть сообщение
mysql_fetch_field uses field index, not name.

pawn Код:
//Bad
mysql_fetch_field("wafflez", str);
//Good
mysql_fetch_field(0, str);
You need mysql_fetch_field_row (mysql_get_field macro to be exact)
pawn Код:
mysql_fetch_field("WAFFLEZ", fetchVal);
//changes to
mysql_get_field("WAFFLEZ", fetchVal);
Ahhh, I get it now. Thanks a lot!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)