Problem with saving cars.
#1

This is my save car command.

Код:
CMD:savecar(playerid, params[]) // Work On
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
		new aName[MAX_PLAYER_NAME], carplate[256], groupid, color1, color2, string[1024], query[1024], Float:x, Float:y, Float:z, Float:f;
		if(sscanf(params, "s[256]ddd", carplate, groupid, color1, color2)) return SendClientMessage(playerid, COLOR_GREY, "Usage: {FFFFFF}/savecar [carplate] [group] [color 1] [color 2]");
		if(color1 < 128 && color1 > 255 || color2 < 128 && color2 > 255) return SendClientMessage(playerid, COLOR_GREY, "Car color must be between 128 and 255.");
		if(IsPlayerInAnyVehicle(playerid))
		{
			new carid = GetPlayerVehicleID(playerid);
			new virtual = GetPlayerVirtualWorld(playerid);
			GetPlayerName(playerid, aName, sizeof(aName));
			GetPlayerFacingAngle(playerid, f);
			GetVehiclePos(carid, x, y, z);
			mysql_format(mysql, query, sizeof(query), "INSERT INTO `vehicles` (`carModel`, `carOwner`, `carPosX`, `carPosY`, `carPosZ`, `carPosF`, `carGroup`, `carPlate`, `carVirtualWorld`, `carColor1`, `carColor2`) VALUES ('%d', The State, '%f', '%f', '%f', '%f', '%d', '%s', '%d', '%d', '%d')", carid, x, y, z, f, groupid, carplate, virtual, color1, color2);
			mysql_tquery(mysql, query);
			format(string, sizeof(string), "AdmWarn: {FFFFFF}Admin %s has saved the car %d.", aName, carid);
			AdminChat(string, COLOR_RED);
		}
		else SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle.");
	}
	else return SendClientMessage(playerid, -1, NotAdmin);
	return 1;
}
It doesn't save anything..
This is my Mysql_log.

Код:
[02:27:08] [DEBUG] mysql_format - connection: 1, len: 512, format: "INSERT INTO `vehicles` (`carModel`, `carOwner`, `carPosX`, `carPosY`, `carPosZ`, `carPosF`, `carGroup`, `carPlate`, `carVirtualW..."
[02:27:08] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `vehicles` (`carModel`, `carOwner`, `carPosX`, `carP", callback: "(null)", format: "(null)"
[02:27:08] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[02:27:08] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'State, '1535.782', '-1677.357', '13.104', '290.738', '1', 'LSPD', '0', '211', '2' at line 1
[02:27:08] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
How can I fix this?
Reply
#2

Would've thought that "You have an error in your SQL syntax;" would give you a clue as to what it's having an issue with.

What version of MariaDB are you using, and has it worked at all in the past?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)