R1KO
fuck society
- Сообщения
- 9,457
- Реакции
- 7,786
- Команда форума
- #41
Вот вам наработочка, дальше сами:
Все пункты считываются с файла addons/sourcemod/configs/rules.txt
Заполнять просто так:
PHP:
#pragma semicolon 1
#include <sourcemod>
new Handle:g_hMenu;
public OnConfigsExecuted()
{
if (g_hMenu != INVALID_HANDLE)
{
CloseHandle(g_hMenu);
g_hMenu = INVALID_HANDLE;
}
g_hMenu = CreateMenu(RulesMenuHandler);
SetMenuExitButton(g_hMenu, false);
SetMenuTitle(g_hMenu, "Ознакомьтесь с правилами:\n \n");
decl String:sBuffer[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sBuffer, sizeof(sBuffer), "configs/rules.txt");
if(!FileExists(sBuffer)) SetFailState("Не найден файл %s", sBuffer);
new Handle:hFile = OpenFile(sBuffer, "r");
if (hFile != INVALID_HANDLE)
{
while (!IsEndOfFile(hFile) && ReadFileLine(hFile, sBuffer, sizeof(sBuffer)))
{
TrimString(sBuffer);
if (sBuffer[0])
{
ReplaceString(sBuffer, sizeof(sBuffer), "\\n", "\n", false);
AddMenuItem(g_hMenu, "", sBuffer, ITEMDRAW_DISABLED);
}
}
} else SetFailState("Не удалось открыть файл %s", sBuffer);
CloseHandle(hFile);
AddMenuItem(g_hMenu, "", "Согласен");
AddMenuItem(g_hMenu, "", "Не согласен");
}
public OnClientPostAdminCheck(iClient)
{
if(iClient) DisplayMenu(g_hMenu, iClient, 0)
}
public RulesMenuHandler(Handle:hMenu, MenuAction:action, iClient, option)
{
if (action == MenuAction_Select && option == 1) KickClient(iClient, "Вы должны согласиться с правилами");
}
Заполнять просто так:
Можно юзать \n для переноса строки в меню.Не крыть матом игроков
Не спорить с админами\nиначе - бан!