25.06.2015, 19:24
So , my database is :
The problem is that even if the vLock is 1 , the car on spawn it gets unlocked.
Why? is something from my loading script ?
The problem is that even if the vLock is 1 , the car on spawn it gets unlocked.
Why? is something from my loading script ?
pawn Код:
function LoadingVehicles()
{
new Cache: Result = mysql_query( mysql, "SELECT * FROM `vehicles`" ), Get[ 2 ];
cache_get_data( Get[ 0 ], Get[ 1 ], SQL ); // Get[ 0 ] - Rows || Get[ 1 ] - Fields || SQL - connectionHandle
for(new i = 0; i < Get[0]; i++)
{
//Floats
new id = cache_get_field_content_int( i, "ID", mysql );
VehicleInfo[id][vX] = cache_get_field_content_float( i, "PosX", mysql );
VehicleInfo[id][vY] = cache_get_field_content_float( i, "PosY", mysql );
VehicleInfo[id][vZ] = cache_get_field_content_float( i, "PosZ", mysql );
VehicleInfo[id][vA] = cache_get_field_content_float( i, "PosAngle", mysql );
cache_get_field_content( i, "Owner", VehicleInfo[id][vOwner], mysql, 80 );
cache_get_field_content( i, "ModelName", VehicleInfo[id][vModelName], mysql, 80 );
cache_get_field_content( i, "vPlate", VehicleInfo[id][vPlate], mysql, 80 );
VehicleInfo[id][vColor1] = cache_get_field_content_int( i, "Color1", mysql );
VehicleInfo[id][vColor2] = cache_get_field_content_int( i, "Color2", mysql );
VehicleInfo[id][vTicket] = cache_get_field_content_int( i, "Ticket", mysql );
VehicleInfo[id][vLock] = cache_get_field_content_int( i, "vLock", mysql );
VehicleInfo[id][vID] = cache_get_field_content_int( i, "ID", mysql );
VehicleInfo[id][vNew] = cache_get_field_content_int( i, "New", mysql );
VehicleInfo[id][vFuel] = cache_get_field_content_int( i, "Fuel", mysql );
VehicleInfo[id][vModel] = cache_get_field_content_int( i, "Model", mysql );
VehicleInfo[id][vRadio] = cache_get_field_content_int( i, "Radio", mysql );
VehicleInfo[id][vGPS] = cache_get_field_content_int( i, "GPS", mysql );
VehicleInfo[id][vKM] = cache_get_field_content_int( i, "KM", mysql );
VehicleInfo[id][vBattery] = cache_get_field_content_int( i, "Battery", mysql );
VehicleInfo[id][vSpawned] = cache_get_field_content_int( i, "Spawned", mysql );
if(VehicleInfo[id][vSpawned] == 1)
{
VehicleInfo[id][vVeh] = CreateVehicle(VehicleInfo[id][vModel], VehicleInfo[id][vX], VehicleInfo[id][vY], VehicleInfo[id][vZ], VehicleInfo[id][vA], VehicleInfo[id][vColor1], VehicleInfo[id][vColor2], 16000);
new c = VehicleInfo[id][vVeh];
Radio[c] = 0;
Motor[c] = 0;
Gas[c] = VehicleInfo[id][vFuel];
GetVehicleParamsEx(c, engine, lights, alarm, doors, bonnet, boot, objective);
if(VehicleInfo[id][vLock] == 1)
{
SetVehicleParamsEx(c, 0, lights, alarm, 1, bonnet, boot, objective);
}
else if(VehicleInfo[id][vLock] == 0)
{
SetVehicleParamsEx(c, 0, lights, alarm, 0, bonnet, boot, objective);
}
SetVehicleNumberPlate(c, VehicleInfo[id][vPlate]);
SetVehicleToRespawn(c);
}
sVehicles ++;
}
cache_delete( Result );
printf("[%s] Loading vehicles from database - %d rows ",user,sVehicles);
}