Yes, I always use mysql_free_result after mysql_store_result.
pawn Код:
stock LoadPVehicles()
{
new
vModel2,
vC[2],
vPrice2,
vOwner2[MAX_PLAYER_NAME],
Float:Pos[4],
vID,
PlateNum[32],
vPaint_Job,
vModsToLoad[13],
vLock,
vTrunk[5],
vAmmo[5],
faction,
vdamage,
vengine,
job,
vdome,
Float:vdomeX,
Float:vdomeY,
Float:vdomeZ,
Float:vdomeRX,
Float:vdomeRY,
Float:vdomeRZ,
vpolicebar,
Float:vpolicebarX,
Float:vpolicebarY,
Float:vpolicebarZ,
Float:vpolicebarRX,
Float:vpolicebarRY,
Float:vpolicebarRZ,
Float:fuel,
sprunk,
cream,
radio,
radiostation,
labeltext[32];
mysql_query("SELECT * FROM `privateveh` ORDER BY vID");
mysql_store_result();
// print("Selecting from database");
if(mysql_num_rows() > 0)
{
// print("Rows are > 0");
while(mysql_fetch_row(szLargeString))
{
// print("While loop starts");
sscanf(szLargeString, "p<|>iiiiis[24]ffffs[32]iiiiiiiiiiiiiiiiiiifiiiiiiiiiiis[32]iiiffffffffffffii",
vID, vModel2, vC[0], vC[1], vPrice2, vOwner2, Pos[0], Pos[1], Pos[2], Pos[3], PlateNum, vPaint_Job,
vModsToLoad[0], vModsToLoad[1], vModsToLoad[2], vModsToLoad[3], vModsToLoad[4], vModsToLoad[5],
vModsToLoad[6], vModsToLoad[7], vModsToLoad[8], vModsToLoad[9], vModsToLoad[10], vModsToLoad[11], vModsToLoad[12],
vLock, faction, job, vdamage, vengine, fuel, vTrunk[0], vTrunk[1], vTrunk[2], vTrunk[3], vTrunk[4], vAmmo[0],
vAmmo[1], vAmmo[2], vAmmo[3], vAmmo[4], vdome, labeltext, sprunk, cream, vpolicebar, vpolicebarX, vpolicebarY,
vpolicebarZ, vpolicebarRX, vpolicebarRY, vpolicebarRZ, vdomeX, vdomeY, vdomeZ, vdomeRX, vdomeRY, vdomeRZ, radio,
radiostation);
// print("SSCANF string");
// printf("%f %f %f", Pos[0], Pos[1], Pos[2]);
new vCarID = CreateVehicle(vModel2, Pos[0], Pos[1], Pos[2], Pos[3],vC[0],vC[1], -1);
for(new i =0; i<DeliveryPoints; i++)
for(new j =1; j<DeliveryCoordinates[i][0][0]; j++)
if(Pos[0] == DeliveryCoordinates[i][j][0] && Pos[1] == DeliveryCoordinates[i][j][1] && Pos[2] == DeliveryCoordinates[i][j][2] && Pos[3] == DeliveryCoordinates[i][j][3])
OccupiedDelivery[i][j] = true;
SetVehicleHealth(vCarID, 1000.0);
RepairVehicle(vCarID);
if(vCarID == INVALID_VEHICLE_ID)
{
// print("Skipping current vehicle, the ID is invalid");
continue;
}
//print("Vehicle Created ");
// new str[20];
// format(str, sizeof(str), "VID: %d", vID);
// printf(str);
vInfo[vCarID][vSQLID] = vID;
vInfo[vCarID][vModel] = vModel2;
vInfo[vCarID][vColor1] = vC[0];
vInfo[vCarID][vColor2] = vC[1];
vInfo[vCarID][vPrice] = vPrice2;
strmid(vInfo[vCarID][vOwner], vOwner2, 0, 24, 24);
vInfo[vCarID][vPosX] = Pos[0];
vInfo[vCarID][vPosY] = Pos[1];
vInfo[vCarID][vPosZ] = Pos[2];
vInfo[vCarID][vPosA] = Pos[3];
strmid(vInfo[vCarID][vPlate], PlateNum, 0, 32, 32);
strmid(vInfo[vCarID][vTextLabel], labeltext, 0, 32, 32);
vInfo[vCarID][vPaintJ] = vPaint_Job;
vInfo[vCarID][vLocked] = vLock;
vInfo[vCarID][vFaction] = faction;
vInfo[vCarID][vJob] = job;
//vInfo[vCarID][vDamage] = damage;
//vInfo[vCarID][vEngine] = vengine;
vInfo[vCarID][vFuel] = fuel;
vInfo[vCarID][vSprunk] = sprunk;
vInfo[vCarID][vCream] = cream;
vInfo[vCarID][vRadio] = radio;
vInfo[vCarID][vRadioStation] = radiostation;
vInfo[vCarID][vTrunkSlots][0] = vTrunk[0];
vInfo[vCarID][vTrunkSlots][1] = vTrunk[1];
vInfo[vCarID][vTrunkSlots][2] = vTrunk[2];
vInfo[vCarID][vTrunkSlots][3] = vTrunk[3];
vInfo[vCarID][vTrunkSlots][4] = vTrunk[4];
vInfo[vCarID][vTrunkAmmo][0] = vAmmo[0];
vInfo[vCarID][vTrunkAmmo][1] = vAmmo[1];
vInfo[vCarID][vTrunkAmmo][2] = vAmmo[2];
vInfo[vCarID][vTrunkAmmo][3] = vAmmo[3];
vInfo[vCarID][vTrunkAmmo][4] = vAmmo[4];
vMods[vCarID][0] = vModsToLoad[0];
vMods[vCarID][1] = vModsToLoad[1];
vMods[vCarID][2] = vModsToLoad[2];
vMods[vCarID][3] = vModsToLoad[3];
vMods[vCarID][4] = vModsToLoad[4];
vMods[vCarID][5] = vModsToLoad[5];
vMods[vCarID][6] = vModsToLoad[6];
vMods[vCarID][7] = vModsToLoad[7];
vMods[vCarID][8] = vModsToLoad[8];
vMods[vCarID][9] = vModsToLoad[9];
vMods[vCarID][10] = vModsToLoad[10];
vMods[vCarID][11] = vModsToLoad[11];
vMods[vCarID][12] = vModsToLoad[12];
vInfo[vCarID][dome] = vdome;
vInfo[vCarID][domeX] = vdomeX;
vInfo[vCarID][domeY] = vdomeY;
vInfo[vCarID][domeZ] = vdomeZ;
vInfo[vCarID][domeRX] = vdomeRX;
vInfo[vCarID][domeRY] = vdomeRY;
vInfo[vCarID][domeRZ] = vdomeRZ;
vInfo[vCarID][policebar] = vpolicebar;
vInfo[vCarID][policebarX] = vpolicebarX;
vInfo[vCarID][policebarY] = vpolicebarY;
vInfo[vCarID][policebarZ] = vpolicebarZ;
vInfo[vCarID][policebarRX] = vpolicebarRX;
vInfo[vCarID][policebarRY] = vpolicebarRY;
vInfo[vCarID][policebarRZ] = vpolicebarRZ;
if(vInfo[vCarID][vPrice] == -1)
{
vInfo[vCarID][vBuyable] = 0;
}
else
{
vInfo[vCarID][vBuyable] = 1;
vInfo[vCarID][vTextID] = CreateDynamic3DTextLabel(vInfo[vCarID][vTextLabel], COLOR_YELLOW, vInfo[vCarID][vPosX], vInfo[vCarID][vPosY], vInfo[vCarID][vPosZ]+1.0, 20.0, INVALID_PLAYER_ID, vCarID);
}
// print("Setting array vars");
SetVehicleNumberPlate(vCarID, vInfo[vCarID][vPlate]);
ChangeVehiclePaintjob(vCarID, vInfo[vCarID][vPaintJ]);
// SetVehicleHealth(vCarID, vInfo[vCarID][vEngine]);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vCarID, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vCarID, 0, lights, alarm, doors, bonnet, boot, 0);
SetVehiclePos(vCarID, vInfo[vCarID][vPosX], vInfo[vCarID][vPosY], vInfo[vCarID][vPosZ]+1.0);
SetVehicleZAngle(vCarID, vInfo[vCarID][vPosA]);
// print("Misc functions");
for(new iMod = 0; iMod < MAX_VEH_MODS; ++iMod)
{
if(vMods[vCarID][iMod] > 0)
{
AddVehicleComponent(vCarID, vMods[vCarID][iMod]);
}
}
if(vdome)
{
AddDome(vInfo[vCarID][dome],vCarID, 0);
printf("%d %d\n",vCarID, vInfo[vCarID][dome]);
}
if(vpolicebar)
{
AddPoliceBar(vInfo[vCarID][policebar], vCarID, 0);
printf("%d %d\n", vCarID, vInfo[vCarID][policebar]);
}
// print("Mods");
++ Total_Veh_Created;
systemVariables[vehicleCounts][1]++;
}
}
mysql_free_result();
// print("Free Result");
printf("** A total of: \"%i\" vehicle(s) were loaded!", Total_Veh_Created);
return Total_Veh_Created;
}