Advertisement
FlacoBey

Untitled

Feb 4th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.08 KB | None | 0 0
  1. new String:vote_target[32];
  2.  
  3. new bool:IsAllowVote[MAXPLAYERS+1] = false;
  4.  
  5. public OnMapStart()
  6. {
  7.     AddCommandListener(CommandListener);
  8. }
  9.  
  10. public Action:CommandListener(client, const String:command[], args)
  11. {
  12.     if (StrEqual(command, "callvote", false))
  13.     {
  14.         if(IsAllowVote[client] == false)
  15.         {
  16.             new String:arg1[16];
  17.             GetCmdArg(1, arg1, sizeof(arg1));
  18.             if (StrEqual(arg1, "Kick", false))
  19.             {
  20.                 GetCmdArg(2, vote_target, sizeof(vote_target));
  21.                 DisplayVoteKickMenu(client)
  22.                 return Plugin_Handled;
  23.             }
  24.         }
  25.         else if(IsAllowVote[client] == true)
  26.         {
  27.             return Plugin_Continue;
  28.         }
  29.     }
  30.     return Plugin_Continue;
  31. }
  32.  
  33. DisplayVoteKickMenu(client)
  34. {  
  35.     new Handle:menu = CreateMenu(MenuKick);
  36.     if(IsClientInGame(client) && !IsFakeClient(client))
  37.     {
  38.         SetMenuTitle(menu, "Выберите причину кика:");
  39.         AddMenuItem(menu, "0", "Нуб");
  40.         AddMenuItem(menu, "1", "Расист");
  41.         AddMenuItem(menu, "2", "Не адекват");
  42.         AddMenuItem(menu, "3", "Даун");
  43.         AddMenuItem(menu, "4", "Просто потому-что, я так хочу");
  44.         AddMenuItem(menu, "5", "Я его не знаю и знать не хочу.");
  45.         DisplayMenu(menu, client, MENU_TIME_FOREVER);
  46.     }
  47.     else
  48.     {
  49.         CloseHandle(menu);
  50.     }
  51. }
  52.  
  53. public MenuKick(Handle:menu, MenuAction:action, client, symbol)
  54. {
  55.     new target = GetClientOfUserId(StringToInt(vote_target));
  56.    
  57.     if (action == MenuAction_Select)
  58.     {
  59.         new String:szBuffer[18];
  60.         Format(vote_target, sizeof(target), "%N", target);
  61.         Format(szBuffer, sizeof(szBuffer), "%s", symbol);
  62.        
  63.         if(IsClientConnected(target))
  64.         {
  65.             IsAllowVote[client] = true;
  66.             FakeClientCommand(client,"callvote Kick %N",target);
  67.             PrintToChatAll("Началось голосование за кик игрока %N по причине: %s", target, szBuffer);
  68.             IsAllowVote[client] = false;
  69.         }      
  70.     }
  71.     else if (action == MenuAction_End)
  72.     {      
  73.         CloseHandle(menu);
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement