1
0

motds.pwn 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Dynamic MOTD System
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. CMD:motd(playerid, params[])
  34. {
  35. if(PlayerInfo[playerid][pAdmin] >= 1337)
  36. {
  37. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /motd [message]");
  38. new string[128];
  39. format(string, sizeof(string), "AdmCmd: %s has changed the global motd to: %s.", GetPlayerNameEx(playerid), params);
  40. ABroadCast( COLOR_LIGHTRED, string, 4);
  41. format(GlobalMOTD, sizeof(GlobalMOTD), "%s", params);
  42. SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted the Global MOTD.");
  43. g_mysql_SaveMOTD();
  44. }
  45. return 1;
  46. }
  47. CMD:amotd(playerid, params[])
  48. {
  49. if(PlayerInfo[playerid][pAdmin] >= 1337)
  50. {
  51. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /amotd [message]");
  52. new string[128];
  53. format(AdminMOTD, sizeof(AdminMOTD), "%s", params);
  54. format(string, sizeof(string), "AdmCmd: %s has changed the admin motd to: %s.", GetPlayerNameEx(playerid), params);
  55. ABroadCast( COLOR_LIGHTRED, string, 4);
  56. SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted the Admin MOTD.");
  57. g_mysql_SaveMOTD();
  58. //IRC_SetChannelTopic(BotID[0], IRC_CHANNEL_ADMIN, AdminMOTD);
  59. }
  60. return 1;
  61. }
  62. CMD:vipmotd(playerid, params[])
  63. {
  64. if(PlayerInfo[playerid][pAdmin] >= 1337)
  65. {
  66. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /vipmotd [message]");
  67. new string[128];
  68. format(VIPMOTD, sizeof(VIPMOTD), "%s", params);
  69. format(string, sizeof(string), "AdmCmd: %s has changed the VIP motd to: %s.", GetPlayerNameEx(playerid), params);
  70. ABroadCast( COLOR_LIGHTRED, string, 4);
  71. SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted the VIP MOTD.");
  72. g_mysql_SaveMOTD();
  73. }
  74. return 1;
  75. }
  76. CMD:advisormotd(playerid, params[])
  77. {
  78. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pHelper] >= 4 || PlayerInfo[playerid][pPR] > 0)
  79. {
  80. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /advisormotd [message]");
  81. new string[128];
  82. format(CAMOTD, sizeof(CAMOTD), "%s", params);
  83. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pPR] > 0)
  84. {
  85. format(string, sizeof(string), "AdmCmd: %s has changed the Advisor motd to: %s.", GetPlayerNameEx(playerid), params);
  86. ABroadCast( COLOR_LIGHTRED, string, 4);
  87. }
  88. else if(PlayerInfo[playerid][pHelper] >= 4)
  89. {
  90. format(string, sizeof(string), "CACmd: %s has changed the Advisor motd to: %s.", GetPlayerNameEx(playerid), params);
  91. CBroadCast( COLOR_YELLOW, string, 2);
  92. }
  93. SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted the Advisor MOTD.");
  94. g_mysql_SaveMOTD();
  95. }
  96. return 1;
  97. }
  98. CMD:pmotd(playerid, params[])
  99. {
  100. if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pShopTech] >= 3 || PlayerInfo[playerid][pPR] >= 2)
  101. {
  102. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /pmotd [message/off]");
  103. new string[128];
  104. if(strcmp(params, "off", true) == 0)
  105. {
  106. format(pMOTD, sizeof(pMOTD), "");
  107. format(string, sizeof(string), "AdmCmd: %s has turned off the Global MOTD", GetPlayerNameEx(playerid));
  108. ABroadCast( COLOR_LIGHTRED, string, 4);
  109. SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted the pMOTD.");
  110. g_mysql_SaveMOTD();
  111. return 1;
  112. }
  113. format(pMOTD, sizeof(pMOTD), "%s", params);
  114. format(string, sizeof(string), "AdmCmd: %s has changed the global motd to: %s.", GetPlayerNameEx(playerid), params);
  115. ABroadCast( COLOR_LIGHTRED, string, 4);
  116. SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted the pMOTD.");
  117. g_mysql_SaveMOTD();
  118. }
  119. return 1;
  120. }
  121. CMD:gmotd(playerid, params[])
  122. {
  123. new
  124. iGroupID = PlayerInfo[playerid][pLeader],
  125. string[128],
  126. iSlot;
  127. if (0 <= iGroupID < MAX_GROUPS) {
  128. if(sscanf(params, "ds[128]", iSlot, string)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /gmotd [motd slot] [message]");
  129. if(strlen(string) > 128) return SendClientMessageEx( playerid, COLOR_GRAD1, "That MOTD is too long, please refrain from using more than 128 characters." );
  130. if (1 <= iSlot <= 3) {
  131. strmid(gMOTD[iGroupID][iSlot-1], string, 0, strlen(string), 128);
  132. SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted the group MOTD.");
  133. SaveGroup(iGroupID);
  134. format(string,sizeof(string),"%s (%d) has changed MOTD for %s to: %s in slot %i", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), gMOTD[iGroupID][iSlot-1], string, iSlot);
  135. GroupLog(iGroupID, string);
  136. } else SendClientMessageEx(playerid, COLOR_GREY, "Invalid slot specified.");
  137. } else SendClientMessageEx(playerid, COLOR_GREY, "Only group leaders may use this command.");
  138. return 1;
  139. }
  140. CMD:prisonermotd(playerid, params[])
  141. {
  142. new
  143. iGroupID = PlayerInfo[playerid][pLeader],
  144. string[128],
  145. iSlot;
  146. if(!IsADocGuard(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You must be a DOC Guard to use this command.");
  147. if (0 <= iGroupID < MAX_GROUPS) {
  148. if(sscanf(params, "ds[128]", iSlot, string)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /prisonermotd [motd slot] [message]");
  149. if(strlen(string) > 128) return SendClientMessageEx( playerid, COLOR_GRAD1, "That MOTD is too long, please refrain from using more than 128 characters." );
  150. if (1 <= iSlot <= 3) {
  151. strmid(prisonerMOTD[iSlot-1], string, 0, strlen(string), 128);
  152. SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted the prisoner MOTD.");
  153. g_mysql_SaveMOTD();
  154. format(string,sizeof(string),"%s (%d) has changed the prisoner MOTD to: %s in slot %i", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), string, iSlot);
  155. GroupLog(iGroupID, string);
  156. } else SendClientMessageEx(playerid, COLOR_GREY, "Invalid slot specified.");
  157. } else SendClientMessageEx(playerid, COLOR_GREY, "Only group leaders may use this command.");
  158. return 1;
  159. }
  160. CMD:viewmotd(playerid, params[])
  161. {
  162. new string[128], option[16];
  163. if(sscanf(params, "s[16]", option))
  164. {
  165. SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /viewmotd [option]");
  166. strcat(string, "Available Options: global, player");
  167. if(PlayerInfo[playerid][pDonateRank] >= 1) strcat(string, ", vip");
  168. if(PlayerInfo[playerid][pMember] != INVALID_GROUP_ID) strcat(string, ", group");
  169. if(PlayerInfo[playerid][pHelper] >= 1) strcat(string, ", advisor");
  170. if(PlayerInfo[playerid][pAdmin] > 1) strcat(string, ", admin");
  171. if(strfind(PlayerInfo[playerid][pPrisonReason], "[IC]", true) != -1 || IsADocGuard(playerid)) strcat(string, ", prisoner");
  172. return SendClientMessageEx(playerid, COLOR_WHITE, string);
  173. }
  174. if(strcmp(option, "global", true) == 0) return SendClientMessageEx(playerid, COLOR_YELLOW, GlobalMOTD);
  175. if(strcmp(option, "player", true) == 0) return SendClientMessageEx(playerid, COLOR_YELLOW, pMOTD);
  176. if(strcmp(option, "vip", true) == 0 && PlayerInfo[playerid][pDonateRank] >= 1) return SendClientMessageEx(playerid, COLOR_VIP, VIPMOTD);
  177. if(strcmp(option, "group", true) == 0 && PlayerInfo[playerid][pMember] != INVALID_GROUP_ID)
  178. {
  179. for(new i = 0; i < 3; i++)
  180. {
  181. SendClientMessageEx(playerid, arrGroupData[PlayerInfo[playerid][pMember]][g_hDutyColour] * 256 + 255, gMOTD[PlayerInfo[playerid][pMember]][i]);
  182. }
  183. }
  184. if(strcmp(option, "advisor", true) == 0 && PlayerInfo[playerid][pHelper] >= 1) return SendClientMessageEx(playerid, TEAM_AZTECAS_COLOR, CAMOTD);
  185. if(strcmp(option, "admin", true) == 0 && PlayerInfo[playerid][pAdmin] > 1) return SendClientMessageEx(playerid, COLOR_YELLOW, AdminMOTD);
  186. if(strcmp(option, "prisoner", true) == 0 && strfind(PlayerInfo[playerid][pPrisonReason], "[IC]", true) != -1 || strcmp(option, "prisoner", true) == 0 && IsADocGuard(playerid))
  187. {
  188. for(new i = 0; i < 3; i++)
  189. {
  190. SendClientMessageEx(playerid, COLOR_ORANGE, prisonerMOTD[i]);
  191. }
  192. }
  193. return 1;
  194. }