if(strcmp(cmd, "/del", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp))return SendClientMessage(playerid, COLOR_WHITE, "* Использование: /del [ID Дома]"); new File ini_openFile("houses/houses.ini");//откроет файл если он сущ-ет, иначе вернет код ошибки if (File >= 0) // если файл создан { new str[128]; new string[256]; // создаем небольшой массив для дальнейшего форматирования строки (ключа в файле) for(new h=1;h<=m_h;h++) // запускаем цикл { format(str,sizeof(str),"ID %d",h); // форматируем строку для ключа в файле //ini_getString(f,str,string); // получаем данные в виде строки ini_removeKey(File,str); ini_closeFile(File); format(string,sizeof(string),"Дом с идом:%d удален.",str); SendClientMessage(h, COLOR_DBLUE, string); return true; } }
format(str,sizeof(str),"ID %d",h); // форматируем строку для ключа в файле ini_getString(f,str,string); // получаем данные в виде строки sscanf(string,"p<|>s[128]s[128]fffiiiiiiiiiiiiiiiiii", HouseInfo[h][hDesc], HouseInfo[h][hOwned], HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], HouseInfo[h][hInt], HouseInfo[h][hVirt], HouseInfo[h][hValue], HouseInfo[h][hLock], HouseInfo[h][hHealthx], HouseInfo[h][hHealthy], HouseInfo[h][hHealthz], HouseInfo[h][hArmourx], HouseInfo[h][hArmoury], HouseInfo[h][hArmourz], HouseInfo[h][hHel], HouseInfo[h][hArm], HouseInfo[h][hRooms], HouseInfo[h][hRent], HouseInfo[h][hRentabil], HouseInfo[h][hTakings], HouseInfo[h][hDate], HouseInfo[h][hLevel]); |
if(strcmp(cmd, "/del", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "* Использование: /del [id дома]"); return true; } m_h = strval(tmp); for(new h=1;h<=m_h;h++) // запускаем цикл { new f = ini_openFile("houses/houses.ini"); // открываем файл new str[128]; format(str,sizeof(str),"ID %d",h); // форматируем строку для ключа в файле ini_getString(f,str,string); // получаем данные в виде строки sscanf(string,"p<|>s[128]s[128]fffiiiiiiiiiiiiiiiiii", HouseInfo[m_h][hDesc],//1 HouseInfo[m_h][hOwned],//2 HouseInfo[m_h][hEntrancex],//3 HouseInfo[m_h][hEntrancey],//4 HouseInfo[m_h][hEntrancez],//5 HouseInfo[m_h][hInt],//6 HouseInfo[m_h][hVirt],//7 HouseInfo[m_h][hValue],//8 HouseInfo[m_h][hLock],//9 HouseInfo[m_h][hHealthx],//10 HouseInfo[m_h][hHealthy],//11 HouseInfo[m_h][hHealthz],//12 HouseInfo[m_h][hArmourx],//13 HouseInfo[m_h][hArmoury],//14 HouseInfo[m_h][hArmourz],//15 HouseInfo[m_h][hHel],//16 HouseInfo[m_h][hArm],//17 HouseInfo[m_h][hRooms],//18 HouseInfo[m_h][hRent],//19 HouseInfo[m_h][hRentabil],//20 HouseInfo[m_h][hTakings],//21 HouseInfo[m_h][hDate],//22 HouseInfo[m_h][hLevel]);//23 ini_removeKey(f,string); // удаляем данные format(string,sizeof(string),"Дом ID %d удален.",m_h); SendClientMessage(playerid, -1, string); ini_closeFile(f); return true; } } |