newspaper.inc 6.8 KB

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