Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- new Handle:AdminListMode = INVALID_HANDLE;
- new Handle:AdminListMenu = INVALID_HANDLE;
- public Plugin:myinfo =
- {
- name = "Admin List",
- author = "Fredd",
- version = "1.2",
- }
- public OnPluginStart()
- {
- AdminListMode = CreateConVar("adminlist_mode", "2" );
- RegConsoleCmd("say", SayHook);
- RegConsoleCmd("say_team", SayHook);
- }
- public Action:SayHook(client, args)
- {
- {
- new String:text[192];
- GetCmdArgString(text, sizeof(text));
- new startidx = 0;
- if (text[0] == '"')
- {
- startidx = 1;
- new len = strlen(text);
- if (text[len-1] == '"')
- {
- text[len-1] = '\0';
- }
- }
- if(StrEqual(text[startidx], "!admins") || StrEqual(text[startidx], "!фвьшты"))
- {
- switch(GetConVarInt(AdminListMode))
- {
- case 1:
- {
- new Adminkek:AdminID = GetUserAdmin(client);
- if(AdminID != INVALID_ADMIN_ID)
- {
- decl String:AdminNames[MAXPLAYERS+1][MAX_NAME_LENGTH+1];
- new count = 0;
- for(new i = 1 ; i <= GetMaxClients();i++)
- {
- if(IsClientInGame(i))
- {
- new AdminId:AdminID = GetUserAdmin(i);
- if(AdminID != INVALID_ADMIN_ID)
- {
- GetClientName(i, AdminNames[count], sizeof(AdminNames[]));
- count++;
- }
- }
- }
- decl String:buffer[1024];
- ImplodeStrings(AdminNames, count, ",", buffer, sizeof(buffer));
- PrintToChatAll("\x03Админ(ы) Онлайн:\x05%s", buffer);
- }
- }
- case 2:
- {
- new AdminId:AdminID = GetUserAdmin(client);
- if(AdminID != INVALID_ADMIN_ID)
- decl String:AdminName[MAX_NAME_LENGTH];
- AdminListMenu = CreateMenu(MenuListHandler);
- SetMenuTitle(AdminListMenu, "Админ(ы) Онлайн:");
- for(new i = 1; i <= GetMaxClients(); i++)
- {
- if(IsClientInGame(i))
- {
- new AdminId:AdminID = GetUserAdmin(i);
- if(AdminID != INVALID_ADMIN_ID)
- {
- GetClientName(i, AdminName, sizeof(AdminName));
- AddMenuItem(AdminListMenu, AdminName, AdminName);
- }
- }
- }
- SetMenuExitButton(AdminListMenu, true);
- DisplayMenu(AdminListMenu, client, 15);
- }
- }
- }
- }
- }
- return Plugin_Continue;
- }
- public MenuListHandler(Handle:menu, MenuAction:action, param1, param2)
- {
- if (action == MenuAction_End)
- CloseHandle(menu);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement