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