discord.pwn 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. //--------------------------------[DISCORD.PWN]--------------------------------
  11. * Copyright (c) 2016, Next Generation Gaming, LLC
  12. *
  13. * All rights reserved.
  14. *
  15. * Redistribution and use in source and binary forms, with or without modification,
  16. * are not permitted in any case.
  17. *
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  23. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  24. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  25. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  26. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  27. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  28. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  29. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. //--------------------------------[ INITIATE/EXIT ]---------------------------
  32. hook OnGameModeInit()
  33. {
  34. DCC_Connect("MjUxODAwMTY4OTM5MjU3ODU2.C8Lhhg.PMIaZpEXgUE48jH9oDwLHYK_f7Y");
  35. print("[DCC] Connecting to Discord...");
  36. return 1;
  37. }
  38. stock SendDiscordMessage(channel, message[])
  39. {
  40. if(betaserver == 0) {
  41. switch(channel)
  42. {
  43. // #admin
  44. case 0:
  45. {
  46. g_AdminChannelId = DCC_FindChannelById("251802213913985024");
  47. DCC_SendChannelMessage(g_AdminChannelId, message);
  48. }
  49. // #admin-warnings
  50. case 1:
  51. {
  52. g_AdminWarningsChannelId = DCC_FindChannelById("252214716544450560");
  53. DCC_SendChannelMessage(g_AdminWarningsChannelId, message);
  54. }
  55. // #headadmin
  56. case 2:
  57. {
  58. g_HeadAdminChannelId = DCC_FindChannelById("251802276677681162");
  59. DCC_SendChannelMessage(g_HeadAdminChannelId, message);
  60. }
  61. // #server-errors
  62. case 3:
  63. {
  64. g_ServerErrorsChannelId = DCC_FindChannelById("252214813818617866");
  65. DCC_SendChannelMessage(g_ServerErrorsChannelId, message);
  66. }
  67. }
  68. } else {
  69. switch(channel)
  70. {
  71. // #server-errors
  72. case 3:
  73. {
  74. g_ServerErrorsChannelId = DCC_FindChannelById("252214813818617866");
  75. DCC_SendChannelMessage(g_ServerErrorsChannelId, message);
  76. }
  77. default: {}
  78. }
  79. }
  80. return 1;
  81. }
  82. public DCC_OnChannelMessage(DCC_Channel:channel, const author[], const message[])
  83. {
  84. if(betaserver == 0) {
  85. new channel_name[32], szMessage[128];
  86. DCC_GetChannelName(channel, channel_name);
  87. printf("[DCC] OnChannelMessage (Channel %s): Author %s sent message: %s", channel_name, author, message);
  88. if(!strcmp(channel_name, "admin", true) && strcmp(author, "SAMP-Bot", true))
  89. {
  90. format(szMessage, sizeof(szMessage), "* [Discord] Administrator %s: %s", author, message);
  91. ABroadCast(COLOR_YELLOW, szMessage, 2, true, true);
  92. }
  93. else if(!strcmp(channel_name, "headadmin", true) && strcmp(author, "SAMP-Bot", true))
  94. {
  95. format(szMessage, sizeof(szMessage), "(PRIVATE) [Discord] Administrator %s: %s", author, message);
  96. ABroadCast(COLOR_GREEN, szMessage, 1337, true, true);
  97. }
  98. }
  99. return 1;
  100. }