Felar.Exe
Компетентный
Вот у меня сохранение -
Сам паблик -
Паблик загрузки
Почему ничего не сохраняет? ключи пишет = 0.
Код:
if(!strcmp(cmd,"/test1",true))
{
SaveCars(CarInfo[GetPlayerVehicleID(playerid)][cID]);
}
Код:
stock SaveCars(idx)
{
format(CarInfo[idx][cComponents],72,"%i, %i, %i, %i, %i ,%i ,%i ,%i ,%i ,%i ,%i ,%i ,%i ,%i",CarInfo[idx][cComponent][0],CarInfo[idx][cComponent][1],CarInfo[idx][cComponent][2],CarInfo[idx][cComponent][3],CarInfo[idx][cComponent][4],CarInfo[idx][cComponent][5],
CarInfo[idx][cComponent][6],CarInfo[idx][cComponent][7],CarInfo[idx][cComponent][8],CarInfo[idx][cComponent][9],CarInfo[idx][cComponent][10],CarInfo[idx][cComponent][11],CarInfo[idx][cComponent][12],CarInfo[idx][cComponent][13]);
new temp[600];
mysql_format(mysql, mysql_string, sizeof(mysql_string), "UPDATE `cars` SET ");
format(temp,sizeof(temp),"`Component`='%s'",CarInfo[idx][cComponents]); strcat(mysql_string,temp,sizeof(mysql_string));
format(temp,sizeof(temp)," WHERE id = '%i'",CarInfo[idx][ids]); strcat(mysql_string,temp,sizeof(mysql_string));
mysql_function_query(mysql, mysql_string, true, "", "");
printf(" КЛЮЧИ %i", CarInfo[idx][ids]);
}
Код:
publics: LoadCar()
{
new rows,fields;
cache_get_data(rows,fields);
if(rows < 1) return 1;
for(new idx; idx < rows; idx++)
{
CarInfo[idx+1][ids] = cache_get_field_content_int(idx, "id");
cache_get_field_content(idx, "owner", CarInfo[idx+1][cOwner], mysql, 24);
CarInfo[idx+1][cModel] = cache_get_field_content_int(idx, "model");
CarInfo[idx+1][cFuel] = cache_get_field_content_int(idx, "fuel");
cache_get_field_content(idx, "colors", CarInfo[idx+1][cColors], mysql, 24);
CarInfo[idx+1][cLock] = cache_get_field_content_int(idx, "clock");
CarInfo[idx+1][cX] = cache_get_field_content_float(idx, "x");
CarInfo[idx+1][cY] = cache_get_field_content_float(idx, "y");
CarInfo[idx+1][cZ] = cache_get_field_content_float(idx, "z");
CarInfo[idx+1][cFa] = cache_get_field_content_float(idx, "fa");
cache_get_field_content(idx, "Component",CarInfo[idx+1][cComponents],mysql,72);
sscanf(CarInfo[idx+1][cComponents], "p<,>a<i>[16]",CarInfo[idx+1][cComponent]);
sscanf(CarInfo[idx+1][cColors], "p<,>a<i>[2]",CarInfo[idx+1][cColor]);
CarInfo[idx+1][cID] = CreateVehicle(CarInfo[idx+1][cModel], CarInfo[idx+1][cX], CarInfo[idx+1][cY], CarInfo[idx+1][cZ], CarInfo[idx+1][cFa], CarInfo[idx+1][cColor][0], CarInfo[idx+1][cColor][1], 90000);
if(CarInfo[idx+1][cID] == 65535) continue;
format(strin, sizeof(strin), "{ff4f00}Âëàäåëåö: {ffffff}%s\n{ff4f00}ID: {ffffff}%d", CarInfo[idx+1][cOwner], CarInfo[idx+1][cID]);
CarInfo[idx+1][cText] = Create3DTextLabel(strin, 0x33AAFFFF, 0.0, 0.0, 0.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(CarInfo[idx+1][cText], CarInfo[idx+1][cID], 0.0, 0.0, 1.25);
switch(CarInfo[idx+1][cLock])
{
case 0: IsLocked[CarInfo[idx+1][cID]] = false;
case 1: IsLocked[CarInfo[idx+1][cID]] = true;
}
CarDoors(CarInfo[idx+1][cID], CarInfo[idx+1][cLock]);
// ChangeVehicleColor(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][15], CarInfo[idx+1][cComponent][16]);
if(CarInfo[idx+1][cComponent][0] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][0]);
if(CarInfo[idx+1][cComponent][1] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][1]);
if(CarInfo[idx+1][cComponent][2] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][2]);
if(CarInfo[idx+1][cComponent][3] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][3]);
if(CarInfo[idx+1][cComponent][4] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][4]);
if(CarInfo[idx+1][cComponent][5] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][5]);
if(CarInfo[idx+1][cComponent][6] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][6]);
if(CarInfo[idx+1][cComponent][7] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][7]);
if(CarInfo[idx+1][cComponent][8] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][8]);
if(CarInfo[idx+1][cComponent][9] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][9]);
if(CarInfo[idx+1][cComponent][10] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][10]);
if(CarInfo[idx+1][cComponent][11] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][11]);
if(CarInfo[idx+1][cComponent][12] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][12]);
if(CarInfo[idx+1][cComponent][13] !=0) AddVehicleComponent(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][13]);
if(CarInfo[idx+1][cComponent][14] !=0) ChangeVehiclePaintjob(CarInfo[idx+1][cID], CarInfo[idx+1][cComponent][14]);
TOTALCARS++;
printf(" ÒÞÍÈÍÃ %d ",CarInfo[idx+1][cComponent][0]);
}
return true;
}
