Ребят взялся периводить огромный код плагина [L4D & L4D2] Custom Player Stats v1.4B121 и понакосячил с переводом вернее не смог корректно его адаптировать,помогите корректно перевести вот этот кусок кода
Скрытый текст
// Load our categories and menus
public OnAdminMenuReady(Handle:TopMenu)
{
// Block us from being called twice
if (TopMenu == RankAdminMenu)
return;
RankAdminMenu = TopMenu;
// Add a category to the SourceMod menu called "Player Stats"
AddToTopMenu(RankAdminMenu, "Player Stats", TopMenuObject_Category, ClearRankCategoryHandler, INVALID_TOPMENUOBJECT);
// Get a handle for the catagory we just added so we can add items to it
new TopMenuObject:statscommands = FindTopMenuCategory(RankAdminMenu, "Player Stats");
// Don't attempt to add items to the catagory if for some reason the catagory doesn't exist
if (statscommands == INVALID_TOPMENUOBJECT)
return;
// The order that items are added to menus has no relation to the order that they appear. Items are sorted alphabetically automatically
// Assign the menus to global values so we can easily check what a menu is when it is chosen
MenuClearPlayers = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearplayers", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearplayers", ADMFLAG_ROOT);
MenuClearMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearallmaps", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearallmaps", ADMFLAG_ROOT);
MenuClearAll = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearall", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearall", ADMFLAG_ROOT);
MenuClearTimedMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_cleartimedmaps", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_cleartimedmaps", ADMFLAG_ROOT);
MenuRemoveCustomMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_removecustom", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_removecustom", ADMFLAG_ROOT);
MenuCleanPlayers = AddToTopMenu(RankAdminMenu, "sm_rank_admin_removeplayers", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_removeplayers", ADMFLAG_ROOT);
MenuClear = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clear", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clear", ADMFLAG_ROOT);
}
public OnLibraryRemoved(const String:name[])
{
if (StrEqual(name, "adminmenu"))
RankAdminMenu = INVALID_HANDLE;
}
// This handles the top level "Player Stats" category and how it is displayed on the core admin menu
public ClearRankCategoryHandler(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, client, String:buffer[], maxlength)
{
if (action == TopMenuAction_DisplayOption)
Format(buffer, maxlength, "Player Stats");
else if (action == TopMenuAction_DisplayTitle)
Format(buffer, maxlength, "Player Stats:");
}
public Action:Menu_CreateClearMenu(client, args)
{
new Handle:menu = CreateMenu(Menu_CreateClearMenuHandler);
SetMenuTitle(menu, "Clear:");
SetMenuExitBackButton(menu, true);
SetMenuExitButton(menu, true);
AddMenuItem(menu, "cps", "Clear stats from currently playing player...");
AddMenuItem(menu, "ctm", "Clear timed maps...");
DisplayMenu(menu, client, 30);
return Plugin_Handled;
}
public Menu_CreateClearMenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
switch (param2)
{
case 0:
{
DisplayClearPanel(param1);
}
case 1:
{
Menu_CreateClearTMMenu(param1, 0);
}
}
}
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && RankAdminMenu != INVALID_HANDLE)
DisplayTopMenu(RankAdminMenu, param1, TopMenuPosition_LastCategory);
}
}
}
public Action:Menu_CreateClearTMMenu(client, args)
{
new Handle:menu = CreateMenu(Menu_CreateClearTMMenuHandler);
SetMenuTitle(menu, "Clear Timed Maps:");
SetMenuExitBackButton(menu, true);
SetMenuExitButton(menu, true);
AddMenuItem(menu, "ctma", "All");
AddMenuItem(menu, "ctmc", "Coop");
AddMenuItem(menu, "ctmsu", "Survival");
AddMenuItem(menu, "ctmr", "Realism");
AddMenuItem(menu, "ctmm", "Mutations");
DisplayMenu(menu, client, 30);
return Plugin_Handled;
}
public Menu_CreateClearTMMenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
switch (param2)
{
case 0:
{
DisplayYesNoPanel(param1, "Do you really want to clear all map timings?", ClearTMAllPanelHandler);
}
case 1:
{
DisplayYesNoPanel(param1, "Do you really want to clear all Coop map timings?", ClearTMCoopPanelHandler);
}
case 2:
{
DisplayYesNoPanel(param1, "Do you really want to clear all Survival map timings?", ClearTMSurvivalPanelHandler);
}
case 3:
{
DisplayYesNoPanel(param1, "Do you really want to clear all Realism map timings?", ClearTMRealismPanelHandler);
}
case 4:
{
DisplayYesNoPanel(param1, "Do you really want to clear all Mutations map timings?", ClearTMMutationsPanelHandler);
}
}
}
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && RankAdminMenu != INVALID_HANDLE)
{
DisplayTopMenu(RankAdminMenu, param1, TopMenuPosition_LastCategory);
}
}
}
}
// This deals with what happens someone opens the "Player Stats" category from the menu
public ClearRankTopItemHandler(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, client, String:buffer[], maxlength)
{
// When an item is displayed to a player tell the menu to format the item
if (action == TopMenuAction_DisplayOption)
{
if (object_id == MenuClearPlayers)
{
Format(buffer, maxlength, "Clear players");
}
else if (object_id == MenuClearMaps)
{
Format(buffer, maxlength, "Clear maps");
}
else if (object_id == MenuClearAll)
{
Format(buffer, maxlength, "Clear all");
}
else if (object_id == MenuClearTimedMaps)
{
Format(buffer, maxlength, "Clear timed maps");
}
else if (object_id == MenuRemoveCustomMaps)
{
Format(buffer, maxlength, "Remove custom maps");
}
else if (object_id == MenuCleanPlayers)
{
Format(buffer, maxlength, "Clean players");
}
else if (object_id == MenuClear)
{
Format(buffer, maxlength, "Clear...");
}
}
// When an item is selected do the following
else if (action == TopMenuAction_SelectOption)
{
if (object_id == MenuClearPlayers)
{
DisplayYesNoPanel(client, "Do you really want to clear the player stats?", ClearPlayersPanelHandler);
}
else if (object_id == MenuClearMaps)
{
DisplayYesNoPanel(client, "Do you really want to clear the map stats?", ClearMapsPanelHandler);
}
else if (object_id == MenuClearAll)
{
DisplayYesNoPanel(client, "Do you really want to clear all stats?", ClearAllPanelHandler);
}
else if (object_id == MenuClearTimedMaps)
{
DisplayYesNoPanel(client, "Do you really want to clear all map timings?", ClearTMAllPanelHandler);
}
else if (object_id == MenuRemoveCustomMaps)
{
DisplayYesNoPanel(client, "Do you really want to remove the custom maps?", RemoveCustomMapsPanelHandler);
}
else if (object_id == MenuCleanPlayers)
{
DisplayYesNoPanel(client, "Do you really want to clean the player stats?", CleanPlayersPanelHandler);
}
else if (object_id == MenuClear)
{
Menu_CreateClearMenu(client, 0);
}
}
}
public OnAdminMenuReady(Handle:TopMenu)
{
// Block us from being called twice
if (TopMenu == RankAdminMenu)
return;
RankAdminMenu = TopMenu;
// Add a category to the SourceMod menu called "Player Stats"
AddToTopMenu(RankAdminMenu, "Player Stats", TopMenuObject_Category, ClearRankCategoryHandler, INVALID_TOPMENUOBJECT);
// Get a handle for the catagory we just added so we can add items to it
new TopMenuObject:statscommands = FindTopMenuCategory(RankAdminMenu, "Player Stats");
// Don't attempt to add items to the catagory if for some reason the catagory doesn't exist
if (statscommands == INVALID_TOPMENUOBJECT)
return;
// The order that items are added to menus has no relation to the order that they appear. Items are sorted alphabetically automatically
// Assign the menus to global values so we can easily check what a menu is when it is chosen
MenuClearPlayers = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearplayers", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearplayers", ADMFLAG_ROOT);
MenuClearMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearallmaps", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearallmaps", ADMFLAG_ROOT);
MenuClearAll = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearall", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearall", ADMFLAG_ROOT);
MenuClearTimedMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_cleartimedmaps", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_cleartimedmaps", ADMFLAG_ROOT);
MenuRemoveCustomMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_removecustom", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_removecustom", ADMFLAG_ROOT);
MenuCleanPlayers = AddToTopMenu(RankAdminMenu, "sm_rank_admin_removeplayers", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_removeplayers", ADMFLAG_ROOT);
MenuClear = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clear", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clear", ADMFLAG_ROOT);
}
public OnLibraryRemoved(const String:name[])
{
if (StrEqual(name, "adminmenu"))
RankAdminMenu = INVALID_HANDLE;
}
// This handles the top level "Player Stats" category and how it is displayed on the core admin menu
public ClearRankCategoryHandler(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, client, String:buffer[], maxlength)
{
if (action == TopMenuAction_DisplayOption)
Format(buffer, maxlength, "Player Stats");
else if (action == TopMenuAction_DisplayTitle)
Format(buffer, maxlength, "Player Stats:");
}
public Action:Menu_CreateClearMenu(client, args)
{
new Handle:menu = CreateMenu(Menu_CreateClearMenuHandler);
SetMenuTitle(menu, "Clear:");
SetMenuExitBackButton(menu, true);
SetMenuExitButton(menu, true);
AddMenuItem(menu, "cps", "Clear stats from currently playing player...");
AddMenuItem(menu, "ctm", "Clear timed maps...");
DisplayMenu(menu, client, 30);
return Plugin_Handled;
}
public Menu_CreateClearMenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
switch (param2)
{
case 0:
{
DisplayClearPanel(param1);
}
case 1:
{
Menu_CreateClearTMMenu(param1, 0);
}
}
}
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && RankAdminMenu != INVALID_HANDLE)
DisplayTopMenu(RankAdminMenu, param1, TopMenuPosition_LastCategory);
}
}
}
public Action:Menu_CreateClearTMMenu(client, args)
{
new Handle:menu = CreateMenu(Menu_CreateClearTMMenuHandler);
SetMenuTitle(menu, "Clear Timed Maps:");
SetMenuExitBackButton(menu, true);
SetMenuExitButton(menu, true);
AddMenuItem(menu, "ctma", "All");
AddMenuItem(menu, "ctmc", "Coop");
AddMenuItem(menu, "ctmsu", "Survival");
AddMenuItem(menu, "ctmr", "Realism");
AddMenuItem(menu, "ctmm", "Mutations");
DisplayMenu(menu, client, 30);
return Plugin_Handled;
}
public Menu_CreateClearTMMenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
switch (param2)
{
case 0:
{
DisplayYesNoPanel(param1, "Do you really want to clear all map timings?", ClearTMAllPanelHandler);
}
case 1:
{
DisplayYesNoPanel(param1, "Do you really want to clear all Coop map timings?", ClearTMCoopPanelHandler);
}
case 2:
{
DisplayYesNoPanel(param1, "Do you really want to clear all Survival map timings?", ClearTMSurvivalPanelHandler);
}
case 3:
{
DisplayYesNoPanel(param1, "Do you really want to clear all Realism map timings?", ClearTMRealismPanelHandler);
}
case 4:
{
DisplayYesNoPanel(param1, "Do you really want to clear all Mutations map timings?", ClearTMMutationsPanelHandler);
}
}
}
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && RankAdminMenu != INVALID_HANDLE)
{
DisplayTopMenu(RankAdminMenu, param1, TopMenuPosition_LastCategory);
}
}
}
}
// This deals with what happens someone opens the "Player Stats" category from the menu
public ClearRankTopItemHandler(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, client, String:buffer[], maxlength)
{
// When an item is displayed to a player tell the menu to format the item
if (action == TopMenuAction_DisplayOption)
{
if (object_id == MenuClearPlayers)
{
Format(buffer, maxlength, "Clear players");
}
else if (object_id == MenuClearMaps)
{
Format(buffer, maxlength, "Clear maps");
}
else if (object_id == MenuClearAll)
{
Format(buffer, maxlength, "Clear all");
}
else if (object_id == MenuClearTimedMaps)
{
Format(buffer, maxlength, "Clear timed maps");
}
else if (object_id == MenuRemoveCustomMaps)
{
Format(buffer, maxlength, "Remove custom maps");
}
else if (object_id == MenuCleanPlayers)
{
Format(buffer, maxlength, "Clean players");
}
else if (object_id == MenuClear)
{
Format(buffer, maxlength, "Clear...");
}
}
// When an item is selected do the following
else if (action == TopMenuAction_SelectOption)
{
if (object_id == MenuClearPlayers)
{
DisplayYesNoPanel(client, "Do you really want to clear the player stats?", ClearPlayersPanelHandler);
}
else if (object_id == MenuClearMaps)
{
DisplayYesNoPanel(client, "Do you really want to clear the map stats?", ClearMapsPanelHandler);
}
else if (object_id == MenuClearAll)
{
DisplayYesNoPanel(client, "Do you really want to clear all stats?", ClearAllPanelHandler);
}
else if (object_id == MenuClearTimedMaps)
{
DisplayYesNoPanel(client, "Do you really want to clear all map timings?", ClearTMAllPanelHandler);
}
else if (object_id == MenuRemoveCustomMaps)
{
DisplayYesNoPanel(client, "Do you really want to remove the custom maps?", RemoveCustomMapsPanelHandler);
}
else if (object_id == MenuCleanPlayers)
{
DisplayYesNoPanel(client, "Do you really want to clean the player stats?", CleanPlayersPanelHandler);
}
else if (object_id == MenuClear)
{
Menu_CreateClearMenu(client, 0);
}
}
}
а вот то Ж что у меня получилось
Скрытый текст
// Load our categories and menus
public OnAdminMenuReady(Handle:TopMenu)
{
// Block us from being called twice
if (TopMenu == RankAdminMenu)
return;
RankAdminMenu = TopMenu;
// Add a category to the SourceMod menu called "Player Stats"
AddToTopMenu(RankAdminMenu, "Статистика Игроков", TopMenuObject_Category, ClearRankCategoryHandler, INVALID_TOPMENUOBJECT);
// Get a handle for the catagory we just added so we can add items to it
new TopMenuObject:statscommands = FindTopMenuCategory(RankAdminMenu, "Статистика Игроков");
// Don't attempt to add items to the catagory if for some reason the catagory doesn't exist
if (statscommands == INVALID_TOPMENUOBJECT)
return;
// The order that items are added to menus has no relation to the order that they appear. Items are sorted alphabetically automatically
// Assign the menus to global values so we can easily check what a menu is when it is chosen
MenuClearPlayers = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearplayers", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearplayers", ADMFLAG_ROOT);
MenuClearMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearallmaps", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearallmaps", ADMFLAG_ROOT);
MenuClearAll = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearall", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearall", ADMFLAG_ROOT);
MenuClearTimedMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_cleartimedmaps", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_cleartimedmaps", ADMFLAG_ROOT);
MenuRemoveCustomMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_removecustom", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_removecustom", ADMFLAG_ROOT);
MenuCleanPlayers = AddToTopMenu(RankAdminMenu, "sm_rank_admin_removeplayers", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_removeplayers", ADMFLAG_ROOT);
MenuClear = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clear", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clear", ADMFLAG_ROOT);
}
public OnLibraryRemoved(const String:name[])
{
if (StrEqual(name, "adminmenu"))
RankAdminMenu = INVALID_HANDLE;
}
// This handles the top level "Player Stats" category and how it is displayed on the core admin menu
public ClearRankCategoryHandler(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, client, String:buffer[], maxlength)
{
if (action == TopMenuAction_DisplayOption)
Format(buffer, maxlength, "Player Stats");
else if (action == TopMenuAction_DisplayTitle)
Format(buffer, maxlength, "Player Stats:");
}
public Action:Menu_CreateClearMenu(client, args)
{
new Handle:menu = CreateMenu(Menu_CreateClearMenuHandler);
SetMenuTitle(menu, "Удалить:");
SetMenuExitBackButton(menu, true);
SetMenuExitButton(menu, true);
AddMenuItem(menu, "cps", "Удалить статистику игрока на сервере...");
AddMenuItem(menu, "ctm", "Удалить на этой карте...");
DisplayMenu(menu, client, 30);
return Plugin_Handled;
}
public Menu_CreateClearMenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
switch (param2)
{
case 0:
{
DisplayClearPanel(param1);
}
case 1:
{
Menu_CreateClearTMMenu(param1, 0);
}
}
}
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && RankAdminMenu != INVALID_HANDLE)
DisplayTopMenu(RankAdminMenu, param1, TopMenuPosition_LastCategory);
}
}
}
public Action:Menu_CreateClearTMMenu(client, args)
{
new Handle:menu = CreateMenu(Menu_CreateClearTMMenuHandler);
SetMenuTitle(menu, "Удалить на этой карте:");
SetMenuExitBackButton(menu, true);
SetMenuExitButton(menu, true);
AddMenuItem(menu, "ctma", "Всё");
AddMenuItem(menu, "ctmc", "Кооп");
AddMenuItem(menu, "ctmsu", "Выживание");
AddMenuItem(menu, "ctmr", "Реализм");
AddMenuItem(menu, "ctmm", "Мутации");
DisplayMenu(menu, client, 30);
return Plugin_Handled;
}
public Menu_CreateClearTMMenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
switch (param2)
{
case 0:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты?", ClearTMAllPanelHandler);
}
case 1:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты в коопе?", ClearTMCoopPanelHandler);
}
case 2:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты в выживании?", ClearTMSurvivalPanelHandler);
}
case 3:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты в реализме?", ClearTMRealismPanelHandler);
}
case 4:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты в мутациях?", ClearTMMutationsPanelHandler);
}
}
}
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && RankAdminMenu != INVALID_HANDLE)
{
DisplayTopMenu(RankAdminMenu, param1, TopMenuPosition_LastCategory);
}
}
}
}
// This deals with what happens someone opens the "Player Stats" category from the menu
public ClearRankTopItemHandler(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, client, String:buffer[], maxlength)
{
// When an item is displayed to a player tell the menu to format the item
if (action == TopMenuAction_DisplayOption)
{
if (object_id == MenuClearPlayers)
{
Format(buffer, maxlength, "Удалить Игроков");
}
else if (object_id == MenuClearMaps)
{
Format(buffer, maxlength, "Удалить Карты");
}
else if (object_id == MenuClearAll)
{
Format(buffer, maxlength, "Удалить всё");
}
else if (object_id == MenuClearTimedMaps)
{
Format(buffer, maxlength, "Удалить на этой карте");
}
else if (object_id == MenuRemoveCustomMaps)
{
Format(buffer, maxlength, "Удалить на других картах");
}
else if (object_id == MenuCleanPlayers)
{
Format(buffer, maxlength, "Удалить Игроков");
}
else if (object_id == MenuClear)
{
Format(buffer, maxlength, "Удалить...");
}
}
// When an item is selected do the following
else if (action == TopMenuAction_SelectOption)
{
if (object_id == MenuClearPlayers)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить статистику игроков?", ClearPlayersPanelHandler);
}
else if (object_id == MenuClearMaps)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить на стандартных картах?", ClearMapsPanelHandler);
}
else if (object_id == MenuClearAll)
{
DisplayYesNoPanel(client, "Вы хотите удалить всю статистику?", ClearAllPanelHandler);
}
else if (object_id == MenuClearTimedMaps)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить всё на стандартных картах?", ClearTMAllPanelHandler);
}
else if (object_id == MenuRemoveCustomMaps)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить всё на дополнительных картах?", RemoveCustomMapsPanelHandler);
}
else if (object_id == MenuCleanPlayers)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить статистику игроков?", CleanPlayersPanelHandler);
}
else if (object_id == MenuClear)
{
Menu_CreateClearMenu(client, 0);
}
}
}
public OnAdminMenuReady(Handle:TopMenu)
{
// Block us from being called twice
if (TopMenu == RankAdminMenu)
return;
RankAdminMenu = TopMenu;
// Add a category to the SourceMod menu called "Player Stats"
AddToTopMenu(RankAdminMenu, "Статистика Игроков", TopMenuObject_Category, ClearRankCategoryHandler, INVALID_TOPMENUOBJECT);
// Get a handle for the catagory we just added so we can add items to it
new TopMenuObject:statscommands = FindTopMenuCategory(RankAdminMenu, "Статистика Игроков");
// Don't attempt to add items to the catagory if for some reason the catagory doesn't exist
if (statscommands == INVALID_TOPMENUOBJECT)
return;
// The order that items are added to menus has no relation to the order that they appear. Items are sorted alphabetically automatically
// Assign the menus to global values so we can easily check what a menu is when it is chosen
MenuClearPlayers = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearplayers", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearplayers", ADMFLAG_ROOT);
MenuClearMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearallmaps", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearallmaps", ADMFLAG_ROOT);
MenuClearAll = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clearall", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clearall", ADMFLAG_ROOT);
MenuClearTimedMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_cleartimedmaps", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_cleartimedmaps", ADMFLAG_ROOT);
MenuRemoveCustomMaps = AddToTopMenu(RankAdminMenu, "sm_rank_admin_removecustom", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_removecustom", ADMFLAG_ROOT);
MenuCleanPlayers = AddToTopMenu(RankAdminMenu, "sm_rank_admin_removeplayers", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_removeplayers", ADMFLAG_ROOT);
MenuClear = AddToTopMenu(RankAdminMenu, "sm_rank_admin_clear", TopMenuObject_Item, ClearRankTopItemHandler, statscommands, "sm_rank_admin_clear", ADMFLAG_ROOT);
}
public OnLibraryRemoved(const String:name[])
{
if (StrEqual(name, "adminmenu"))
RankAdminMenu = INVALID_HANDLE;
}
// This handles the top level "Player Stats" category and how it is displayed on the core admin menu
public ClearRankCategoryHandler(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, client, String:buffer[], maxlength)
{
if (action == TopMenuAction_DisplayOption)
Format(buffer, maxlength, "Player Stats");
else if (action == TopMenuAction_DisplayTitle)
Format(buffer, maxlength, "Player Stats:");
}
public Action:Menu_CreateClearMenu(client, args)
{
new Handle:menu = CreateMenu(Menu_CreateClearMenuHandler);
SetMenuTitle(menu, "Удалить:");
SetMenuExitBackButton(menu, true);
SetMenuExitButton(menu, true);
AddMenuItem(menu, "cps", "Удалить статистику игрока на сервере...");
AddMenuItem(menu, "ctm", "Удалить на этой карте...");
DisplayMenu(menu, client, 30);
return Plugin_Handled;
}
public Menu_CreateClearMenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
switch (param2)
{
case 0:
{
DisplayClearPanel(param1);
}
case 1:
{
Menu_CreateClearTMMenu(param1, 0);
}
}
}
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && RankAdminMenu != INVALID_HANDLE)
DisplayTopMenu(RankAdminMenu, param1, TopMenuPosition_LastCategory);
}
}
}
public Action:Menu_CreateClearTMMenu(client, args)
{
new Handle:menu = CreateMenu(Menu_CreateClearTMMenuHandler);
SetMenuTitle(menu, "Удалить на этой карте:");
SetMenuExitBackButton(menu, true);
SetMenuExitButton(menu, true);
AddMenuItem(menu, "ctma", "Всё");
AddMenuItem(menu, "ctmc", "Кооп");
AddMenuItem(menu, "ctmsu", "Выживание");
AddMenuItem(menu, "ctmr", "Реализм");
AddMenuItem(menu, "ctmm", "Мутации");
DisplayMenu(menu, client, 30);
return Plugin_Handled;
}
public Menu_CreateClearTMMenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
switch (param2)
{
case 0:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты?", ClearTMAllPanelHandler);
}
case 1:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты в коопе?", ClearTMCoopPanelHandler);
}
case 2:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты в выживании?", ClearTMSurvivalPanelHandler);
}
case 3:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты в реализме?", ClearTMRealismPanelHandler);
}
case 4:
{
DisplayYesNoPanel(param1, "Вы действительно хотите очистить всю стату карты в мутациях?", ClearTMMutationsPanelHandler);
}
}
}
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && RankAdminMenu != INVALID_HANDLE)
{
DisplayTopMenu(RankAdminMenu, param1, TopMenuPosition_LastCategory);
}
}
}
}
// This deals with what happens someone opens the "Player Stats" category from the menu
public ClearRankTopItemHandler(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, client, String:buffer[], maxlength)
{
// When an item is displayed to a player tell the menu to format the item
if (action == TopMenuAction_DisplayOption)
{
if (object_id == MenuClearPlayers)
{
Format(buffer, maxlength, "Удалить Игроков");
}
else if (object_id == MenuClearMaps)
{
Format(buffer, maxlength, "Удалить Карты");
}
else if (object_id == MenuClearAll)
{
Format(buffer, maxlength, "Удалить всё");
}
else if (object_id == MenuClearTimedMaps)
{
Format(buffer, maxlength, "Удалить на этой карте");
}
else if (object_id == MenuRemoveCustomMaps)
{
Format(buffer, maxlength, "Удалить на других картах");
}
else if (object_id == MenuCleanPlayers)
{
Format(buffer, maxlength, "Удалить Игроков");
}
else if (object_id == MenuClear)
{
Format(buffer, maxlength, "Удалить...");
}
}
// When an item is selected do the following
else if (action == TopMenuAction_SelectOption)
{
if (object_id == MenuClearPlayers)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить статистику игроков?", ClearPlayersPanelHandler);
}
else if (object_id == MenuClearMaps)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить на стандартных картах?", ClearMapsPanelHandler);
}
else if (object_id == MenuClearAll)
{
DisplayYesNoPanel(client, "Вы хотите удалить всю статистику?", ClearAllPanelHandler);
}
else if (object_id == MenuClearTimedMaps)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить всё на стандартных картах?", ClearTMAllPanelHandler);
}
else if (object_id == MenuRemoveCustomMaps)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить всё на дополнительных картах?", RemoveCustomMapsPanelHandler);
}
else if (object_id == MenuCleanPlayers)
{
DisplayYesNoPanel(client, "Вы действительно хотите удалить статистику игроков?", CleanPlayersPanelHandler);
}
else if (object_id == MenuClear)
{
Menu_CreateClearMenu(client, 0);
}
}
}
Прикрепленные файлы
- l4d_stats.sp 346,95К 13 Количество загрузок: