|
Сообщений: 24
Репутация: 0 [ +/- ]
|
|
#pragma semicolon 1
#include <sourcemod>
public Plugin:myinfo = { name = "BanV34", description = "", author = "Regent", version = "1.0", url = "http://all4css.ru/" };
new bool:g_bActivated; new bool:g_bBanned[65];
public OnPluginStart() { RegAdminCmd("sm_banv", Command_Banv, ADMFLAG_BAN); g_bActivated = true; }
public OnClientAuthorized(iClient, const String:auth[]) { QueryClientConVar(iClient, "xbox_throttlespoof", Query_Func); }
public Action:Command_Banv(iClient, szArgs) { Send_MainMenu(iClient); return Plugin_Handled; }
public Query_Func(QueryCookie:cookie, iClient, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[]) { if (StringToInt(cvarValue) == 46) { g_bBanned[iClient] = true; if (g_bActivated) { KickClient(iClient, "You are banned on this server"); } } else { g_bBanned[iClient] = false; } }
Send_MainMenu(iClient) { new Handle:hPanel = CreatePanel(); SetPanelTitle(hPanel, "[BanV34]\n \n", false); if (g_bActivated) { DrawPanelItem(hPanel, "Забанить игрока", 0); DrawPanelItem(hPanel, "Защита: включена\n \n", 2); DrawPanelItem(hPanel, "Выключить защиту\n \n", 0); DrawPanelItem(hPanel, "Выход", 0); } else { DrawPanelItem(hPanel, "Разбанить игрока", 0); DrawPanelItem(hPanel, "Защита: отключена\n \n", 2); DrawPanelItem(hPanel, "Включить защиту\n \n", 0); DrawPanelItem(hPanel, "Выход", 0); } SendPanelToClient(hPanel, iClient, Handle_MainMenu, 0); CloseHandle(hPanel); }
Send_PlayerMenu(iClient) { new Handle:hMenu = CreateMenu(Handle_PlayerMenu); if (g_bActivated) { SetMenuTitle(hMenu, "Забанить игрока:\n \n"); } else { SetMenuTitle(hMenu, "Разбанить игрока:\n \n"); } decl String:szName[64]; decl String:szClient[8]; for (new i = 1; i < MaxClients; i++) { if (IsClientConnected(i)) { QueryClientConVar(i, "xbox_throttlebias", Query_Func); if (g_bActivated && !g_bBanned[i]) { GetClientName(i, szName, 64); IntToString(i, szClient, 8); AddMenuItem(hMenu, szClient, szName, 0); } else if (!g_bActivated && g_bBanned[i]) { GetClientName(i, szName, 64); IntToString(i, szClient, 8); AddMenuItem(hMenu, szClient, szName, 0); } } } SetMenuExitButton(hMenu, true); DisplayMenu(hMenu, iClient, 0); }
public Handle_MainMenu(Handle:menu, MenuAction:action, iClient, iInfo) { if (action == MenuAction_Select) { if (iInfo == 1) { Send_PlayerMenu(iClient); } if (iInfo == 2) { g_bActivated = !g_bActivated; Send_MainMenu(iClient); } } }
public Handle_PlayerMenu(Handle:menu, MenuAction:action, iClient, iInfo) { if (action == MenuAction_End) { CloseHandle(menu); } else { if (action == MenuAction_Cancel) { Send_MainMenu(iClient); } if (action == MenuAction_Select) { decl String:szInfo[8]; GetMenuItem(menu, iInfo, szInfo, 8); new iTarget = StringToInt(szInfo, 10); if (!IsClientConnected(iTarget)) { PrintToChat(iClient, "\x04[Banv34:] \x03Player not in game"); } decl iRate; if (g_bActivated) { iRate = 46; } else { iRate = 1; } decl String:szCmd[128]; Format(szCmd, 128, "xbox_throttlebias %d; retry", iRate); new Handle:data = CreateKeyValues("data"); KvSetString(data, "type", "2"); KvSetString(data, "cmd", szCmd); ShowVGUIPanel(iTarget, "info", data, true); CloseHandle(data); } } }
|