hook.add("client:connect", "bans.check", function(e) if banned[e.ip] then e.reason = "Вы забанены" e:cancel() endend)
Отмена.e:cancel() не пускает игрока. Без e.reason он увидит общую фразу.
Здесь e.player:steamid() возвращает STEAM_ID_PENDING, а
сообщения не доходят. Права и статистику вешай на
client:authorized, приветствия — на client:connected.
true — событие синтезировал модуль (движок его не вызывал), false — настоящий ClientDisconnect
Место, где чистят своё состояние по e.player.id.
e.reason и e.forced приходят из двух разных источников в зависимости от
того, что случилось:
Игрок был в игре и отвалился (кик, бан, таймаут, disconnect в
консоли) — e.forced == false. Причина от движка через ReHLDS-хук
SV_DropClient. Требует ReHLDS: на ванильном HLDS e.reason здесь пустая
строка. Формат — как в логах сервера: "Kicked", "Disconnect by user",
"Timed out" — движок не даёт фиксированный список кодов, только строку.
Коннект отклонил Lua-плагин через client:connect + e:cancel() —
e.forced == true. Причина всегда есть: это тот же текст, что увидел
отказанный игрок (e.reason, выставленный в client:connect, либо
дефолтная фраза, если плагин его не задал). Движок в этом случае
ClientDisconnect вообще не вызывает, client:disconnect подставляется
вместо него, чтобы игрок не “пропадал” молча для тех, кто слушает только
это событие.
Проверяй e.forced, если логика зависит от того, был ли игрок реально в
игре.
hook.add("player:chat", "myplugin.mute", function(e) if muted[e.player.id] then e.player:chat("Ты в муте") e:cancel() endend)
Отмена.e:cancel() проглатывает сообщение — оно не доходит ни до кого. Так работает !команда, и так же чат-менеджер подменяет строку: отменить и разослать свою.
{"docsConfig":{"theme":"palm","$schema":"https://mintlify.com/docs.json","name":"cs-lua","description":"Плагины для CS 1.6 на Lua вместо SourcePawn","colors":{"primary":"#b45309","light":"#f59e0b","dark":"#f59e0b"},"favicon":"https://mintcdn.com/cs-lua/4nz6nyrD_5HF1omW/favicon.svg?fit=max\u0026auto=format\u0026n=4nz6nyrD_5HF1omW\u0026q=85\u0026s=0c30c7ace5323904dec95fad5a12618f","styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cs-lua","hasAudioNarration":false,"actualSubdomain":"cs-lua","customDomains":[],"gitSource":{"type":"github","owner":"kotyarakryt","repo":"cs-lua","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"chroma":{"latestBuiltDeploymentHistoryId":"6a99652396830be73b3236c1","collectionId":"863c2317-eb88-4764-a474-a761c7d4f12b","liveDeploymentHistoryId":"6a99652396830be73b3236c1","schemaVersion":"v3"},"feedback":{"thumbs":true,"issues":true,"edits":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a99652396830be73b3236c1","clientVersion":"0.0.4071","searchFilterCounts":[{"language":"default","tag":"Справочник API","count":57},{"language":"default","tag":"hook","count":8},{"language":"default","tag":"players","count":8},{"language":"default","tag":"access","count":4},{"language":"default","tag":"db","count":4},{"language":"default","tag":"ents","count":3},{"language":"default","tag":"msg","count":3},{"language":"default","tag":"mysql","count":3},{"language":"default","tag":"store","count":3},{"language":"default","tag":"sv","count":3}],"searchSettings":{"isFiltersEnabled":true}},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"type":"link","url":"https://github.com/KotyaraKryt/cs-lua/issues"}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"privacy":{"consentBanner":{"enabled":true}},"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api/hook/connection","slug":"/api/hook/connection","pageMetadata":{"title":"hook — Подключение","description":"Порядок: `client:connect` → `client:authorized` → `client:connected`","href":"/api/hook/connection"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_components.p, {\n children: [\"Порядок: \", _jsx(_components.code, {\n children: \"client:connect\"\n }), \" → \", _jsx(_components.code, {\n children: \"client:authorized\"\n }), \" → \", _jsx(_components.code, {\n children: \"client:connected\"\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`1`,id:`подключение`,children:`Подключение`}),`\n`,_jsxs(_components.p,{children:[`Порядок: `,_jsx(_components.code,{children:`client:connect`}),` → `,_jsx(_components.code,{children:`client:authorized`}),` → `,_jsx(_components.code,{children:`client:connected`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`connect`,children:`client:connect`}),`\n`,_jsx(_components.p,{children:`Игрок стучится на сервер; его ещё можно не пустить.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`hook`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"client:connect\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`\t...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`connect-поля-события`,children:`Поля события`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`поле`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.player`})}),_jsx(_components.td,{children:`player`}),_jsx(_components.td,{children:`кого касается событие`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.name`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`ник`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.ip`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`адрес`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.reason`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`запись: текст отказа, который увидит игрок`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`пример`,children:`Пример`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`hook`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"client:connect\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"bans.check\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`\tif`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` banned`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`ip`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`\t\te`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`reason`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Вы забанены\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`\t\te`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`cancel`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`\tend`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Отмена.`}),` `,_jsx(_components.code,{children:`e:cancel()`}),` не пускает игрока. Без `,_jsx(_components.code,{children:`e.reason`}),` он увидит общую фразу.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Здесь `,_jsx(_components.code,{children:`e.player:steamid()`}),` возвращает `,_jsx(_components.code,{children:`STEAM_ID_PENDING`}),`, а\nсообщения не доходят. Права и статистику вешай на\n`,_jsx(_components.code,{children:`client:authorized`}),`, приветствия — на `,_jsx(_components.code,{children:`client:connected`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`disconnect`,children:`client:disconnect`}),`\n`,_jsxs(_components.p,{children:[`Игрок отключился — уже был в игре, или его коннект отклонил Lua-плагин через\n`,_jsx(_components.code,{children:`client:connect`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`hook`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"client:disconnect\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`\t...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`disconnect-поля-события`,children:`Поля события`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`поле`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.player`})}),_jsx(_components.td,{children:`player`}),_jsx(_components.td,{children:`кого касается событие`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.name`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`ник — сам объект уже пустеет`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.reason`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`причина отключения, см. ниже`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.forced`})}),_jsx(_components.td,{children:`boolean`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`true`}),` — событие синтезировал модуль (движок его не вызывал), `,_jsx(_components.code,{children:`false`}),` — настоящий `,_jsx(_components.code,{children:`ClientDisconnect`})]})]})]})]}),`\n`,_jsxs(_components.p,{children:[`Место, где чистят своё состояние по `,_jsx(_components.code,{children:`e.player.id`}),`.`]}),`\n`,_jsxs(Warning,{children:[_jsxs(_components.p,{children:[_jsx(_components.code,{children:`e.reason`}),` и `,_jsx(_components.code,{children:`e.forced`}),` приходят из двух разных источников в зависимости от\nтого, что случилось:`]}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Игрок был в игре и отвалился`}),` (кик, бан, таймаут, `,_jsx(_components.code,{children:`disconnect`}),` в\nконсоли) — `,_jsx(_components.code,{children:`e.forced == false`}),`. Причина от движка через ReHLDS-хук\n`,_jsx(_components.code,{children:`SV_DropClient`}),`. Требует ReHLDS: на ванильном HLDS `,_jsx(_components.code,{children:`e.reason`}),` здесь пустая\nстрока. Формат — как в логах сервера: `,_jsx(_components.code,{children:`\"Kicked\"`}),`, `,_jsx(_components.code,{children:`\"Disconnect by user\"`}),`,\n`,_jsx(_components.code,{children:`\"Timed out\"`}),` — движок не даёт фиксированный список кодов, только строку.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Коннект отклонил Lua-плагин`}),` через `,_jsx(_components.code,{children:`client:connect`}),` + `,_jsx(_components.code,{children:`e:cancel()`}),` —\n`,_jsx(_components.code,{children:`e.forced == true`}),`. Причина всегда есть: это тот же текст, что увидел\nотказанный игрок (`,_jsx(_components.code,{children:`e.reason`}),`, выставленный в `,_jsx(_components.code,{children:`client:connect`}),`, либо\nдефолтная фраза, если плагин его не задал). Движок в этом случае\n`,_jsx(_components.code,{children:`ClientDisconnect`}),` вообще не вызывает, `,_jsx(_components.code,{children:`client:disconnect`}),` подставляется\nвместо него, чтобы игрок не “пропадал” молча для тех, кто слушает только\nэто событие.`]}),`\n`]}),_jsxs(_components.p,{children:[`Проверяй `,_jsx(_components.code,{children:`e.forced`}),`, если логика зависит от того, был ли игрок реально в\nигре.`]})]}),`\n`,_jsx(Heading,{level:`2`,id:`authorized`,children:`client:authorized`}),`\n`,_jsx(_components.p,{children:`Steam ответил, steamid наконец известен.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`hook`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"client:authorized\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`\t...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`authorized-поля-события`,children:`Поля события`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`поле`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.player`})}),_jsx(_components.td,{children:`player`}),_jsx(_components.td,{children:`кого касается событие`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.steamid`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`настоящий authid`})]})]})]}),`\n`,_jsx(_components.p,{children:`Срабатывает один раз за подключение. Всё, что завязано на steamid — права, статистика — начинается здесь.`}),`\n`,_jsx(Heading,{level:`2`,id:`connected`,children:`client:connected`}),`\n`,_jsx(_components.p,{children:`Игрок в игре, сообщения до него доходят.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`hook`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"client:connected\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`\t...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`connected-поля-события`,children:`Поля события`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`поле`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.player`})}),_jsx(_components.td,{children:`player`}),_jsx(_components.td,{children:`кого касается событие`})]})})]}),`\n`,_jsx(_components.p,{children:`Место для приветствий и первого HUD.`}),`\n`,_jsx(Heading,{level:`2`,id:`chat`,children:`player:chat`}),`\n`,_jsx(_components.p,{children:`Игрок написал в чат.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`hook`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"player:chat\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`\t...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`chat-поля-события`,children:`Поля события`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`поле`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.player`})}),_jsx(_components.td,{children:`player`}),_jsx(_components.td,{children:`кого касается событие`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.text`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`что он написал`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.team`})}),_jsx(_components.td,{children:`boolean`}),_jsxs(_components.td,{children:[`сообщение ушло в `,_jsx(_components.code,{children:`say_team`})]})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`пример-2`,children:`Пример`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`hook`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"player:chat\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"myplugin.mute\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`\tif`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` muted`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`player`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`\t\te`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`player`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Ты в муте\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`\t\te`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`cancel`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`\tend`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Отмена.`}),` `,_jsx(_components.code,{children:`e:cancel()`}),` проглатывает сообщение — оно не доходит ни до кого. Так работает `,_jsx(_components.code,{children:`!команда`}),`, и так же чат-менеджер подменяет строку: отменить и разослать свою.`]}),`\n`,_jsx(Heading,{level:`2`,id:`select`,children:`menu:select`}),`\n`,_jsx(_components.p,{children:`Игрок нажал клавишу в меню, открытом из Lua.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`hook`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"menu:select\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`\t...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`select-поля-события`,children:`Поля события`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`поле`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.player`})}),_jsx(_components.td,{children:`player`}),_jsx(_components.td,{children:`кого касается событие`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`e.key`})}),_jsx(_components.td,{children:`number`}),_jsx(_components.td,{children:`номер клавиши, 1..10`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`Обычно не нужно: `,_jsx(_components.a,{href:`/api/menu`,children:_jsx(_components.code,{children:`menu`})}),` разбирает это сам.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"hook — Подключение","description":"Порядок: `client:connect` → `client:authorized` → `client:connected`","href":"/api/hook/connection"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Подключение","slug":"подключение","depth":1,"children":[]},{"title":"client:connect","slug":"connect","depth":2,"children":[{"title":"Поля события","slug":"connect-поля-события","depth":3,"children":[]},{"title":"Пример","slug":"пример","depth":3,"children":[]}]},{"title":"client:disconnect","slug":"disconnect","depth":2,"children":[{"title":"Поля события","slug":"disconnect-поля-события","depth":3,"children":[]}]},{"title":"client:authorized","slug":"authorized","depth":2,"children":[{"title":"Поля события","slug":"authorized-поля-события","depth":3,"children":[]}]},{"title":"client:connected","slug":"connected","depth":2,"children":[{"title":"Поля события","slug":"connected-поля-события","depth":3,"children":[]}]},{"title":"player:chat","slug":"chat","depth":2,"children":[{"title":"Поля события","slug":"chat-поля-события","depth":3,"children":[]},{"title":"Пример","slug":"пример-2","depth":3,"children":[]}]},{"title":"menu:select","slug":"select","depth":2,"children":[{"title":"Поля события","slug":"select-поля-события","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"cs-lua","siteName":"cs-lua","title":"hook — Подключение - cs-lua","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-30T08:05:27.359Z","originalFileLocation":"api/hook/connection.md"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Порядок: client:connect → client:authorized → client:connected\">\u003cmeta data-mint-head name=\"application-name\" content=\"cs-lua\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"hook — Подключение - cs-lua\">\u003cmeta data-mint-head property=\"og:description\" content=\"Порядок: client:connect → client:authorized → client:connected\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"cs-lua\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://cs-lua.mintlify.app/api/hook/connection\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://cs-lua.mintlify.app/_mintlify/api/og/v2?division=hook\u0026amp;title=hook+%E2%80%94+%D0%9F%D0%BE%D0%B4%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%BD%D0%B8%D0%B5\u0026amp;description=%D0%9F%D0%BE%D1%80%D1%8F%D0%B4%D0%BE%D0%BA%3A+%60client%3Aconnect%60+%E2%86%92+%60client%3Aauthorized%60+%E2%86%92+%60client%3Aconnected%60\u0026amp;theme=b6c4e23cd1a333c2e21535c9\u0026amp;signature=00a1b328da268b577bb7fa2fb886ece56df946d595a1f08f1334dc784c85c7ae\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"hook — Подключение - cs-lua\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Порядок: client:connect → client:authorized → client:connected\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://cs-lua.mintlify.app/_mintlify/api/og/v2?division=hook\u0026amp;title=hook+%E2%80%94+%D0%9F%D0%BE%D0%B4%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%BD%D0%B8%D0%B5\u0026amp;description=%D0%9F%D0%BE%D1%80%D1%8F%D0%B4%D0%BE%D0%BA%3A+%60client%3Aconnect%60+%E2%86%92+%60client%3Aauthorized%60+%E2%86%92+%60client%3Aconnected%60\u0026amp;theme=b6c4e23cd1a333c2e21535c9\u0026amp;signature=00a1b328da268b577bb7fa2fb886ece56df946d595a1f08f1334dc784c85c7ae\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"cs-lua\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#b45309\">\u003clink data-mint-head rel=\"canonical\" href=\"https://cs-lua.mintlify.app/api/hook/connection\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api/hook/connection.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://cs-lua.mintlify.app/#organization\",\"name\":\"cs-lua\",\"url\":\"https://cs-lua.mintlify.app\"},{\"@type\":\"WebSite\",\"@id\":\"https://cs-lua.mintlify.app#website\",\"name\":\"cs-lua\",\"url\":\"https://cs-lua.mintlify.app\",\"publisher\":{\"@id\":\"https://cs-lua.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://cs-lua.mintlify.app/api/hook/connection#webpage\",\"url\":\"https://cs-lua.mintlify.app/api/hook/connection\",\"name\":\"hook — Подключение\",\"description\":\"Порядок: client:connect → client:authorized → client:connected\",\"dateModified\":\"2026-08-30T08:05:27.359Z\",\"isPartOf\":{\"@id\":\"https://cs-lua.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://cs-lua.mintlify.app/api/hook/connection#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://cs-lua.mintlify.app/api/hook/connection#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Справочник API\",\"item\":\"https://cs-lua.mintlify.app/api/index\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"hook\",\"item\":\"https://cs-lua.mintlify.app/api/hook/index\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"hook — Подключение\",\"item\":\"https://cs-lua.mintlify.app/api/hook/connection\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://cs-lua.mintlify.app/api/hook/connection#article\",\"headline\":\"hook — Подключение\",\"name\":\"hook — Подключение\",\"description\":\"Порядок: client:connect → client:authorized → client:connected\",\"url\":\"https://cs-lua.mintlify.app/api/hook/connection\",\"mainEntityOfPage\":{\"@id\":\"https://cs-lua.mintlify.app/api/hook/connection#webpage\"},\"dateModified\":\"2026-08-30T08:05:27.359Z\",\"publisher\":{\"@id\":\"https://cs-lua.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://cs-lua.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"cs-lua\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"cs-lua","nav":{"global":null,"groups":[{"group":"Документация","pages":[{"title":null,"href":"/intro"},{"title":null,"href":"/install"},{"title":"Plugins","href":"/plugins"},{"title":null,"href":"/building"}]},{"group":"Справочник API","pages":[{"title":null,"href":"/api/index"},{"group":"hook","pages":[{"title":"hook","href":"/api/hook/index"},{"title":"hook — Пространство имён","description":"Одна система на движковые события и на свои","href":"/api/hook/namespace"},{"title":"hook — Подключение","href":"/api/hook/connection"},{"title":"hook — Жизнь сервера","description":"Одна система на движковые события и на свои","href":"/api/hook/lifecycle"},{"title":"hook — Геймплей","href":"/api/hook/gameplay"},{"title":"hook — Раунд и бомба","href":"/api/hook/round"},{"title":"hook — Магазин","href":"/api/hook/shop"},{"title":"hook — Движок и ReHLDS","href":"/api/hook/engine"}]},{"group":"msg","pages":[{"title":"msg","href":"/api/msg/index"},{"title":"msg — Отправка","href":"/api/msg/send"},{"title":"msg — Поля сообщения","href":"/api/msg/fields"}]},{"group":"cmd","pages":[{"title":"cmd","href":"/api/cmd/index"}]},{"group":"players","pages":[{"title":"players","href":"/api/players/index"},{"title":"players — Пространство имён","href":"/api/players/namespace"},{"title":"players — Идентификация","href":"/api/players/identity"},{"title":"players — Состояние","href":"/api/players/state"},{"title":"players — CS-состояние","href":"/api/players/cs-state"},{"title":"players — Сообщения","href":"/api/players/messages"},{"title":"players — Админские действия","href":"/api/players/admin"},{"title":"players — Права","href":"/api/players/access"}]},{"group":"timer","pages":[{"title":"timer","href":"/api/timer/index"},{"title":"timer — Анонимные","href":"/api/timer/anonymous"},{"title":"timer — Именованные","href":"/api/timer/named"}]},{"group":"ents","pages":[{"title":"ents","href":"/api/ents/index"},{"title":"ents — Пространство имён","href":"/api/ents/namespace"},{"title":"ents — Объект сущности","href":"/api/ents/entity"}]},{"group":"vec","pages":[{"title":"vec","href":"/api/vec/index"}]},{"group":"fx","pages":[{"title":"fx","href":"/api/fx/index"}]},{"group":"res","pages":[{"title":"res","href":"/api/res/index"}]},{"group":"sv","pages":[{"title":"sv","href":"/api/sv/index"},{"title":"sv — Сервер","href":"/api/sv/server"},{"title":"sv — Cvar","href":"/api/sv/cvar"}]},{"group":"db","pages":[{"title":"db","href":"/api/db/index"},{"title":"db — Открытие","href":"/api/db/open"},{"title":"db — Объект базы","href":"/api/db/database"},{"title":"db — Подготовленное выражение","href":"/api/db/statement"}]},{"group":"mysql","pages":[{"title":"mysql","href":"/api/mysql/index"},{"title":"mysql — Открытие","href":"/api/mysql/open"},{"title":"mysql — Объект соединения","href":"/api/mysql/connection"}]},{"group":"store","pages":[{"title":"store","href":"/api/store/index"},{"title":"store — Ключ-значение","href":"/api/store/kv"},{"title":"store — datafile","href":"/api/store/datafile"}]},{"group":"file","pages":[{"title":"file","href":"/api/file/index"}]},{"group":"log","pages":[{"title":"log","href":"/api/log/index"}]},{"group":"regex","pages":[{"title":"regex","href":"/api/regex/index"}]},{"group":"http","pages":[{"title":"http","href":"/api/http/index"}]},{"group":"menu","pages":[{"title":"menu","href":"/api/menu/index"}]},{"group":"ui","pages":[{"title":"ui","href":"/api/ui/index"}]},{"group":"access","pages":[{"title":"access","href":"/api/access/index"},{"title":"access — Объявление","href":"/api/access/declare"},{"title":"access — Выдача","href":"/api/access/grant"},{"title":"access — Чтение","href":"/api/access/read"}]},{"group":"plugin","pages":[{"title":"plugin","href":"/api/plugin/index"}]},{"group":"export / import","pages":[{"title":"export / import","href":"/api/exports/index"}]},{"title":"Все вызовы","href":"/api/all"},{"title":null,"href":"/api/console"}]}]},"basePath":"","title":"hook — Подключение - cs-lua","buildId":"dpl_GZsjphRpnhWkstV12jxWNcMHFyox","deploymentId":"dpl_GZsjphRpnhWkstV12jxWNcMHFyox","dynamics":[],"chunks":[]}