Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. #include <sourcemod>
  2.  
  3. public Plugin:myinfo = {
  4. name = "Admins Online",
  5. author = "tre3fla",
  6. description = "Arata adminii online",
  7. version = "1.0",
  8. url = "http://"
  9. }
  10.  
  11. public OnPluginStart( ) {
  12. RegConsoleCmd( "admins", Command_ShowAdminsOnline )
  13. }
  14.  
  15. public Action: Command_ShowAdminsOnline( client, args ) {
  16. new Handle:AdminsOnline = CreateMenu( AdminsOnline_Handler )
  17. SetMenuTitle( AdminsOnline, "Admin Name | Admin Group" )
  18.  
  19. for( new index = 1; index < MaxClients; index++ ) {
  20. if( IsClientInGame( index ) ) {
  21. new AdminId: ClientAccess = GetUserAdmin( index )
  22.  
  23. if( ClientAccess ) {
  24. new AdminGroupsCount = GetAdminGroupCount( ClientAccess )
  25.  
  26. for( new x = 0; x < AdminGroupsCount; x++ ) {
  27. decl String:GroupBuffer[ 32 ]
  28.  
  29. if( ( GetAdminGroup( ClientAccess, x, GroupBuffer, sizeof( GroupBuffer ) ) != INVALID_GROUP_ID ) ) {
  30. decl String: AdminNameAndGroup[ 64 ]
  31. Format( AdminNameAndGroup, sizeof( AdminNameAndGroup ), "%N | %s", index, GroupBuffer )
  32.  
  33. AddMenuItem( AdminsOnline, "selected", AdminNameAndGroup, ITEMDRAW_DISABLED )
  34. }
  35. }
  36. }
  37. }
  38. }
  39.  
  40. SetMenuExitButton( AdminsOnline, true )
  41. DisplayMenu( AdminsOnline, client, 60 )
  42. }
  43.  
  44. public AdminsOnline_Handler( Handle:AdminsOnline, MenuAction:action, pos, neg ) {
  45. switch( action ) {
  46. case MenuAction_Select: {
  47. decl String: Info[ 32 ]
  48. GetMenuItem( AdminsOnline, neg, Info, sizeof( Info ) )
  49.  
  50. if( StrEqual( Info, "selected" ) ) {
  51. if( AdminsOnline != INVALID_HANDLE ) {
  52. CancelMenu( AdminsOnline )
  53. }
  54. }
  55. }
  56.  
  57. case MenuAction_End: {
  58. if( AdminsOnline != INVALID_HANDLE ) {
  59. CancelMenu( AdminsOnline )
  60. }
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement