Advertisement
Guest User

Untitled

a guest
May 11th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. ReplaceCellNum(oldph, newph)
  2. {
  3. new File: file2 = fopen("tmpNumberList.cfg", io_write);
  4. print("1");
  5. new number;
  6. new string[512];
  7. new PHList[256];
  8. format(string, sizeof(string), "%d\r\n", newph);
  9. print("2");
  10. fwrite(file2, string);
  11. print("3");
  12. fclose(file2);
  13. print("4");
  14. file2 = fopen("tmpNumberList.cfg", io_append);
  15. print("5");
  16. new File: file = fopen("NumberList.cfg", io_read);
  17. print("6");
  18. while(fread(file, string))
  19. {
  20. print("6.1");
  21. strmid(PHList, string, 0, strlen(string)-1, 255);
  22. print("7");
  23. number = strval(PHList);
  24. print("8");
  25. if (number != oldph)
  26. {
  27. format(string, sizeof(string), "%d\r\n", number);
  28. print("9");
  29. fwrite(file2, string);
  30. print("10");
  31. }
  32. }
  33. print("11");
  34. fclose(file);
  35. print("12");
  36. fclose(file2);
  37. print("13");
  38. file2 = fopen("NumberList.cfg", io_write);
  39. print("14");
  40. file = fopen("tmpNumberList.cfg", io_read);
  41. print("15");
  42. while(fread(file, string))
  43. {
  44. print("16");
  45. strmid(PHList, string, 0, strlen(string)-1, 255);
  46. print("17");
  47. number = strval(PHList);
  48. print("18");
  49. if (number != oldph)
  50. {
  51. print("19");
  52. format(string, sizeof(string), "%d\r\n", number);
  53. print("20");
  54. fwrite(file2, string);
  55. print("21");
  56. }
  57. }
  58. print("22");
  59. fclose(file);
  60. print("23");
  61. fclose(file2);
  62. print("24");
  63. fremove("tmpNumberList.cfg");
  64. print("25");
  65. printf("ph %d replaced with ph %d in NumberList.cfg", oldph, newph);
  66. return 1;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement