Docavo
Новичок
PHP:
publics: LoadProperty()
{
new i=cache_get_row_count(connects);
if(!i) return printf("Дома не загружены.");
new string[256];
new time = GetTickCount();
for(new he; he < cache_get_row_count(connects); he++)
{
HouseInfo[he][hID] = cache_get_field_content_int(he, "hID", connects);
HouseInfo[he][hEnter][0] = cache_get_field_content_float(he, "hEntrancex", connects);
HouseInfo[he][hEnter][1] = cache_get_field_content_float(he, "hEntrancey", connects);
HouseInfo[he][hEnter][2] = cache_get_field_content_float(he, "hEntrancez", connects);
HouseInfo[he][hExit][0] = cache_get_field_content_float(he, "hExitx", connects);
HouseInfo[he][hExit][1] = cache_get_field_content_float(he, "hExity", connects);
HouseInfo[he][hExit][2] = cache_get_field_content_float(he, "hExitz", connects);
cache_get_field_content(he, "hOwner", HouseInfo[he][hOwner], connects, strlen(HouseInfo[he][hOwner]));
HouseInfo[he][hValue] = cache_get_field_content_int(he, "hValue", connects);
HouseInfo[he][hHel] = cache_get_field_content_int(he, "hHel", connects);
HouseInfo[he][hInt] = cache_get_field_content_int(he, "hInt", connects);
HouseInfo[he][hLock] = cache_get_field_content_int(he, "hLock", connects);
HouseInfo[he][hOwned] = cache_get_field_content_int(he, "hOwned", connects);
HouseInfo[he][hTakings] = cache_get_field_content_int(he, "hTakings", connects);
HouseInfo[he][hKlass] = cache_get_field_content_int(he, "hKlass", connects);
HouseInfo[he][hVehSost] = cache_get_field_content_int(he, "hVehSost", connects);
HouseInfo[he][hCar][0] = cache_get_field_content_float(he, "hCarx", connects);
HouseInfo[he][hCar][1] = cache_get_field_content_float(he, "hCary", connects);
HouseInfo[he][hCar][2] = cache_get_field_content_float(he, "hCarz", connects);
HouseInfo[he][hCar][3] = cache_get_field_content_float(he, "hCarc", connects);
HouseInfo[he][hStyle] = cache_get_field_content_int(he, "hStyle", connects);
HouseInfo[he][hSafe] = cache_get_field_content_int(he, "hSafe", connects);
HouseInfo[he][hNarko] = cache_get_field_content_int(he, "hNarko", connects);
HouseInfo[he][hGun][0] = cache_get_field_content_int(he, "hGun1", connects);
HouseInfo[he][hGun][1] = cache_get_field_content_int(he, "hGun2", connects);
HouseInfo[he][hGun][2] = cache_get_field_content_int(he, "hGun3", connects);
HouseInfo[he][hGun][3] = cache_get_field_content_int(he, "hGun4", connects);
HouseInfo[he][hGun][4] = cache_get_field_content_int(he, "hGun5", connects);
HouseInfo[he][hGunAmmo][0] = cache_get_field_content_int(he, "hGunAmmo1", connects);
HouseInfo[he][hGunAmmo][1] = cache_get_field_content_int(he, "hGunAmmo2", connects);
HouseInfo[he][hGunAmmo][2] = cache_get_field_content_int(he, "hGunAmmo3", connects);
HouseInfo[he][hGunAmmo][3] = cache_get_field_content_int(he, "hGunAmmo4", connects);
HouseInfo[he][hGunAmmo][4] = cache_get_field_content_int(he, "hGunAmmo5", connects);
HouseInfo[he][hGarage] = cache_get_field_content_int(he, "hGarage", connects);
HouseInfo[he][CarDrived][0] = cache_get_field_content_float(he, "CarDrivedCar1", connects);
HouseInfo[he][CarDrived][1] = cache_get_field_content_float(he, "CarDrivedCar2", connects);
HouseInfo[he][CarDrived][2] = cache_get_field_content_float(he, "CarDrivedCar3", connects);
switch(HouseInfo[he][hKlass])
{
case 0: HouseInfo[he][hValue] = House_Fare_Class[0];
case 1: HouseInfo[he][hValue] = House_Fare_Class[1];
case 2: HouseInfo[he][hValue] = House_Fare_Class[2];
case 3: HouseInfo[he][hValue] = House_Fare_Class[3];
case 4: HouseInfo[he][hValue] = House_Fare_Class[4];
case 5: HouseInfo[he][hValue] = House_Fare_Class[5];
}
HouseInfo[he][LabelText][0] = CreateDynamic3DTextLabel("Выход из дома\nКлавиша: {0075FF}''ALT''", -1,HouseInfo[he][hExit][0],HouseInfo[he][hExit][1],HouseInfo[he][hExit][2],9.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,HouseInfo[he][hInt],he+50);
format(string,215,"Номер дома: {0075FF}%d{FFFFFF}\nГосударственная цена: {0075FF}%i${FFFFFF}\nДом: {0075FF}%s{FFFFFF}\nПодробная информация: {0075FF}''F''",HouseInfo[he][hID],HouseInfo[he][hValue],(HouseInfo[he][hOwned]?("Занят"):("Свободен")));
HouseInfo[he][LabelText][1] = CreateDynamic3DTextLabel(string,-1,HouseInfo[he][hEnter][0],HouseInfo[he][hEnter][1],HouseInfo[he][hEnter][2],9.0,INVALID_PLAYER_ID, INVALID_VEHICLE_ID);
if(HouseInfo[he][hGarage]) CreateDynamic3DTextLabel("Чтобы выйти из гаража нажмите 'ALT'", -1, 1769.0474,-1897.8124,498.5519+0.8,9.0,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, he+50), CreateDynamic3DTextLabel("Чтобы покинуть гараж\nПосигнальте 'H'", COLOR_BLUE, 1791.6519,-1903.4984,498.5519+0.8,9.0,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, he+50);
if(!HouseInfo[he][hOwned])
{
HouseInfo[he][hPickup] = CreateDynamicPickup(1273, 23, HouseInfo[he][hEnter][0], HouseInfo[he][hEnter][1], HouseInfo[he][hEnter][2],-1);
HouseInfo[he][hMIcon] = CreateDynamicMapIcon(HouseInfo[he][hEnter][0], HouseInfo[he][hEnter][1], HouseInfo[he][hEnter][2], 31, COLOR_WHITE, 0, -1, -1, 200.0);
}
if(HouseInfo[he][hOwned])
{
HouseInfo[he][hPickup] = CreateDynamicPickup(19522, 23, HouseInfo[he][hEnter][0], HouseInfo[he][hEnter][1], HouseInfo[he][hEnter][2],-1);
HouseInfo[he][hMIcon] = CreateDynamicMapIcon(HouseInfo[he][hEnter][0], HouseInfo[he][hEnter][1], HouseInfo[he][hEnter][2], 32, COLOR_WHITE, 0, -1, -1, 200.0);
}
}
printf("[Загрузкa]: LoadProperty | Загружено %d | Time: %d (ms)",i, GetTickCount() - time);
return 1;
}
PHP:
stock SaveHouse(houseid)
{
new string[1100];
mysql_format(connects,string, 1100,
"UPDATE `house` SET `hOwner`='%s',`hValue`='%d',`hHel`='%d',`hLock`='%d',`hOwned`='%d',`hKlass`='%d',`hVehSost`='%d',`hStyle`='%d',`hSafe` = '%d', `hNarko` = '%d',`hGun1` = '%d',`hGun2` = '%d',`hGun3` = '%d',`hGun4` = '%d',`hGun5` = '%d',`hGunAmmo1` = '%d',`hGunAmmo2` = '%d',`hGunAmmo3` = '%d',`hGunAmmo4` = '%d',`hGunAmmo5` = '%d',`hGarage` = '%d' WHERE `hID` = '%d'",
HouseInfo[houseid][hOwner],HouseInfo[houseid][hValue],HouseInfo[houseid][hHel],HouseInfo[houseid][hLock],HouseInfo[houseid][hOwned],HouseInfo[houseid][hKlass],HouseInfo[houseid][hVehSost],HouseInfo[houseid][hStyle],HouseInfo[houseid][hSafe],HouseInfo[houseid][hNarko],
HouseInfo[houseid][hGun][0],HouseInfo[houseid][hGun][1],HouseInfo[houseid][hGun][2],HouseInfo[houseid][hGun][3],HouseInfo[houseid][hGun][4],HouseInfo[houseid][hGunAmmo][0],HouseInfo[houseid][hGunAmmo][1],HouseInfo[houseid][hGunAmmo][2],HouseInfo[houseid][hGunAmmo][3],HouseInfo[houseid][hGunAmmo][4],HouseInfo[houseid][hGarage],houseid);
mysql_empty(connects, string);
return 1;
}
