08.10.2013, 20:57
When it creates the vehicle, it automatically writes to the database 199 times, and it should only do it once.
pawn Код:
stock VehicleCreate(modelid, Float:X, Float:Y, Float:Z, Float:A, color1, color2)
{
new Query[250], vehicleID, owner[30];
vehiclescreated++;
vehicleID = vehiclescreated;
vCreated[vehicleID] = true;
format(owner, sizeof(owner), "None");
VehicleInfo[vehicleID][vOwner] = owner;
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` (`OWNER`, `FUEL`, `MODEL`, `COLOR1`, `COLOR2`, `ID`, `SPAWNX`, `SPAWNY`, `SPAWNZ`, `SPAWNA`) VALUES('%s', %d, %d, %d, %d, %d, '%.4f', '%.4f', '%.4f', '%.4f')",
VehicleInfo[vehicleID][vOwner], 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]);
db_query(survival, Query);
print(Query);
return vehicleID;
}