Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- new bool:bBanEnabled;
- public OnPluginStart()
- AddCommandListener(OnSayCommand, "say");
- public Action:OnSayCommand(client, const String:command[], argc)
- if(GetUserAdmin(client) != INVALID_ADMIN_ID)
- {
- new String:sArg[128]
- GetCmdArg(1, sArg, sizeof(sArg));
- if(StrEqual(sArg, "vip", false))
- {
- new Handle:hMenu = CreateMenu(MenuHandler);
- AddMenuItem(hMenu, "k", "Vote Kick");
- AddMenuItem(hMenu, "b", "Vote Ban");
- AddMenuItem(hMenu, "m", "Vote Map");
- DisplayMenu(hMenu, client, 0);
- }
- }
- public MenuHandler(Handle:menu, MenuAction:action, param1, param2)
- {
- if(action == MenuAction_Select)
- {
- new String:sInfo[32];
- GetMenuItem(menu, param2, sInfo, sizeof(sInfo));
- PrintToChat(param1, "param2: %i sInfo: %s", param2, sInfo);
- new Handle:hMenu = CreateMenu(_MenuHandler);
- if(param2 < 3)
- {
- new String:sClient[64];
- for(new i = 1; i <= MaxClients; i++)
- if(IsClientInGame(i))
- {
- GetClientName(i, sClient, sizeof(sClient));
- AddMenuItem(hMenu, sClient, sClient);
- }
- if(param2 == 1)
- bBanEnabled = false;
- else
- bBanEnabled = true;
- }
- else
- {
- new String:buffer[PLATFORM_MAX_PATH];
- BuildPath(Path_SM, buffer, sizeof(buffer), "mapcycle.txt");
- new Handle:hFile = OpenFile(buffer, "r");
- if(hFile == INVALID_HANDLE)
- return;
- while(!IsEndOfFile(hFile) && ReadFileLine(hFile, buffer, sizeof(buffer)))
- {
- TrimString(buffer);
- AddMenuItem(hMenu, buffer, buffer);
- }
- }
- DisplayMenu(hMenu, param1, 0);
- }
- if(action == MenuAction_End)
- CloseHandle(menu);
- }
- public _MenuHandler(Handle:menu, MenuAction:action, param1, param2)
- {
- if(action == MenuAction_Select)
- {
- new String:sInfo[32];
- GetMenuItem(menu, param2, sInfo, sizeof(sInfo));
- if(IsMapValid(sInfo))
- ServerCommand("sm_votemap %s", sInfo);
- else
- {
- if(!bBanEnabled)
- ServerCommand("sm_votekick %s", sInfo);
- else
- ServerCommand("sm_voteban %s", sInfo);
- }
- }
- if(action == MenuAction_End)
- CloseHandle(menu);
- }
Add Comment
Please, Sign In to add comment