1
0

newspaper.inc 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. stock HasPermission(playerid)
  2. {
  3. if(PlayerInfo[playerid][pMember] == 9 && PlayerInfo[playerid][pRank] > 2) return 1;
  4. return 0;
  5. }
  6. enum Newspaper
  7. {
  8. Line1[255],
  9. Line2[255],
  10. Line3[255],
  11. Line4[255],
  12. Line5[255],
  13. NewsPublish,
  14. }
  15. new NewsInfo[Newspaper];
  16. CMD:editnews(playerid, params[])
  17. {
  18. new give[5], text[255];
  19. new string1[255];
  20. if(!HasPermission(playerid)) return AdmErrorMsg;
  21. if(NewsInfo[NewsPublish] != 0) return SendClientMessage(playerid, COLOR_GREY, "There's already one newspaper released, wait an hour to release one more.");
  22. if(sscanf(params, "s[5]s[255]", give, text)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage: {ffffff}/editnews [1 - 5] [TEXT]");
  23. if(!strcmp(give, "1", true))
  24. {
  25. NewsInfo[Line1] = text;
  26. format(string1, sizeof(string1), "* %s reaches for their pen and begins writing an article.", PlayerICName(playerid));
  27. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  28. }
  29. else if(!strcmp(give, "2", true))
  30. {
  31. NewsInfo[Line2] = text;
  32. format(string1, sizeof(string1), "* %s reaches for their pen and begins writing an article.", PlayerICName(playerid));
  33. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  34. }
  35. else if(!strcmp(give, "3", true))
  36. {
  37. NewsInfo[Line3] = text;
  38. format(string1, sizeof(string1), "* %s reaches for their pen and begins writing an article.", PlayerICName(playerid));
  39. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  40. }
  41. else if(!strcmp(give, "4", true))
  42. {
  43. NewsInfo[Line4] = text;
  44. format(string1, sizeof(string1), "* %s reaches for their pen and begins writing an article.", PlayerICName(playerid));
  45. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  46. }
  47. else if(!strcmp(give, "5", true))
  48. {
  49. NewsInfo[Line5] = text;
  50. format(string1, sizeof(string1), "* %s reaches for their pen and begins writing an article.", PlayerICName(playerid));
  51. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  52. }
  53. return 1;
  54. }
  55. CMD:viewnews(playerid, params[])
  56. {
  57. new dialogstring[1000];
  58. new string1[255];
  59. if(NewsInfo[NewsPublish] != 1) return SendClientMessage(playerid, COLOR_GREY, "Error: Newspaper is not published yet.");
  60. format(dialogstring, sizeof(dialogstring), " {00BFFF}NEWS{ffffff}: %s\n\n\n {00BFFF}NEWS{ffffff}: %s\n\n\n {00BFFF}NEWS{ffffff}: %s\n\n\n {00BFFF}NEWS{ffffff}: %s\n\n\n {00BFFF}NEWS{ffffff}: %s", NewsInfo[Line1],
  61. NewsInfo[Line2],
  62. NewsInfo[Line3],
  63. NewsInfo[Line4],
  64. NewsInfo[Line5]);
  65. ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "{ffffff}NEWSPAPER", dialogstring, "OK", "");
  66. format(string1, sizeof(string1), "* %s reaches for their phone and begins checking the latest news on it.", PlayerICName(playerid));
  67. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  68. return 1;
  69. }
  70. CMD:publishnews(playerid, params[])
  71. {
  72. if(!HasPermission(playerid)) return AdmErrorMsg;
  73. SendClientMessageToAll(-1, "Daily Newspaper has been published {808040}(/viewnews){ffffff} to check it!");
  74. NewsInfo[NewsPublish] = 1;
  75. return 1;
  76. }
  77. CMD:clearnews(playerid, params[])
  78. {
  79. new string1[255];
  80. if(PlayerInfo[playerid][pAdmin] > 1)
  81. {
  82. format(string1, sizeof(string1), " ");
  83. NewsInfo[Line1] = string1;
  84. NewsInfo[Line2] = string1;
  85. NewsInfo[Line3] = string1;
  86. NewsInfo[Line4] = string1;
  87. NewsInfo[Line5] = string1;
  88. NewsInfo[NewsPublish] = 0;
  89. SendClientMessage(playerid, COLOR_GREY, "SANews newspaper was cleared!");
  90. }
  91. return 1;
  92. }
  93. CMD:editnote(playerid, params[])
  94. {
  95. new give[5];
  96. new string[255];
  97. new string1[255];
  98. if(sscanf(params, "s[5]s[255]", give, string)) return SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage: {ffffff}/editnote [1 - 5] [NOTE]");
  99. if(!strcmp(give, "1", true))
  100. {
  101. PlayerInfo[playerid][pNote1] = string;
  102. SendClientMessage(playerid, COLOR_GREY, "You've edited notepad page(1).");
  103. format(string1, sizeof(string1), "* %s pulls out their notepad and writes something on it.", PlayerICName(playerid));
  104. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  105. }
  106. else if(!strcmp(give, "2", true))
  107. {
  108. PlayerInfo[playerid][pNote2] = string;
  109. SendClientMessage(playerid, COLOR_GREY, "You've edited notepad page(2).");
  110. format(string1, sizeof(string1), "* %s pulls out their notepad and writes something on it.", PlayerICName(playerid));
  111. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  112. }
  113. else if(!strcmp(give, "3", true))
  114. {
  115. PlayerInfo[playerid][pNote3] = string;
  116. SendClientMessage(playerid, COLOR_GREY, "You've edited notepad page(3).");
  117. format(string1, sizeof(string1), "* %s pulls out their notepad and writes something on it.", PlayerICName(playerid));
  118. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  119. }
  120. else if(!strcmp(give, "4", true))
  121. {
  122. PlayerInfo[playerid][pNote4] = string;
  123. SendClientMessage(playerid, COLOR_GREY, "You've edited notepad page(4).");
  124. format(string1, sizeof(string1), "* %s pulls out their notepad and writes something on it.", PlayerICName(playerid));
  125. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  126. }
  127. else if(!strcmp(give, "5", true))
  128. {
  129. PlayerInfo[playerid][pNote5] = string;
  130. SendClientMessage(playerid, COLOR_GREY, "You've edited notepad page(5).");
  131. format(string1, sizeof(string1), "* %s pulls out their notepad and writes something on it.", PlayerICName(playerid));
  132. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  133. }
  134. return 1;
  135. }
  136. CMD:notes(playerid, params[])
  137. {
  138. new dialogstring[1000];
  139. new string1[255];
  140. format(dialogstring, sizeof(dialogstring), "{ffffff} Page 1: %s\n\n Page 2: %s\n\n Page 3: %s\n\n Page 4: %s\n\n Page 5: %s", PlayerInfo[playerid][pNote1],
  141. PlayerInfo[playerid][pNote2],
  142. PlayerInfo[playerid][pNote3],
  143. PlayerInfo[playerid][pNote4],
  144. PlayerInfo[playerid][pNote5]);
  145. ShowPlayerDialog(playerid, 75, DIALOG_STYLE_MSGBOX, "{ffffff}~~~~~~~~~~Notepad~~~~~~~~~", dialogstring, "OK", "");
  146. format(string1, sizeof(string1), "* %s pulls out their notepad and begins to read it.", PlayerICName(playerid));
  147. ProxDetector(30.0, playerid, string1, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  148. return 1;
  149. }