Hallo liebe Gemeinde ich habe ein Problem mit meinm Autohaus, und zwar habe ich ein befehl gemacht der Autos in eine Datenbank einspeichert jedoch bekomme ich den Error.
Code
[13:17:00] [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 ''' at line 1
Hier der mysql Befehl
Code
//enums
enum spauto {
id_x,
besitzer[MAX_PLAYER_NAME],
model,
Float:c_X,
Float:c_Y,
Float:c_Z,
Float:c_R,
ccolor1,
ccolor2
};
//Query mit Einheit
saveCarToDB(carid,playerid)
{
new query[128];
format(query,sizeof(query),"INSERT INTO autos (besitzer,model,x,y,z,a,color1,color2) VALUES ('%i','%i','%f','%f','%f','%f','%i','%i')",sInfo[playerid][id],cInfo[carid][model],cInfo[carid][c_X],cInfo[carid][c_Y],cInfo[carid][c_Z],cInfo[carid][c_R],cInfo[carid][ccolor1],cInfo[carid][ccolor2]);
mysql_function_query(dbhandle,query,false,"","");
return 1;
}
createPlayerCar(playerid,modelid,Float:x,Float:y,Float:z,Float:a,color1,color2)
{
for(new i=0; i<sizeof(cInfo); i++)
{
new name[MAX_PLAYER_NAME];
if(cInfo[i][id_x]!=0)continue;
cInfo[i][c_X] = x;
cInfo[i][c_Y] = y;
cInfo[i][c_Z] = z;
cInfo[i][c_R] = a;
cInfo[i][ccolor1] = color1;
cInfo[i][ccolor2] = color2;
cInfo[i][model] = modelid;
cInfo[i][id_x] = CreateVehicle(modelid,x,y,z,a,color1,color2,-1);
saveCarToDB(playerid,i);
return 1;
}
return 1;
}
//Behfehl
ocmd:vcar(playerid,params[])
{
new Float:X,Float:Y,Float:Z,Float:A,color1,color2,mid,car,pID;
if(!IsAdmin(playerid,2))return SendClientMessage(playerid,COLOR_RED,"*Du besitzt nicht die nötigen Rechte*");
if(sscanf(params,"iiii",pID,mid,color1,color2))return SendClientMessage(playerid,COLOR_RED,"Nutze: /vcar [ID] [Color1] [Color2]");
if(mid<400||mid>611)return 1;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,A);
car = createPlayerCar(pID,mid,X,Y,Z,A,color1,color2);
PutPlayerInVehicle(playerid,car,0);
return 1;
}
Alles anzeigen
Ich hoffe ihr könnt mir da weiter helfen