Advertisement
Guest User

Simple Connector by stevanovic

a guest
Sep 27th, 2021
1,103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.76 KB | None | 0 0
  1. #if defined Credits
  2. ================================================================================
  3. --------------------------- SIMPLE DISCORD CONNECTOR ---------------------------
  4.  
  5.   SSSSSSS TTTTTTT EEEEEEE VV   VV  AAAAA  NNN  NN OOOOOOO VV   VV III CCCCCCC
  6.   SSSSSSS TTTTTTT EEEEEEE VV   VV AAAAAAA NNNN NN OO   OO VV   VV III CC   CC
  7.   SS        TTT   EE      VV   VV AA   AA NNNN NN OO   OO VV   VV III CC
  8.   SSSSSSS   TTT   EEEEEEE VV   VV AAAAAAA NNNN NN OO   OO VV   VV III CC
  9.   SSSSSSS   TTT   EEEEEEE VV   VV AAAAAAA NN NNNN OO   OO VV   VV III CC
  10.        SS   TTT   EE       VV VV  AA   AA NN  NNN OO   OO  VV VV  III CC
  11.   SSSSSSS   TTT   EEEEEEE  VV VV  AA   AA NN   NN OOOOOOO  VV VV  III CC   CC
  12.   SSSSSSS   TTT   EEEEEEE   VVV   AA   AA NN   NN OOOOOOO   VVV   III CCCCCCC
  13.  
  14. ====                       by: Stevanovic   v0.0.1x                         ====
  15.     ========================================================================
  16. #endif
  17. //*****************************[ INCLUDES ]***********************************//
  18. #include <a_samp>
  19. #include <discord-connector>
  20. //*******************************[ NEW ]**************************************//
  21. new DCC_Channel:g_Discord_Chat;
  22. new DCC_Channel:g_Discord_Chat2;
  23. //****************************************************************************//
  24. public OnFilterScriptInit()
  25. {
  26.     print("     by Stevanovic V0.0.1x    ");
  27.     g_Discord_Chat = DCC_FindChannelById("000000000000000"); // ID Discord kanala
  28.     g_Discord_Chat2 = DCC_FindChannelById("000000000000000"); // ID Discord kanala
  29.     return 1;
  30. }
  31. //****************************************************************************//
  32. forward DCC_OnMessageCreate(DCC_Message:message);//Prikazuje poruke InGame ukoliko pise neko u  text kanalu gde je bot povezan!
  33. public DCC_OnMessageCreate(DCC_Message:message)
  34. {
  35.     new realMsg[100];
  36.     DCC_GetMessageContent(message, realMsg, 100);
  37.     new bool:IsBot;
  38.     new DCC_Channel:channel;
  39.     DCC_GetMessageChannel(message, channel);
  40.     new DCC_User:author;
  41.     DCC_GetMessageAuthor(message, author);
  42.     DCC_IsUserBot(author, IsBot);
  43.     if(channel == g_Discord_Chat && !IsBot) //Sakriva poruke koje bot salje!
  44.     {
  45.         new user_name[32 + 1], str[152];
  46.         DCC_GetUserName(author, user_name, 32);
  47.         format(str,sizeof(str), "{3bd717}Clan: %s {ffffff}%s", realMsg);
  48.         SendClientMessageToAll(-1, str);
  49.     }
  50.     return 1;
  51. }
  52. //****************************************************************************//
  53. public OnPlayerClickPlayer(playerid)//Kad otvori Tab i klikne na igraca!
  54. {
  55.     new name[MAX_PLAYER_NAME + 1];
  56.     GetPlayerName(playerid, name, sizeof name);
  57.     if (_:g_Discord_Chat == 0)
  58.     g_Discord_Chat = DCC_FindChannelById("000000000000000"); // ID Discord kanala
  59.     new string[128];
  60.     format(string, sizeof string, " ```%s gleda statistiku od nekog igraca [TAB]```", name);
  61.     DCC_SendChannelMessage(g_Discord_Chat, string);
  62.     return 1;
  63. }
  64. //****************************************************************************//
  65. public OnPlayerSpawn(playerid)//Kada neko udje na server i bude spawnan!
  66. {
  67.     new name[MAX_PLAYER_NAME + 1];
  68.     GetPlayerName(playerid, name, sizeof name);
  69.     if (_:g_Discord_Chat == 0)
  70.     g_Discord_Chat = DCC_FindChannelById("000000000000000"); // ID Discord kanala
  71.     new string[128];
  72.     format(string, sizeof string, " ```%s je upesno spawnovan [SPAWN]```", name);
  73.     DCC_SendChannelMessage(g_Discord_Chat, string);
  74.     return 1;
  75. }
  76. //****************************************************************************//
  77. public OnPlayerCommandText(playerid, cmdtext[])//Kada neko na serveru ukuca ovaj CMD bot salje poruku u odredjen kanal!
  78. {
  79.     if(!strcmp(cmdtext, "/ipservera", true))
  80.     {
  81.         new string[128],
  82.         string2[128];
  83.         if (_:g_Discord_Chat2 == 0)
  84.         g_Discord_Chat2 = DCC_FindChannelById("000000000000000"); // ID Discord kanala
  85.         format(string, sizeof string, " ```VAS TEXT```");
  86.         format(string2, sizeof(string2), " ```VAS TEXT```");
  87.         DCC_SendChannelMessage(g_Discord_Chat2, string, string2);
  88.         return 1;
  89.     }
  90.     return 0;
  91. }
  92. //****************************************************************************//
  93. public OnPlayerDeath(playerid)//Kada neko umre na serveru!
  94. {
  95.     new name[MAX_PLAYER_NAME + 1];
  96.     GetPlayerName(playerid, name, sizeof name);
  97.     if (_:g_Discord_Chat == 0)
  98.     g_Discord_Chat = DCC_FindChannelById("000000000000000"); // ID Discord kanala
  99.     new string[128];
  100.     format(string, sizeof string, " ```%s je upravo ubijen [DEATH]```", name);
  101.     DCC_SendChannelMessage(g_Discord_Chat, string);
  102.     return 1;
  103. }
  104. //****************************************************************************//
  105. public OnPlayerConnect(playerid)//Kada se igrac disconnectuje sa servera!
  106. {
  107.     new name[MAX_PLAYER_NAME + 1];
  108.     GetPlayerName(playerid, name, sizeof name);
  109.     if (_:g_Discord_Chat == 0)
  110.     g_Discord_Chat = DCC_FindChannelById("000000000000000"); // ID Discord kanala
  111.     new string[128];
  112.     format(string, sizeof string, " ```%s je uspesno usao na server [CONNECT]```", name);
  113.     DCC_SendChannelMessage(g_Discord_Chat, string);
  114.     return 1;
  115. }
  116. //****************************************************************************//
  117. public OnPlayerDisconnect(playerid, reason)//Kada se igrac disconnectuje sa servera!
  118. {
  119.     new name[MAX_PLAYER_NAME + 1];
  120.     GetPlayerName(playerid, name, sizeof name);
  121.     if (_:g_Discord_Chat == 0)
  122.     g_Discord_Chat = DCC_FindChannelById("000000000000000"); // ID Discord kanala
  123.     new string[128];
  124.     format(string, sizeof string, " ```%s je uspesno izasao sa servera [DISCONNECT]```", name);
  125.     DCC_SendChannelMessage(g_Discord_Chat, string);
  126.     return 1;
  127. }
  128. //****************************************************************************//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement