mysql INSERT INTO
#1

hey,

got a problem with INSERT INTO
Код:
format(query, sizeof(query), "INSERT INTO `cars` (`owner`, `spawnx`, `spawny`, `spawnz`, `spawnr`, `modelid`, `c1`,`c2`) VALUES ('%s', '%f', '%f', '%f', '%f', '%d', '%d', '%d')", SpielerName(playerid), x, y, z, a,modelid, c1,  c2);
here's the command
Код:
ocmd:savecar(playerid, params[])
{
	#pragma unused params
	
	new Float:x,Float:y,Float:z,Float:a,co1,co2,query[500];
	new vehicleid = GetVehicleModel(vehicleid);
	new v = GetPlayerVehicleID(playerid);
	GetVehiclePos(vehicleid,x,y,z);
	GetVehicleZAngle(vehicleid, a);
	GetVehicleColor(v, co1, co2);
	format(query, sizeof(query), "INSERT INTO `cars` (`owner`, `spawnx`, `spawny`, `spawnz`, `spawnr`, `modelid`, `c1`,`c2`) VALUES ('%s', '%f', '%f', '%f', '%f', '%d', '%d', '%d')", SpielerName(playerid), x, y, z, a,modelid, c1,  c2);
	mysql_query(query);
	printf(" %s ", query);
	RemovePlayerFromVehicle(playerid);
	return 1;
}
But the output in the console is:
Код:
 INSERT INTO `cars` (`owner`, `spawnx`, `spawny`, `spawnz`, `spawnr`, `modelid`, `c1`,`c2`) VALUES ('testuser', '0.000000', '0.000000', '0.000000', '0.000000', '48', '49', '50')
Where's the mistake?

best regardz
Reply
#2

pawn Код:
new vehicleid = GetVehicleModel(vehicleid);
new v = GetPlayerVehicleID(playerid);
Please explain how this looks at all logical to you.
Reply
#3

modelid and vehicleid differ.

pawn Код:
ocmd:savecar(playerid, params[])
{
    #pragma unused params
   
    new Float:x,Float:y,Float:z,Float:a,co1,co2,query[500];
    new modelid = GetVehicleModel(vehicleid);
    new vehicleid = GetPlayerVehicleID(playerid);
    GetVehiclePos(vehicleid,x,y,z);
    GetVehicleZAngle(vehicleid, a);
    GetVehicleColor(vehicleid, co1, co2);
    format(query, sizeof(query), "INSERT INTO `cars` (`owner`, `spawnx`, `spawny`, `spawnz`, `spawnr`, `modelid`, `c1`,`c2`) VALUES ('%s', '%f', '%f', '%f', '%f', '%d', '%d', '%d')", SpielerName(playerid), x, y, z, a,modelid, c1,  c2);
    mysql_query(query);
    printf(" %s ", query);
    RemovePlayerFromVehicle(playerid);
    return 1;
}
Reply
#4

uhm..yea..thanks.

Already too late for scripting
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)