Advertisement
porsamp

save

May 23rd, 2021
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.84 KB | None | 0 0
  1.  
  2.  
  3. public DCC_OnMessageCreate(DCC_Message:message)
  4. {
  5.     #if defined DISCORD
  6.     static
  7.         DCC_Channel:Channel,
  8.         discord[128],
  9.         params[64],
  10.         userid
  11.     ;
  12.  
  13.     DCC_GetMessageChannel(message, Channel);
  14.     DCC_GetMessageContent(message, discord,sizeof(discord));
  15.  
  16.     if(Channel == DCC_FindChannelById("833193280959152148"))  // ห้อง CMDBOT
  17.     {
  18.         if(strcmp(discord, "setgroup" , false, 8) == 0)
  19.         {
  20.             new amount;
  21.             if(sscanf(discord,"s[64]ud", params, userid, amount))
  22.                 return SendDCCMessage("833193280959152148","CMD: Setgroup [id] [group]");
  23.  
  24.             if(userid == INVALID_PLAYER_ID)
  25.                 return SendDCCMessage("833193280959152148","[Error] Player not online");
  26.  
  27.             RefreshOutPlayer(userid);
  28.             PlayerInfo[userid][pLeader] = amount;
  29.             PlayerInfo[userid][pMember] = amount;
  30.             PlayerInfo[userid][pRank] = GroupData[amount][gRanks];
  31.             PlayerInfo[userid][pSpawnPoint] = SPAWN_AT_FACTION;
  32.  
  33.             RefreshGroupTeem(userid, amount);
  34.             RefreshPushPlayer(userid);
  35.             SendClientMessageEx(userid, C_R2, "   %s ได้รับการแต่งตั้งให้เป็นหลีดเดอร์ %s *", ReturnName(userid), GroupData[amount][gName]);
  36.             SendDCCMessage("833193280959152148","Success !! User %s(%d) Change Leader are %d",ReturnName(userid),userid,amount);
  37.             SetPlayerToTeamColor(userid);
  38.             SpawnPlayer(userid);
  39.             return 1;
  40.         }
  41.  
  42.         else if(strcmp(discord, "givewall" , false, 8) == 0)
  43.         {
  44.             new amount;
  45.             if(sscanf(discord,"s[64]ud", params, userid, amount))
  46.                 return SendDCCMessage("833193280959152148","CMD: Givewall [id] [money]");
  47.  
  48.             if(userid == INVALID_PLAYER_ID)
  49.                 return SendDCCMessage("833193280959152148","[Error] Player not online");
  50.  
  51.             PlayerInfo[userid][pWallet] += amount;
  52.  
  53.             SendClientMessageEx(userid, C_R2, "  แอดมินได้ทำการเสกวอเล็ตให้ %s ผ่านทาง Discord จำนวน %d บาท*", ReturnName(userid), amount);
  54.             SendDCCMessage("833193280959152148","Success !! User %s(%d) Wallet for $%d",ReturnName(userid),userid,amount);
  55.             return 1;
  56.         }
  57.        
  58.         else if(strcmp(discord, "setwallet" , false, 9) == 0)
  59.         {
  60.             new name[30],amount, query[256];
  61.  
  62.             if(sscanf(discord,"s[64]s[30]d", params, name, amount))
  63.                 return SendDCCMessage("833193280959152148","CMD: setwallet [name] [money]");
  64.  
  65.             new sqlid = MySQLCheckAccount(name);
  66.  
  67.             if (sqlid == 0)
  68.                 return SendDCCMessage("833193280959152148","None User Name !");
  69.  
  70.             format(query, sizeof(query), "UPDATE players SET Wallet = Wallet + %d WHERE id = %d", amount, sqlid);
  71.             mysql_tquery(dbCon,query);
  72.  
  73.             SendAdminMessage(C_Y, "AdmWarning: Discord ได้เสกของ ' วอเล็ตออฟไลฟ์ ' จำนวน %d ให้กับ %s ", amount, name);
  74.             SendDCCMessage("833193280959152148","Success !! User %s(%d) Wallet OFF line $%d", SQL_ReturnName(sqlid),sqlid,amount);
  75.             return 1;
  76.         }
  77.  
  78.     }
  79.  
  80.     // ห้องบอทจัดการเซิฟเวอร์
  81.     if(Channel == DCC_FindChannelById("833192918851256360"))  
  82.     {
  83.         if(strcmp(discord, "ban" , false, 3) == 0)
  84.         {
  85.             new reason[128];
  86.  
  87.             if(sscanf(discord,"s[64]us[128]", params, userid, reason))
  88.                 return SendDCCMessage("833192918851256360","CMD: Ban [id] [reason]");
  89.  
  90.             if (userid == INVALID_PLAYER_ID || !IsPlayerConnected(userid))
  91.                 return SendDCCMessage("833192918851256360","[Error] Player not online");
  92.  
  93.             if (PlayerInfo[userid][pAdmin] > 1)
  94.                 return SendDCCMessage("833192918851256360","[Error] None Ban Admin");
  95.            
  96.             SendClientMessageToAllEx(COLOR_LIGHTRED, "AdmCmd: %s ถูกแบนโดย Discord สาเหตุ: %s", ReturnName(userid), reason);
  97.             SendDCCMessage("833192918851256360"," You Ban %s Success !!",ReturnName(userid));
  98.             Disconnect_Player("Discord", userid, "Banned");
  99.  
  100.             new insertLog[256];
  101.    
  102.             mysql_format(dbCon, insertLog, sizeof(insertLog), "INSERT INTO bannedlist (`CharacterDBID`, `CharacterName`, `Reason`, `Date`, `BannedBy`, `IpAddress`) VALUES(%i, '%e', '%e', '%e', '%e', '%e')",
  103.                 PlayerInfo[userid][pSQLID], ReturnName(userid), reason, ReturnDateTH(), "Discord", ReturnIP(userid));
  104.  
  105.             mysql_tquery(dbCon, insertLog);
  106.  
  107.             PlayerInfo[userid][pBanned] = 1;
  108.  
  109.             KickEx(userid);
  110.             return 1;
  111.         }
  112.        
  113.         else if(strcmp(discord, "kick" , false, 4) == 0)
  114.         {
  115.  
  116.             new reason[128];
  117.            
  118.             if(sscanf(discord,"s[64]us[128]", params, userid, reason))
  119.                 return SendDCCMessage("833192918851256360","CMD: Kick [id] [reason]");
  120.  
  121.             if (userid == INVALID_PLAYER_ID || !IsPlayerConnected(userid))
  122.                 return SendDCCMessage("833192918851256360","[Error] Player not online");
  123.  
  124.             KickPlayer("Discord", userid, reason);
  125.             return 1;
  126.         }
  127.         else if(strcmp(discord, "unban" , false, 5) == 0) {
  128.  
  129.             new name[25];
  130.  
  131.             if(sscanf(discord,"s[64]s[25]", params, name))
  132.                 return SendDCCMessage("833192918851256360","CMD : unban [nane]");
  133.            
  134.             new sqlid = MySQLCheckAccount(name);
  135.             if (sqlid == 0)
  136.                return SendDCCMessage("833192918851256360","None Name in Databas !");
  137.                
  138.             new insertLog[256];
  139.             mysql_format(dbCon, insertLog, sizeof(insertLog), "DELETE FROM `bannedlist` WHERE `CharacterName` = '%s'", name);  
  140.             mysql_tquery(dbCon, insertLog);
  141.  
  142.             MySQLUpdateSingleInt(sqlid, "Banned", 0);
  143.  
  144.             SendDCCMessage("833192918851256360","You UnBan %s Success !!",name);
  145.             return 1;
  146.         }
  147.  
  148.         else if(strcmp(discord, "ungroup" , false, 7) == 0) {
  149.  
  150.             new reason[128];
  151.  
  152.             if(sscanf(discord,"s[64]us[128]", params, userid, reason))
  153.                 return SendDCCMessage("833192918851256360","CMD : ungroup [id] [reason]");
  154.  
  155.             if (userid == INVALID_PLAYER_ID || !IsPlayerConnected(userid))
  156.                 return SendDCCMessage("833192918851256360","No Player !");
  157.            
  158.             if(PlayerInfo[userid][pLeader] >= 1)
  159.                 return SendDCCMessage("833192918851256360","No Un Leader !");
  160.  
  161.             if (PlayerInfo[userid][pMember] != -1)
  162.             {
  163.                 RefreshOutPlayer(userid);
  164.                 SendClientMessageToAllEx(COLOR_LIGHTBLUE, "แอดมิน : ได้เตะคุณ %s ออกจากกลุ่ม %s สาเหตุ %s",   ReturnName(userid), Group_GetName(userid),reason);
  165.                 PlayerInfo[userid][pTeam] = 0;
  166.                 PlayerInfo[userid][pMember] = -1;  
  167.                 PlayerInfo[userid][pLeader] = -1;
  168.                 PlayerInfo[userid][pRank] = 0;
  169.                 SpawnPlayer(userid);
  170.                 return 1;
  171.             }
  172.             else SendDCCMessage("833192918851256360","Player Group = -1");
  173.         }
  174.  
  175.         else if(strcmp(discord, "replayeronline" , false, 7) == 0)
  176.         {
  177.             DCC_SetChannelName(DCC_FindChannelById("831981400730239026"), sformat("Online : %d / %d",Iter_Count(Player), MAX_PLAYERS));
  178.         }
  179.        
  180.         else if(strcmp(discord, "resever" , false, 7) == 0)
  181.         {
  182.             SendDCCMessage("649180319437815808","#Attention from server. Server will reset in 3 minutes. !\n\
  183.            #Attention from server. Server will reset in 3 minutes. !\n\
  184.            #Attention from server. Server will reset in 3 minutes. !");
  185.             SendClientMessageToAll(C_O, "#แจ้งจากเซิฟเวอร์ เซิฟเวอร์จะทำการรีภายใน 3 นาที !");
  186.             SendClientMessageToAll(C_O, "#แจ้งจากเซิฟเวอร์ เซิฟเวอร์จะทำการรีภายใน 3 นาที !");
  187.             SendClientMessageToAll(C_O, "#แจ้งจากเซิฟเวอร์ เซิฟเวอร์จะทำการรีภายใน 3 นาที !");
  188.             SendClientMessageToAll(C_O, "#แจ้งจากเซิฟเวอร์ เซิฟเวอร์จะทำการรีภายใน 3 นาที !");
  189.             SendDCCMessage("833192918851256360","Success reset in 3 minutes. !");
  190.             return 1;
  191.         }
  192.     }
  193.     #endif
  194.     return 1;
  195. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement