Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.47 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #define DEBUG
  4.  
  5. #define PLUGIN_AUTHOR "Mily"
  6. #define PLUGIN_VERSION "1.00"
  7.  
  8. #include <sourcemod>
  9. #include <sdktools>
  10. #include <multicolors>
  11.  
  12. #pragma newdecls required
  13.  
  14. #define DS_FLAG         ADMFLAG_CUSTOM6
  15. #define TYPE_NULL       0
  16. #define TYPE_KICK       1
  17. #define TYPE_BAN        2
  18. #define NULL_PLAYER     -2
  19.  
  20. bool voteInProgress = false;
  21. int voteTypeInProgress = TYPE_NULL;
  22. int selectedPlayer = NULL_PLAYER;
  23.  
  24. public Plugin myinfo =
  25. {
  26.     name = "DS - Vote Kick/Ban",
  27.     author = PLUGIN_AUTHOR,
  28.     description = "VoteKick/VoteBan for Dedicated Supporters",
  29.     version = PLUGIN_VERSION,
  30.     url = "http://www.edge-gamers.com"
  31. };
  32.  
  33. public void OnPluginStart()
  34. {
  35.     RegConsoleCmd("sm_votekick", Command_VoteKick, "Initiate a vote to kick a player.");
  36.     RegConsoleCmd("sm_voteban", Command_VoteBan, "Initiate a vote to ban a player for 30 minutes.");
  37. }
  38.  
  39. public Action Command_VoteKick(int client, any args)
  40. {
  41.     if (voteInProgress)
  42.     {
  43.         CPrintToChat(client, "{red}A vote is already in effect!");
  44.         return Plugin_Handled;
  45.     }
  46.     if (!CheckCommandAccess(client, "sm_wtfisthisarealcommandlmao", DS_FLAG))
  47.     {
  48.         CPrintToChat(client, "{red}You must be a Dedicated Supporter to use this command!");
  49.         return Plugin_Handled;
  50.     }
  51.    
  52.     voteInProgress = true;
  53.     voteTypeInProgress = TYPE_KICK;
  54.     CreatePlayerMenu(client);
  55.    
  56.     return Plugin_Handled;
  57. }
  58.  
  59. public Action Command_VoteBan(int client, any args)
  60. {
  61.     CreatePlayerMenu(client);
  62. }
  63.  
  64. public Action CreatePlayerMenu(int client)
  65. {
  66.     if(!client) return Plugin_Handled;
  67.    
  68.     int playerCount = GetClientCount(true);
  69.     char clientName[50];
  70.  
  71.     Menu menu = new Menu(Hndler_PlayerMenu);
  72.     menu.SetTitle("Select a Player:\n ");
  73.  
  74.     for (int i = 0; i < playerCount; i++)
  75.     {
  76.         if(IsClientConnected(i) && IsClientInGame(i))
  77.         {
  78.             GetClientName(i, clientName, sizeof(clientName));
  79.             AddMenuItem(menu, clientName, clientName);
  80.         }
  81.     }
  82.        
  83.     menu.ExitButton = true;
  84.     menu.Display(client, MENU_TIME_FOREVER);    
  85.    
  86.    
  87.  
  88.     return Plugin_Handled;
  89. }
  90.  
  91. public int Hndler_PlayerMenu( Menu menu, MenuAction action, int client, int index )
  92. {
  93.     if(action == MenuAction_Select)
  94.     {
  95.         selectedPlayer = index;
  96.         HandleSelection();
  97.     }    
  98.     else if(action == MenuAction_End)
  99.     {
  100.         delete menu;
  101.     }
  102.     return 0;
  103. }
  104.  
  105. public void HandleSelection()
  106. {
  107.     if(selectedPlayer != NULL_PLAYER && voteInProgress)
  108.     {
  109.         if(voteTypeInProgress == TYPE_KICK)
  110.         {
  111.            
  112.         }
  113.         if(voteTypeInProgress == TYPE_BAN)
  114.         {
  115.            
  116.         }
  117.     }
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement