EAX Sort
Умник
Есть вот такая загрузка авто из БД:
Авто загружаются нормально, но бензин не загружается, почему-то.
Вот спидометр:
PHP:
publics: LoadCars()
{
static rows, fields;
cache_get_data(rows, fields);
new time = GetTickCount(),i = 0;
//new maximum[160];
if(rows)
{
for(new idx = 0;idx < rows; idx++)
{
new vehicleid = CreateVehicle (400, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
DestroyVehicle(vehicleid);
//==================================================================
VehicleInfo[idx][vID] = cache_get_field_content_int(idx, "vID", connects);
VehicleInfo[idx][vEngine] = cache_get_field_content_int(idx, "vEngine", connects);
VehicleInfo[idx][vFuel] = cache_get_field_content_float(idx, "vFuel", connects);
VehicleInfo[idx][vProbeg] = cache_get_field_content_float(idx, "vProbeg", connects);
VehicleInfo[idx][vLights] = cache_get_field_content_int(idx, "vLights", connects);
VehicleInfo[idx][vPosx] = cache_get_field_content_float(idx, "vPosx", connects);
VehicleInfo[idx][vPosy] = cache_get_field_content_float(idx, "vPosy", connects);
VehicleInfo[idx][vPosz] = cache_get_field_content_float(idx, "vPosz", connects);
VehicleInfo[idx][vPosc] = cache_get_field_content_float(idx, "vPosc", connects);
cache_get_field_content(idx, "vNomer",VehicleInfo[idx][vNomer],connects,MAX_PLAYER_NAME);
VehicleInfo[idx][vMaxFuel] = cache_get_field_content_float(idx, "vMaxFuel", connects);
VehicleInfo[idx][vFrac] = cache_get_field_content_int(idx, "vFrac", connects);
VehicleInfo[idx][vModel] = cache_get_field_content_int(idx, "vModel", connects);
VehicleInfo[idx][vCol1] = cache_get_field_content_int(idx, "vCol1", connects);
VehicleInfo[idx][vCol2] = cache_get_field_content_int(idx, "vCol2", connects);
VehicleInfo[idx][vLock] = cache_get_field_content_int(idx, "vLock", connects);
cache_get_field_content(idx, "vOwner",VehicleInfo[idx][vOwner],connects,MAX_PLAYER_NAME);
//==================================================================
AddStaticVehicleEx(VehicleInfo[idx][vModel],VehicleInfo[idx][vPosx],VehicleInfo[idx][vPosy],VehicleInfo[idx][vPosz],VehicleInfo[idx][vPosc],VehicleInfo[idx][vCol1],VehicleInfo[idx][vCol2],-1); //Sentinel
i++;
if(VehicleInfo[vehicleid][vProbeg] > 1000000) VehicleInfo[vehicleid][vProbeg] = 0;
if(strlen(VehicleInfo[vehicleid][vNomer]) <= 3)
{
new string[MAX_PLAYER_NAME];
format(string,MAX_PLAYER_NAME,"%c%c%c %i",65+random(26),65+random(26),65+random(26),100+idx);
strmid(VehicleInfo[vehicleid][vNomer], string, 0, strlen(string), 24);
}
}
printf("Автомобилей загружено: %d. | Потрачено: %d ms.", i, GetTickCount() - time);
}
else printf("Автомобили не загружены");
return true;
}
Вот спидометр:
PHP:
public UpdateSpeed(playerid)
{
new string[256];
new v = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(!IsAVelik(v))
{
format(string, sizeof(string), "~b~KM/H: ~g~%d~n~~b~FUEL: ~g~%d~n~~b~MILAGE:~g~ %d km~n~~b~ENGINE:~g~ %s",
SpeedVehicle(playerid), floatround(VehicleInfo[v][vFuel]), floatround(VehicleInfo[v][vProbeg]),
(!VehicleInfo[v][vEngine]) ? ("~r~Off"):("~g~On"));
PlayerTextDrawSetString(playerid, VehicleTextDraw[playerid], string);
/*switch(VehicleInfo[v][vLights])
{
case 0: PlayerTextDrawSetString(playerid, CarLights[playerid], "~w~L");
case 1: PlayerTextDrawSetString(playerid, CarLights[playerid], "~b~L");
}*/
if(VehicleInfo[v][vFuel] <= 0)
{
VehicleInfo[v][vEngine] = 0;
VehicleInfo[v][vFuel] = 0.0;
SetVehicleParamsEx(v, VehicleInfo[v][vEngine], VehicleInfo[v][vLights],0,0,0,0,0);
}
if(GetPlayerDistanceFromPoint(playerid, VehicleInfo[v][vPosx], VehicleInfo[v][vPosy], VehicleInfo[v][vPosz]) > 50.0)
{
VehicleInfo[v][vProbeg] += 0.1;
VehicleInfo[v][vFuel] -= 0.04;
GetPlayerPos(playerid, VehicleInfo[v][vPosx],VehicleInfo[v][vPosy],VehicleInfo[v][vPosz]);
}
}
}
return 1;
}
