sqlite spamming the table -
Mattakil - 08.10.2013
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;
}
Re: sqlite spamming the table -
-Prodigy- - 08.10.2013
How are you using that function?
Re: sqlite spamming the table -
Misiur - 08.10.2013
It seems your VehicleCreate is called too many times. The function by itself doesn't cause this
Re: sqlite spamming the table -
Mattakil - 08.10.2013
This is the command to create the vehicle
pawn Код:
CMD:createvehicle(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >=4)
{
new modelid, color1, color2, owner[30];
if(sscanf(params, "ddd", modelid, color1, color2)) return UsageMessage(pid, "/createvehicle [modelid] [color1] [color2]");
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
new ID = VehicleCreate(modelid, X, Y, Z, A, color1, color2);
format(owner, sizeof(owner), "%s", GetName(playerid));
VehicleInfo[ID][vOwner] = owner;
PutPlayerInVehicle(playerid, ID, 0);
}
return 1;
}