06.10.2013, 16:50
I thought I had this working now...I guess not :/ The vehicles won't write to the database, and I don't know why this shit happens, but it's really starting to bug me lol..
This is the Query
pawn Код:
CMD:createvehicle(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >=4)
{
new modelid, color1, color2;
if(sscanf(params, "ddd", modelid, color1, color2))
{
UsageMessage(pid, "/createvehicle [modelid] [color1] [color2]");
return 1;
}
else
{
new Float:X, Float:Y, Float:Z, Float:A, vehicleID, Query[300];
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
vehicleID = VehicleGetFreeSlot();
VehicleInfo[vehicleID][vFuel] = 20;
VehicleInfo[vehicleID][vModel] = modelid;
VehicleInfo[vehicleID][vCol1] = color1;
VehicleInfo[vehicleID][vCol2] = color2;
VehicleInfo[vehicleID][vSpawnX] = X;
VehicleInfo[vehicleID][vSpawnY] = Y;
VehicleInfo[vehicleID][vSpawnZ] = Z;
VehicleInfo[vehicleID][vSpawnA] = A;
VehicleInfo[vehicleID][vID] = vehicleID;
CreateVehicle(modelid, X, Y, Z, A, color1, color2, 999999);
format(Query, sizeof(Query), "INSERT INTO `VEHICLES` (`FUEL`, `MODEL`, `COLOR1`, `COLOR2`, `ID`, `SPAWNX`, `SPAWNY`, `SPAWNZ`, `SPAWNA`) VALUES(%d, %d, %d, %d, %d, %f, %f, %f, %f)", VehicleInfo[vehicleID][vFuel], VehicleInfo[vehicleID][vModel], VehicleInfo[vehicleID][vCol1], VehicleInfo[vehicleID][vCol2], VehicleInfo[vehicleID][vID], VehicleInfo[vehicleID][vSpawnX], VehicleInfo[vehicleID][vSpawnY], VehicleInfo[vehicleID][vSpawnZ], VehicleInfo[vehicleID][vSpawnA]);
print(Query);
PutPlayerInVehicle(playerid, vehicleID, 0);
vCreated[vehicleID] = true;
return 1;
}
}
return 1;
}
Код:
21:40:29] INSERT INTO `VEHICLES` (`FUEL`, `MODEL`, `COLOR1`, `COLOR2`, `ID`, `SPAWNX`, `SPAWNY`, `SPAWNZ`, `SPAWNA`) VALUES(20, 490, 0, 0, 1, -2270.935546, 2327.279296, 4.820213, 273.229309)