Advertisement
Guest User

Untitled

a guest
Jun 5th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.37 KB | None | 0 0
  1. #include <sourcemod>
  2.  
  3. new Handle:AdminListMode = INVALID_HANDLE;
  4. new Handle:AdminListMenu = INVALID_HANDLE;
  5.  
  6. public Plugin:myinfo =
  7. {
  8.     name = "Admin List",
  9.     author = "Fredd",
  10.     version = "1.2",
  11. }
  12.  
  13. public OnPluginStart()
  14. {
  15.     AdminListMode           = CreateConVar("adminlist_mode", "2" );
  16.    
  17.     RegConsoleCmd("say", SayHook);
  18.     RegConsoleCmd("say_team", SayHook);
  19. }
  20. public Action:SayHook(client, args)
  21. {
  22.     {  
  23.         new String:text[192];
  24.         GetCmdArgString(text, sizeof(text));
  25.        
  26.         new startidx = 0;
  27.         if (text[0] == '"')
  28.         {
  29.             startidx = 1;
  30.            
  31.             new len = strlen(text);
  32.             if (text[len-1] == '"')
  33.             {
  34.                 text[len-1] = '\0';
  35.             }
  36.         }
  37.        
  38.         if(StrEqual(text[startidx], "!admins") || StrEqual(text[startidx], "!фвьшты"))
  39.         {
  40.             switch(GetConVarInt(AdminListMode))
  41.             {
  42.                 case 1:
  43.                 {
  44.                     new Adminkek:AdminID = GetUserAdmin(client);
  45.                     if(AdminID != INVALID_ADMIN_ID)
  46.                     {
  47.                         decl String:AdminNames[MAXPLAYERS+1][MAX_NAME_LENGTH+1];
  48.                         new count = 0;
  49.                         for(new i = 1 ; i <= GetMaxClients();i++)
  50.                         {
  51.                             if(IsClientInGame(i))
  52.                             {
  53.                                 new AdminId:AdminID = GetUserAdmin(i);
  54.                                 if(AdminID != INVALID_ADMIN_ID)
  55.                                 {
  56.                                     GetClientName(i, AdminNames[count], sizeof(AdminNames[]));
  57.                                     count++;
  58.                                 }
  59.                             }
  60.                         }
  61.                         decl String:buffer[1024];
  62.                         ImplodeStrings(AdminNames, count, ",", buffer, sizeof(buffer));
  63.                         PrintToChatAll("\x03Админ(ы) Онлайн:\x05%s", buffer);
  64.                     }
  65.                 }
  66.                 case 2:
  67.                 {
  68.                     new AdminId:AdminID = GetUserAdmin(client);
  69.                     if(AdminID != INVALID_ADMIN_ID)
  70.                         decl String:AdminName[MAX_NAME_LENGTH];
  71.                         AdminListMenu = CreateMenu(MenuListHandler);
  72.                         SetMenuTitle(AdminListMenu, "Админ(ы) Онлайн:");
  73.                                        
  74.                         for(new i = 1; i <= GetMaxClients(); i++)
  75.                         {
  76.                             if(IsClientInGame(i))
  77.                             {
  78.                                 new AdminId:AdminID = GetUserAdmin(i);
  79.                                 if(AdminID != INVALID_ADMIN_ID)
  80.                                 {
  81.                                     GetClientName(i, AdminName, sizeof(AdminName));
  82.                                     AddMenuItem(AdminListMenu, AdminName, AdminName);
  83.                                 }
  84.                             }
  85.                         }
  86.                         SetMenuExitButton(AdminListMenu, true);
  87.                         DisplayMenu(AdminListMenu, client, 15);
  88.                     }
  89.                 }
  90.             }
  91.         }
  92.     }
  93.     return Plugin_Continue;
  94. }
  95. public MenuListHandler(Handle:menu, MenuAction:action, param1, param2)
  96. {
  97.     if (action == MenuAction_End)
  98.     CloseHandle(menu);
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement