HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <sourcemod>
  2.  
  3. #pragma semicolon 1
  4.  
  5. new Handle:AdminListEnabled = INVALID_HANDLE;
  6. new Handle:AdminListMode = INVALID_HANDLE;
  7. new Handle:AdminListMenu = INVALID_HANDLE;
  8.  
  9. public Plugin:myinfo =
  10. {
  11. name = "Admin List",
  12. author = "Fredd",
  13. description = "Megmutatja a jelenlevo adminokat a szerveren parancsra",
  14. version = "1.2",
  15. url = "www.sourcemod.net"
  16. }
  17.  
  18. public OnPluginStart()
  19. {
  20. CreateConVar("adminlist_version", "1.2", "Admin List Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
  21.  
  22. AdminListEnabled = CreateConVar("adminlist_on", "1", "1=be ,0=ki");
  23. AdminListMode = CreateConVar("adminlist_mode", "1", "1= chatbe 2=menube jeleniti meg");
  24.  
  25. RegConsoleCmd("say", SayHook);
  26. RegConsoleCmd("say_team", SayHook);
  27. }
  28. public Action:SayHook(client, args)
  29. {
  30. if(GetConVarInt(AdminListEnabled) == 1)
  31. {
  32. new String:text[192];
  33. GetCmdArgString(text, sizeof(text));
  34.  
  35. new startidx = 0;
  36. if (text[0] == '"')
  37. {
  38. startidx = 1;
  39.  
  40. new len = strlen(text);
  41. if (text[len-1] == '"')
  42. {
  43. text[len-1] = '\0';
  44. }
  45. }
  46.  
  47. if(StrEqual(text[startidx], "!admin") || StrEqual(text[startidx], "/admin"))
  48. {
  49. switch(GetConVarInt(AdminListMode))
  50. {
  51. case 1:
  52. {
  53. decl String:AdminNames[MAXPLAYERS+1][MAX_NAME_LENGTH+1];
  54. new count = 0;
  55. for(new i = 1 ; i <= GetMaxClients();i++)
  56. {
  57. if(IsClientInGame(i))
  58. {
  59. new AdminId:AdminID = GetUserAdmin(i);
  60. if(AdminID != INVALID_ADMIN_ID)
  61. {
  62. GetClientName(i, AdminNames[count], sizeof(AdminNames[]));
  63. count++;
  64. }
  65. }
  66. }
  67. decl String:buffer[1024];
  68. ImplodeStrings(AdminNames, count, ",", buffer, sizeof(buffer));
  69. PrintToChatAll("\x04Jelenlevo Adminok: %s", buffer);
  70. }
  71. case 2:
  72. {
  73. decl String:AdminName[MAX_NAME_LENGTH];
  74. AdminListMenu = CreateMenu(MenuListHandler);
  75. SetMenuTitle(AdminListMenu, "Jelenlevo Adminok:");
  76.  
  77. for(new i = 1; i <= GetMaxClients(); i++)
  78. {
  79. if(IsClientInGame(i))
  80. {
  81. new AdminId:AdminID = GetUserAdmin(i);
  82. if(AdminID != INVALID_ADMIN_ID)
  83. {
  84. GetClientName(i, AdminName, sizeof(AdminName));
  85. AddMenuItem(AdminListMenu, AdminName, AdminName);
  86. }
  87. }
  88. }
  89. SetMenuExitButton(AdminListMenu, true);
  90. DisplayMenu(AdminListMenu, client, 15);
  91. }
  92. }
  93. }
  94. }
  95. return Plugin_Continue;
  96. }
  97. public MenuListHandler(Handle:menu, MenuAction:action, param1, param2)
  98. {
  99. if (action == MenuAction_Select)
  100. {
  101. CloseHandle(menu);
  102. }
  103. else if (action == MenuAction_Cancel)
  104. {
  105. CloseHandle(menu);
  106. }
  107. else if (action == MenuAction_End)
  108. {
  109. CloseHandle(menu);
  110. }
  111. }