09.06.2013, 09:36
Hey.
I have a problem, that I load player/job/group vehicles from MYSQL, I know MYSQL pretty well, but I don't know what cause the player vehicles duplicate and sometime disappearing.
The vehicles loading THREAD:
I have a problem, that I load player/job/group vehicles from MYSQL, I know MYSQL pretty well, but I don't know what cause the player vehicles duplicate and sometime disappearing.
The vehicles loading THREAD:
PHP код:
case THREAD_INITIATE_VEHICLES: {
mysql_store_result();
new
x,
bool: success = true;
while(mysql_retrieve_row()) {
mysql_get_field("vehicleID", result);
x = strval(result);
if(systemVariables[vehicleCounts][0] + systemVariables[vehicleCounts][1] + systemVariables[vehicleCounts][2] < MAX_VEHICLES) {
mysql_get_field("vehicleModelID", result);
vehicleVariables[x][vVehicleModelID] = strval(result);
mysql_get_field("vehiclePosX", result);
vehicleVariables[x][vVehiclePosition][0] = floatstr(result);
mysql_get_field("vehiclePosY", result);
vehicleVariables[x][vVehiclePosition][1] = floatstr(result);
mysql_get_field("vehiclePosZ", result);
vehicleVariables[x][vVehiclePosition][2] = floatstr(result);
mysql_get_field("vehiclePosRotation", result);
vehicleVariables[x][vVehicleRotation] = floatstr(result);
mysql_get_field("vehicleHealth", result);
vehicleVariables[x][vVehicleHealth] = floatstr(result);
mysql_get_field("vehicleGroup", result);
vehicleVariables[x][vVehicleGroup] = strval(result);
mysql_get_field("vehicleCol1", result);
vehicleVariables[x][vVehicleColour][0] = strval(result);
mysql_get_field("vehicleCol2", result);
vehicleVariables[x][vVehicleColour][1] = strval(result);
if(vehicleVariables[x][vVehicleColour][0] < 0) {
vehicleVariables[x][vVehicleColour][0] = random(126);
}
if(vehicleVariables[x][vVehicleColour][1] < 0) {
vehicleVariables[x][vVehicleColour][1] = random(126);
}
mysql_get_field("vehiclePaintjob", result);
vehicleVariables[x][vVehiclePaintJob] = strval(result);
mysql_get_field("vehicleFuel", result);
vehicleVariables[x][vVehicleFuel] = strval(result);
mysql_get_field("vehicleBattery", result);
vehicleVariables[x][vVehicleBattery] = strval(result);
mysql_get_field("vehicleLock", result);
vehicleVariables[x][vVehicleLock] = strval(result);
mysql_get_field("vehiclePagassA", result);
vehicleVariables[x][vVehiclePagass] = strval(result);
mysql_get_field("vehicleKapottA", result);
vehicleVariables[x][vVehicleKapott] = strval(result);
mysql_get_field("vehicleOdomeeter", result);
vehicleVariables[x][vVehicleOdomeeter] = strval(result);
mysql_get_field("vehicleOwner", result);
vehicleVariables[x][vVehicleOwner] = strval(result);
mysql_get_field("vehiclePuhtus", result);
vehicleVariables[x][vPuhtus] = strval(result);
mysql_get_field("vehicleGPS", result);
vehicleVariables[x][vVehicleGPS] = strval(result);
mysql_get_field("Component0", result);
vehicleVariables[x][vVehicleMods][0] = strval(result);
mysql_get_field("Component1", result);
vehicleVariables[x][vVehicleMods][1] = strval(result);
mysql_get_field("Component2", result);
vehicleVariables[x][vVehicleMods][2] = strval(result);
mysql_get_field("Component3", result);
vehicleVariables[x][vVehicleMods][3] = strval(result);
mysql_get_field("Component4", result);
vehicleVariables[x][vVehicleMods][4] = strval(result);
mysql_get_field("Component5", result);
vehicleVariables[x][vVehicleMods][5] = strval(result);
mysql_get_field("Component6", result);
vehicleVariables[x][vVehicleMods][6] = strval(result);
mysql_get_field("Component7", result);
vehicleVariables[x][vVehicleMods][7] = strval(result);
mysql_get_field("Component8", result);
vehicleVariables[x][vVehicleMods][8] = strval(result);
mysql_get_field("Component9", result);
vehicleVariables[x][vVehicleMods][9] = strval(result);
mysql_get_field("Component10", result);
vehicleVariables[x][vVehicleMods][10] = strval(result);
mysql_get_field("Component11", result);
vehicleVariables[x][vVehicleMods][11] = strval(result);
mysql_get_field("Component12", result);
vehicleVariables[x][vVehicleMods][12] = strval(result);
mysql_get_field("VehicleJob", result);
vehicleVariables[x][vVehicleJob] = strval(result);
mysql_get_field("VehicleNumberPlate", vehicleVariables[x][vVehiclePlate]);
if(vehicleVariables[x][vVehicleJob] == -1) {
vehicleVariables[x][vVehicleScriptID] = CreateVehicle(vehicleVariables[x][vVehicleModelID], vehicleVariables[x][vVehiclePosition][0], vehicleVariables[x][vVehiclePosition][1], vehicleVariables[x][vVehiclePosition][2], vehicleVariables[x][vVehicleRotation], vehicleVariables[x][vVehicleColour][0], vehicleVariables[x][vVehicleColour][1], 60000);
} else {
vehicleVariables[x][vVehicleScriptID] = CreateVehicle(vehicleVariables[x][vVehicleModelID], vehicleVariables[x][vVehiclePosition][0], vehicleVariables[x][vVehiclePosition][1], vehicleVariables[x][vVehiclePosition][2], vehicleVariables[x][vVehicleRotation], vehicleVariables[x][vVehicleColour][0], vehicleVariables[x][vVehicleColour][1], 60);
}
if(vehicleVariables[x][vVehicleGroup] == 1) {
switch(vehicleVariables[x][vVehicleModelID]) { // OnVehicleSpawn has some annoying glitches with this!1. Should fix.
case 427, 428, 432, 601, 528: SetVehicleHealth(vehicleVariables[x][vVehicleScriptID], 5000.0);
}
}
for(new i = 0; i < 13; i++) {
if(vehicleVariables[x][vVehicleMods][i] >= 1) AddVehicleComponent(vehicleVariables[x][vVehicleScriptID], vehicleVariables[x][vVehicleMods][i]);
}
if(vehicleVariables[x][vVehiclePaintJob] != -1) ChangeVehiclePaintjob(vehicleVariables[x][vVehicleScriptID], vehicleVariables[x][vVehiclePaintJob]);
SetVehicleHealth(vehicleVariables[x][vVehicleScriptID], vehicleVariables[x][vVehicleHealth]);
SetVehicleNumberPlate(vehicleVariables[x][vVehicleScriptID], vehicleVariables[x][vVehiclePlate]);
new mootor, tuled, lalarm, kapott, mingiasi, lukk, pagasnik;
if(vehicleVariables[x][vVehiclePagass] == 1) SetVehicleParamsEx(x, mootor, tuled, lalarm, lukk, kapott, 1, mingiasi);
if(vehicleVariables[x][vVehicleKapott] == 1) SetVehicleParamsEx(x, mootor, tuled, lalarm, lukk, 1, pagasnik, mingiasi);
// SetVehicleParamsEx(x, mootor, tuled, lalarm, lukk, kapott, pagasnik, 1);
systemVariables[vehicleCounts][0]++;
}