MartinKen
Новичок
здравствуйте еще раз, я здесь с новой проблемой, я создал базу данных с автомобилями, которыми можно владеть, проблема в том, что когда я сажусь в машину, format читает только последнюю строку в mysql для всех автомобилей, вот код...
PHP:
publics: LoadCars()
{
new vehicleid=1;
if(!cache_num_rows()) return print("[MySql] Cars Not Loaded.");
for (new idcar = 0;idcar != cache_num_rows();idcar ++)
{
cache_get_value_name_int(idcar, "vID", vCarInfo[vehicleid][vID]);
cache_get_value_name_int(idcar, "vModel", vCarInfo[vehicleid][vModel]);
cache_get_value_name_float(idcar, "vLocationX", vCarInfo[vehicleid][vLocationX]);//
cache_get_value_name_float(idcar, "vLocationY", vCarInfo[vehicleid][vLocationY]);//
cache_get_value_name_float(idcar, "vLocationZ", vCarInfo[vehicleid][vLocationZ]);//
cache_get_value_name_float(idcar, "vAngle", vCarInfo[vehicleid][vAngle]);//
cache_get_value_name_float(idcar, "vLocation_ParkX", vCarInfo[vehicleid][vLocation_ParkX]);//
cache_get_value_name_float(idcar, "vLocation_ParkY", vCarInfo[vehicleid][vLocation_ParkY]);//
cache_get_value_name_float(idcar, "vLocation_ParkZ", vCarInfo[vehicleid][vLocation_ParkZ]);//
cache_get_value_name_float(idcar, "vAngle_ParkA", vCarInfo[vehicleid][vAngle_ParkA]);//
cache_get_value_name_int(idcar, "vColorOne", vCarInfo[vehicleid][vColorOne]);
cache_get_value_name_int(idcar, "vColorTwo", vCarInfo[vehicleid][vColorTwo]);
cache_get_value_name(idcar, "vOwner", vCarInfo[vehicleid][vOwner],32);
cache_get_value_name(idcar, "vDescription", vCarInfo[vehicleid][vDescription],64);
cache_get_value_name_int(idcar, "vPrice", vCarInfo[vehicleid][vPrice]);
cache_get_value_name_int(idcar, "vLicense", vCarInfo[vehicleid][vLicense]);
cache_get_value_name_int(idcar, "vOwned", vCarInfo[vehicleid][vOwned]);
cache_get_value_name_int(idcar, "vLock", vCarInfo[vehicleid][vLock]);
cache_get_value_name_int(idcar, "vKM", vCarInfo[vehicleid][vKM]);
cache_get_value_name(idcar, "vNumberCar", vCarInfo[vehicleid][vNumberCar],16);
cache_get_value_name_int(idcar, "vTeh", vCarInfo[vehicleid][vTeh]);
cache_get_value_name_int(idcar, "vWheel", vCarInfo[vehicleid][vWheel]);
cache_get_value_name_int(idcar, "vPaintJob", vCarInfo[vehicleid][vPaintJob]);
cache_get_value_name_int(idcar, "vHood", vCarInfo[vehicleid][vHood]);
cache_get_value_name_int(idcar, "vRoof", vCarInfo[vehicleid][vRoof]);
cache_get_value_name_int(idcar, "vSideskirt", vCarInfo[vehicleid][vSideskirt]);
cache_get_value_name_int(idcar, "vLamps", vCarInfo[vehicleid][vLamps]);
cache_get_value_name_int(idcar, "vNitro", vCarInfo[vehicleid][vNitro]);
cache_get_value_name_int(idcar, "vExhaust", vCarInfo[vehicleid][vExhaust]);
cache_get_value_name_int(idcar, "vStereo", vCarInfo[vehicleid][vStereo]);
cache_get_value_name_int(idcar, "vHydraulics", vCarInfo[vehicleid][vHydraulics]);
cache_get_value_name_int(idcar, "vFrontbumper", vCarInfo[vehicleid][vFrontbumper]);
cache_get_value_name_int(idcar, "vRearbumper", vCarInfo[vehicleid][vRearbumper]);
cache_get_value_name_int(idcar, "vVentright", vCarInfo[vehicleid][vVentright]);
cache_get_value_name_int(idcar, "vVentleft", vCarInfo[vehicleid][vVentleft]);
cache_get_value_name_int(idcar, "vDate", vCarInfo[vehicleid][vDate]);
cache_get_value_name_int(idcar, "vAlarm", vCarInfo[vehicleid][vAlarm]);
////////////////////////////////////////////////////////////////////////
//
if(vCarInfo[vehicleid][vOwned] == 0)
{
AddStaticVehicleEx(vCarInfo[vehicleid][vModel],vCarInfo[vehicleid][vLocationX],vCarInfo[vehicleid][vLocationY],vCarInfo[vehicleid][vLocationZ]+1.0,vCarInfo[vehicleid][vAngle],vCarInfo[vehicleid][vColorOne],vCarInfo[vehicleid][vColorTwo],-1);
}
if(vCarInfo[vehicleid][vOwned] == 1)
{
AddStaticVehicleEx(vCarInfo[vehicleid][vModel],vCarInfo[vehicleid][vLocation_ParkX],vCarInfo[vehicleid][vLocation_ParkY],vCarInfo[vehicleid][vLocation_ParkZ]+1.0,vCarInfo[vehicleid][vAngle_ParkA],vCarInfo[vehicleid][vColorOne],vCarInfo[vehicleid][vColorTwo],-1);
}
vehicleid++;
TotalCarz++;
}
print("[MySql] Cars Loaded.");
return true;
}
Код:
for(new b = 0; b <= TotalCarz; b++)
{
if(vCarInfo[b][vOwned] == 1)
{
if(strcmp(sendername, vCarInfo[b][vOwner], true) != 0)
{
if(!EngineStatus(newcar))
{
if(Player[playerid][pAdmin] == 5){return 1;}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, ""servinfo"Car Engine Is On!");
}
}
}
if(vCarInfo[b][vOwned]==0)
{
new string[128];
TogglePlayerControllable(playerid, 0);
format(string, sizeof(string), "{ffffff}This Car Is For Sale\n\nVehicle:{34c924}%s\n\n{ffffff}Price:{ff7518}%d$",vCarInfo[b][vDescription],vCarInfo[b][vPrice]);
ShowPlayerDialog(playerid,702,DIALOG_STYLE_MSGBOX,"Car Is For Sale",string,"Buy","Close");
}
if(vCarInfo[b][vOwned]==1)
{
DateCar(playerid);
if(vCarInfo[b][vTeh] == 0) SCM(playerid,COLOR_RED,""servinfo"No Tech Inspected Car.");
}
}
Вложения
-
1 MB Просмотры: 14
-
1.3 MB Просмотры: 15
-
1.4 MB Просмотры: 13
-
104.8 KB Просмотры: 14
