14 |
15 |
18 |
19 |
20 | <%- await include('parts/footer.ejs', locals) %>
21 |
--------------------------------------------------------------------------------
/monitor/web/public/css/foldgutter.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-foldmarker {
2 | color: blue;
3 | text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
4 | font-family: arial;
5 | line-height: .3;
6 | cursor: pointer;
7 | }
8 | .CodeMirror-foldgutter {
9 | width: .7em;
10 | }
11 | .CodeMirror-foldgutter-open,
12 | .CodeMirror-foldgutter-folded {
13 | cursor: pointer;
14 | }
15 | .CodeMirror-foldgutter-open:after {
16 | content: "\25BE";
17 | }
18 | .CodeMirror-foldgutter-folded:after {
19 | content: "\25B8";
20 | }
21 |
--------------------------------------------------------------------------------
/monitor/nui/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | txAdmin NUI
7 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/monitor/resource/menu/server/sv_functions.lua:
--------------------------------------------------------------------------------
1 | --Check Environment
2 | if GetConvar('txAdminServerMode', 'false') ~= 'true' then
3 | return
4 | end
5 |
6 | --- Determine if a source has a given permission
7 | ---@param source number
8 | ---@param reqPerm string
9 | ---@return boolean
10 | function PlayerHasTxPermission(source, reqPerm)
11 | local allow = false
12 | local admin = TX_ADMINS[tostring(source)]
13 | if admin and admin.perms then
14 | for _, perm in pairs(admin.perms) do
15 | if perm == 'all_permissions' or reqPerm == perm then
16 | allow = true
17 | break
18 | end
19 | end
20 | end
21 | debugPrint(string.format("permission check (src=^3%d^0, perm=^4%s^0, result=%s^0)",
22 | source, reqPerm, (allow and '^2true' or '^1false')))
23 | return allow
24 | end
25 |
--------------------------------------------------------------------------------
/monitor/resource/menu/server/sv_freeze_player.lua:
--------------------------------------------------------------------------------
1 | --Check Environment
2 | if GetConvar('txAdminServerMode', 'false') ~= 'true' then
3 | return
4 | end
5 |
6 | local frozenPlayers = {}
7 |
8 | local function isPlayerFrozen(targetId)
9 | return frozenPlayers[targetId] or false
10 | end
11 |
12 | local function setPlayerFrozenInMap(targetId, status)
13 | frozenPlayers[targetId] = status or nil
14 | end
15 |
16 | RegisterNetEvent("txAdmin:menu:freezePlayer", function(targetId)
17 | local src = source
18 | local allow = PlayerHasTxPermission(src, 'players.freeze')
19 | TriggerEvent("txaLogger:menuEvent", src, "freezePlayer", allow, targetId)
20 | if allow then
21 | local newFrozenStatus = not isPlayerFrozen(targetId)
22 | setPlayerFrozenInMap(targetId, newFrozenStatus)
23 |
24 | TriggerClientEvent("txAdmin:menu:freezeResp", src, newFrozenStatus)
25 | TriggerClientEvent("txAdmin:menu:freezePlayer", targetId, newFrozenStatus)
26 | end
27 | end)
28 |
--------------------------------------------------------------------------------
/monitor/resource/menu/shared.lua:
--------------------------------------------------------------------------------
1 | debugModeEnabled = false
2 |
3 | function debugPrint(...)
4 | local args = {...}
5 | local appendedStr = ''
6 | if debugModeEnabled then
7 | for _, v in ipairs(args) do
8 | appendedStr = appendedStr .. ' ' .. (type(v)=="table" and json.encode(v) or tostring(v))
9 | end
10 | local msgTemplate = '^3[txAdminMenu]^0%s^0'
11 | local msg = msgTemplate:format(appendedStr)
12 | print(msg)
13 | end
14 | end
15 |
16 | -- Used whenever we want to convey a message as from txAdminMenu without
17 | -- being in debug mode.
18 | function txPrint(...)
19 | local args = {...}
20 | local appendedStr = ''
21 | for _, v in ipairs(args) do
22 | appendedStr = appendedStr .. ' ' .. tostring(v)
23 | end
24 | local msgTemplate = '^3[txAdminMenu]^0%s^0'
25 | local msg = msgTemplate:format(appendedStr)
26 | print(msg)
27 | end
28 |
29 | CreateThread(function()
30 | debugModeEnabled = (GetConvar('txAdmin-menuDebug', 'false') == 'true')
31 | end)
32 |
--------------------------------------------------------------------------------
/monitor/resource/menu/server/sv_player_mode.lua:
--------------------------------------------------------------------------------
1 | --Check Environment
2 | if GetConvar('txAdminServerMode', 'false') ~= 'true' then
3 | return
4 | end
5 |
6 | local IS_PTFX_DISABLED = (GetConvar('txAdmin-menuPtfxDisable', 'false') == 'true')
7 |
8 | RegisterNetEvent('txAdmin:menu:playerModeChanged', function(mode, nearbyPlayers)
9 | local src = source
10 | if mode ~= 'godmode' and mode ~= 'noclip' and mode ~= 'none' then
11 | debugPrint("Invalid player mode requested by " .. GetPlayerName(src) .. " (mode: " .. (mode or 'nil'))
12 | return
13 | end
14 |
15 | local allow = PlayerHasTxPermission(src, 'players.playermode')
16 | TriggerEvent("txaLogger:menuEvent", src, "playerModeChanged", allow, mode)
17 | if allow then
18 | TriggerClientEvent('txAdmin:menu:playerModeChanged', src, mode, not IS_PTFX_DISABLED)
19 |
20 | if not IS_PTFX_DISABLED then
21 | for _, v in ipairs(nearbyPlayers) do
22 | TriggerClientEvent('txcl:syncPtfxEffect', v, src)
23 | end
24 | end
25 | end
26 | end)
27 |
--------------------------------------------------------------------------------
/monitor/entrypoint.js:
--------------------------------------------------------------------------------
1 | //NOTE: Due to fxs's node, declaring ANY variable in this file will pollute
2 | // the global scope, and it will NOT show in `Object.keys(global)`!
3 | // Hence why I'm doing some data juggling and duplicated function calls.
4 |
5 | //Check if running inside FXServer
6 | try {
7 | if (!IsDuplicityVersion()) throw new Error();
8 | } catch (error) {
9 | console.log('txAdmin must be run inside FXServer in monitor mode!');
10 | process.exit();
11 | }
12 |
13 | //Checking monitor mode and starting
14 | try {
15 | if (GetConvar('monitorMode', 'false') == 'true') {
16 | require('./core/index.js');
17 | } else if (GetConvar('txAdminServerMode', 'false') == 'true') {
18 | //Nothing, for now
19 | }
20 | } catch (error) {
21 | //Prevent any async console.log messing with the output
22 | process.stdout.write([
23 | 'e'.repeat(80),
24 | `Resource load error: ${error.message}`,
25 | error.stack.toString(),
26 | 'e'.repeat(80),
27 | ''
28 | ].join('\n'));
29 | }
30 |
--------------------------------------------------------------------------------
/monitor/docs/custom_serverlog.md:
--------------------------------------------------------------------------------
1 | # Logging Extra Data
2 |
3 | This feature allows you to add logging for custom commands like `/car` and `/tp`.
4 | To do that, you will need to edit the scripts of those commands to trigger a `txaLogger:CommandExecuted` event.
5 | > **Note: for now this only supports client commands!**
6 |
7 | ## How to Enable
8 |
9 | In the client script, add the following event call inside the command function:
10 |
11 | ```lua
12 | TriggerServerEvent('txaLogger:CommandExecuted', rawCommand)
13 | ```
14 |
15 | Where `rawCommand` is a variable containing the full command with parameters.
16 | You don't NEED to pass `rawCommand`, you can edit this string or pass anything you want.
17 |
18 | ## Example
19 |
20 | In this example, we will log data from the `/car` command from the `CarCommand` script.
21 |
22 | ```lua
23 | RegisterCommand('car', function(source, args, rawCommand)
24 | TriggerServerEvent('txaLogger:CommandExecuted', rawCommand) -- txAdmin logging Callback
25 |
26 | local x,y,z = table.unpack(GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 8.0, 0.5))
27 |
28 | -- there is more code here, no need to edit
29 | end)
30 | ```
31 |
--------------------------------------------------------------------------------
/monitor/resource/menu/server/sv_trollactions.lua:
--------------------------------------------------------------------------------
1 | --Check Environment
2 | if GetConvar('txAdminServerMode', 'false') ~= 'true' then
3 | return
4 | end
5 |
6 | RegisterNetEvent('txAdmin:menu:drunkEffectPlayer', function(id)
7 | local src = source
8 | local allow = PlayerHasTxPermission(src, 'players.troll')
9 | if allow then
10 | TriggerClientEvent('txAdmin:menu:drunkEffect', id)
11 | end
12 | TriggerEvent('txaLogger:menuEvent', src, 'drunkEffect', allow, id)
13 | end)
14 |
15 | RegisterNetEvent('txAdmin:menu:setOnFire', function(id)
16 | local src = source
17 | local allow = PlayerHasTxPermission(src, 'players.troll')
18 | if allow then
19 | TriggerClientEvent('txAdmin:menu:setOnFire', id)
20 | end
21 | TriggerEvent('txaLogger:menuEvent', src, 'setOnFire', allow, id)
22 | end)
23 |
24 | RegisterNetEvent('txAdmin:menu:wildAttack', function(id)
25 | local src = source
26 | local allow = PlayerHasTxPermission(src, 'players.troll')
27 | if allow then
28 | TriggerClientEvent('txAdmin:menu:wildAttack', id)
29 | end
30 | TriggerEvent('txaLogger:menuEvent', src, 'wildAttack', allow, id)
31 | end)
32 |
--------------------------------------------------------------------------------
/monitor/resource/menu/vendor/freecam/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Deltanic
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/monitor/resource/menu/client/cl_misc.lua:
--------------------------------------------------------------------------------
1 | -- =============================================
2 | -- This file contains misc stuff, maybe deprecate?
3 | -- =============================================
4 | if (GetConvar('txAdmin-menuEnabled', 'false') ~= 'true') then
5 | return
6 | end
7 |
8 | -- Consts
9 | SoundEnum = {
10 | move = 'NAV_UP_DOWN',
11 | enter = 'SELECT'
12 | }
13 |
14 | -- Audio play callback
15 | RegisterNUICallback('playSound', function(sound, cb)
16 | PlaySoundFrontend(-1, SoundEnum[sound], 'HUD_FRONTEND_DEFAULT_SOUNDSET', 1)
17 | cb({})
18 | end)
19 |
20 | -- Heals local player
21 | RegisterNetEvent('txAdmin:menu:healed', function()
22 | debugPrint('Received heal event, healing to full')
23 | local ped = PlayerPedId()
24 | local pos = GetEntityCoords(ped)
25 | local heading = GetEntityHeading(ped)
26 | if IsEntityDead(ped) then
27 | NetworkResurrectLocalPlayer(pos[1], pos[2], pos[3], heading, false, false)
28 | end
29 | SetEntityHealth(ped, GetEntityMaxHealth(ped))
30 | end)
31 |
32 | -- Tell the user he is an admin and that /tx is available
33 | AddEventHandler('playerSpawned', function()
34 | Wait(15000)
35 | if menuIsAccessible then
36 | sendMenuMessage('showMenuHelpInfo', {})
37 | end
38 | end)
39 |
--------------------------------------------------------------------------------
/monitor/resource/menu/client/cl_freeze.lua:
--------------------------------------------------------------------------------
1 | -- =============================================
2 | -- This file contains all player freeze logic
3 | -- =============================================
4 | if (GetConvar('txAdmin-menuEnabled', 'false') ~= 'true') then
5 | return
6 | end
7 |
8 | local function sendFreezeAlert(isFrozen)
9 | if isFrozen then
10 | sendPersistentAlert('freeze-status', 'warning', 'nui_menu.frozen.was_frozen', true)
11 | else
12 | clearPersistentAlert('freeze-status')
13 | end
14 | end
15 |
16 | RegisterNUICallback('togglePlayerFreeze', function(data, cb)
17 | local targetPlayerId = tonumber(data.id)
18 | if targetPlayerId == GetPlayerServerId(PlayerId()) then
19 | return sendSnackbarMessage('error', 'nui_menu.player_modal.actions.interaction.notifications.freeze_yourself', true)
20 | end
21 |
22 | TriggerServerEvent('txAdmin:menu:freezePlayer', targetPlayerId)
23 | cb({})
24 | end)
25 |
26 | RegisterNetEvent('txAdmin:menu:freezeResp', function(isFrozen)
27 | local localeKey = isFrozen and 'nui_menu.frozen.froze_player' or 'nui_menu.frozen.unfroze_player'
28 | sendSnackbarMessage('info', localeKey, true)
29 | end)
30 |
31 | RegisterNetEvent('txAdmin:menu:freezePlayer', function(isFrozen)
32 | debugPrint('Frozen: ' .. tostring(isFrozen))
33 | local playerPed = PlayerPedId()
34 | if IsPedInAnyVehicle(playerPed) then
35 | TaskLeaveAnyVehicle(playerPed, false, 16)
36 | end
37 | FreezeEntityPosition(playerPed, isFrozen)
38 | sendFreezeAlert(isFrozen)
39 | end)
40 |
--------------------------------------------------------------------------------
/monitor/docs/permissions.md:
--------------------------------------------------------------------------------
1 | ## Permission System
2 | The permission system allows you to control which admins can perform which actions.
3 | For instance you can allow one admin to only view the console and kick players, but not restart the server and execute arbitrary commands.
4 | The permissions are saved in the `txData/admins.json` file and can be edited through the *Admin Manager* page by the Master admin, or users with `all_permissions` or `manage.admins` permissions.
5 |
6 | ### Available Permissions
7 | - `all_permissions`: Root permission that allows the user to perform any action. When set, this will remove all other permissions;
8 | - `manage.admins`: Permission to create, edit and remove other admin accounts;
9 | - `settings.view`: Settings: View (no tokens);
10 | - `settings.write`: Settings: Change;
11 | - `console.view`: Console: View;
12 | - `console.write`: Console: Write;
13 | - `control.server`: Start/Stop/Restart Server;
14 | - `commands.resources`: Start/Stop Resources;
15 | - `server.cfg.editor`: Read/Write server.cfg;
16 | - `txadmin.log.view`: View txAdmin Log;
17 | - `menu.vehicle`: Spawn / Fix Vehicles;
18 | - `players.message`: Announcement / DM;
19 | - `players.whitelist`: Whitelist player;
20 | - `players.warn`: Warn player;
21 | - `players.kick`: Kick player;
22 | - `players.ban`: Ban player;
23 | - `players.heal`: Heal self or everyone;
24 | - `players.playermode`: NoClip / God Mode;
25 | - `players.spectate`: Spectate player;
26 | - `players.teleport`: Teleport self or player;
27 | - `players.trollmenu`: Troll Menu (*not yet available*);
28 | - `players.freeze`: Freeze a players ped;
--------------------------------------------------------------------------------
/monitor/docs/troubleshooting.md:
--------------------------------------------------------------------------------
1 | # Troubleshooting
2 |
3 | First and foremost check if you are using the most recent version of txAdmin and that you followed the installation instructions.
4 |
5 | ## Problems running txAdmin
6 | When executing txAdmin, it might show you some errors. Example of an [error](https://i.imgur.com/2huiyBf.png), example of a [successful startup](https://i.imgur.com/QLCBZBm.png).
7 |
8 | ### [txAdmin:AdminVault] Unable to load admins.
9 | If you get `cannot read file`, it means the admin file `txData/admins.json` doesn't exist or txAdmin doesn't have permission to read it.
10 | Any other error message means you somehow broke the admins file, delete it and restart txAdmin to generate a new one.
11 |
12 | ### [txAdmin:ConfigVault] Error: Unable to load configuration file `txData//config.json`
13 | The selected profile (or `default`) cannot be loaded due to permission issues (eg file owned by the root account), or due to broken JSON.
14 |
15 | ## Problems starting the server
16 | When you start txAdmin, your server will **not** start automatically (by default). Open the web panel and start txAdmin (actions > START Server). You can change this by enabling autostart in the settings page.
17 | If you are getting `FXServer is not responding!` it means the `txAdmin:Monitor` could not connect to the FXServer, causes:
18 | - FXServer is not responding to the TCP endpoint, this usually means some resource got stuck;
19 | - FXServer and txAdmin are on the same TCP port. In this case your server will not be able to listen to the configured port and the healthcheck will return a 404 error;
20 | - FXServer is not listening to the local interface.
21 |
22 |
23 |
24 | If this guide didn't help you, join our awesome [Discord server](https://discord.gg/AFAAXzq).
25 |
--------------------------------------------------------------------------------
/monitor/web/main/txAdminLog.ejs:
--------------------------------------------------------------------------------
1 | <%- await include('parts/header.ejs', locals) %>
2 |
3 |
12 |
13 |
4 |
5 | ## Instructions
6 |
7 | - Just Drag And Drop Just Go To Your The Location That Your FXServer Is And Replace The Monitor With Our Monitor
8 |
9 | ```citizen\system_resources\monitor```
10 |
11 |
12 |
13 | About It
14 |
Status
15 |
Tested
16 |
Not Updated
17 | Description: A QBCore Based Theme For TxAdmin Panel
18 | Credits: Marshy And IDKFORCE
19 | Download:Click Me!
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/monitor/web/public/js/codeEditor/mode/fivem-cfg.js:
--------------------------------------------------------------------------------
1 | // CodeMirror fivem-cfg syntax highlight
2 | // Written by Tabarra for https://github.com/tabarra/txAdmin
3 |
4 | CodeMirror.defineSimpleMode('fivem-cfg', {
5 | // The start state contains the rules that are intially used
6 | start: [
7 | // The regex matches the token, the token property contains the type
8 | {regex: /(["'])(?:[^\\]|\\.)*?(?:\1|$)/, token: 'string'},
9 |
10 | // Rules are matched in the order in which they appear, so there is
11 | // no ambiguity between this one and the one above
12 | {regex: /(?:start|stop|ensure|restart|refresh|exec|quit|set|seta|setr|sets)\b/i, token: 'def'},
13 | {regex: /(?:endpoint_add_tcp|endpoint_add_udp|load_server_icon|sv_authMaxVariance|sv_authMinTrust|sv_endpointPrivacy|sv_hostname|sv_licenseKey|sv_master1|sv_maxClients|rcon_password|sv_scriptHookAllowed|gamename|onesync|sv_enforceGameBuild)\b/i, token: 'keyword'},
14 | {regex: /(?:add_ace|add_principal|remove_ace|remove_principal|test_ace)\b/i, token: 'variable-2'},
15 | {regex: /banner_connecting|banner_detail|locale|steam_webApiKey|tags|mysql_connection_string|sv_projectName|sv_projectDesc/i, token: 'atom'},
16 | {regex: /0x[a-f\d]+|[-+]?(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i, token: 'number'},
17 | {regex: /\/\/.*/, token: 'comment'},
18 | {regex: /#.*/, token: 'comment'},
19 | {regex: /\/(?:[^\\]|\\.)*?\//, token: 'variable-3'},
20 |
21 | // A next property will cause the mode to move to a different state
22 | {regex: /\/\*/, token: 'comment', next: 'comment'},
23 |
24 | {regex: /[a-z$][\w$]*/, token: 'variable'},
25 | ],
26 |
27 | // The multi-line comment state.
28 | comment: [
29 | {regex: /.*?\*\//, token: 'comment', next: 'start'},
30 | {regex: /.*/, token: 'comment'},
31 | ],
32 | });
33 |
--------------------------------------------------------------------------------
/monitor/docs/feature_graveyard.md:
--------------------------------------------------------------------------------
1 | # Feature Graveyard
2 | In txAdmin codebase, we try to keep things lean, this is one of the few reasons after one year of project, our code base is not *that* bad.
3 | And as part of the process, we "retired" many features and parts of our code base, here is a relation of the majority of them and the reason why:
4 |
5 | - **Setup script:** Now everything is automatic when you start with a profile set in the convars;
6 | - **Admin add script:** Now its done via the master account creation UI flow, and the Admin Manager page;
7 | - **Config tester:** With the gained knowledge of the edge cases, it became way easier to implement better checks and actionable error messages on the settings page;
8 | - **Resources injector:** With the integration with FiveM, our plans for it changed drastically. It may or may not come back, meanwhile it was removed to prevent issues;
9 | - **Automatic cache cleaner:** This feature were created due to the vast number of requests, but in the end this "common knowledge" was based on misinformation, therefore it was removed since we don't actually need it;
10 | - **SSL support:** With the rework of the entire web layer of txAdmin in preparation with the FiveM integration, we ended up removing this (tricky to implement) feature. But don't worry, one of the benefits from the integration is that now we have the FiveM cfx.re reverse proxy, which by default supports HTTPS;
11 | - **Experiments:** Well... not much to experience with right now;
12 | - **Discord static commands:** I don't think anyone ever used it since they can do it with basically any other bot;
13 | - **Set process priority:** Although it was quite requested in the beginning, people just don't seem to use it;
14 | - **Menu Weed troll effect:** It was just too similar to the drunk effect one, not worth keeping.
15 |
16 | Don't cry because they are gone.
17 | Smile because they existed :)
18 |
--------------------------------------------------------------------------------
/monitor/web/public/css/codemirror_lucario.css:
--------------------------------------------------------------------------------
1 | .cm-s-lucario.CodeMirror, .cm-s-lucario .CodeMirror-gutters {
2 | background-color: #141414 !important;
3 | color: #f8f8f2 !important;
4 | border: none;
5 | }
6 | .cm-s-lucario .CodeMirror-gutters { color: #141414; }
7 | .cm-s-lucario .CodeMirror-cursor { border-left: solid thin #0db61b; }
8 | .cm-s-lucario .CodeMirror-linenumber { color: #ffffff; }
9 | .cm-s-lucario .CodeMirror-selected { background: #46494d; }
10 | .cm-s-lucario .CodeMirror-line::selection, .cm-s-lucario .CodeMirror-line > span::selection, .cm-s-lucario .CodeMirror-line > span > span::selection { background: #243443; }
11 | .cm-s-lucario .CodeMirror-line::-moz-selection, .cm-s-lucario .CodeMirror-line > span::-moz-selection, .cm-s-lucario .CodeMirror-line > span > span::-moz-selection { background: #243443; }
12 | .cm-s-lucario span.cm-comment { color: #e46c84; }
13 | .cm-s-lucario span.cm-string, .cm-s-lucario span.cm-string-2 { color: #ffffff; }
14 | .cm-s-lucario span.cm-number { color: #008d00; }
15 | .cm-s-lucario span.cm-variable { color: #f8f8f2; }
16 | .cm-s-lucario span.cm-variable-2 { color: #fdfdc6; }
17 | .cm-s-lucario span.cm-def { color: #dc143c; }
18 | .cm-s-lucario span.cm-operator { color: #66D9EF; }
19 | .cm-s-lucario span.cm-keyword { color: #a52a43; }
20 | .cm-s-lucario span.cm-atom { color: #e2506d; }
21 | .cm-s-lucario span.cm-meta { color: #f8f8f2; }
22 | .cm-s-lucario span.cm-tag { color: #f392e6; }
23 | .cm-s-lucario span.cm-attribute { color: #66D9EF; }
24 | .cm-s-lucario span.cm-qualifier { color: #72C05D; }
25 | .cm-s-lucario span.cm-property { color: #f8f8f2; }
26 | .cm-s-lucario span.cm-builtin { color: #72C05D; }
27 | .cm-s-lucario span.cm-variable-3, .cm-s-lucario span.cm-type { color: #ffb86c; }
28 |
29 | .cm-s-lucario .CodeMirror-activeline-background { background: #243443; }
30 | .cm-s-lucario .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
31 |
--------------------------------------------------------------------------------
/monitor/resource/sv_resources.lua:
--------------------------------------------------------------------------------
1 | -- =============================================
2 | -- Report all resource events to txAdmin
3 | -- =============================================
4 | --Check Environment
5 | if GetConvar('txAdminServerMode', 'false') ~= 'true' then
6 | return
7 | end
8 |
9 |
10 | local function reportResourceEvent(event, resource)
11 | -- print(string.format("\27[107m\27[30m %s: %s \27[0m", event, resource))
12 | PrintStructuredTrace(json.encode({
13 | type = 'txAdminResourceStatus',
14 | event = event,
15 | resource = resource
16 | }))
17 | end
18 |
19 |
20 | -- An event that is triggered when a resource is trying to start.
21 | -- This can be canceled to prevent the resource from starting.
22 | AddEventHandler('onResourceStarting', function(resource)
23 | reportResourceEvent('onResourceStarting', resource)
24 | end)
25 |
26 | -- An event that is triggered immediately when a resource has started.
27 | AddEventHandler('onResourceStart', function(resource)
28 | reportResourceEvent('onResourceStart', resource)
29 | end)
30 |
31 | -- An event that is queued after a resource has started.
32 | AddEventHandler('onServerResourceStart', function(resource)
33 | reportResourceEvent('onServerResourceStart', resource)
34 | end)
35 |
36 | -- A server-side event triggered when the refresh command completes.
37 | AddEventHandler('onResourceListRefresh', function(resource)
38 | reportResourceEvent('onResourceListRefresh', resource)
39 | end)
40 |
41 | -- An event that is triggered immediately when a resource is stopping.
42 | AddEventHandler('onResourceStop', function(resource)
43 | reportResourceEvent('onResourceStop', resource)
44 | end)
45 |
46 | -- An event that is triggered after a resource has stopped.
47 | AddEventHandler('onServerResourceStop', function(resource)
48 | reportResourceEvent('onServerResourceStop', resource)
49 | end)
50 |
51 | -- TODO: As soon as the server start, send full list of resources to txAdmin
52 | -- CreateThread(function()
53 | -- blabla
54 | -- end)
55 |
--------------------------------------------------------------------------------
/monitor/docs/translation.md:
--------------------------------------------------------------------------------
1 | # Translation Support
2 | txAdmin supports translation in over 25 languages for the in-game interface (menu/warn) and chat messages, as well as discord warnings.
3 |
4 |
5 | ## Custom locales:
6 | If your language is not available, or you want to customize the messages, create a `locale.json` file in inside the `txData` folder based on any language file found on [our repository](https://github.com/tabarra/txAdmin/tree/master/locale). Then go to the settings and select the "Custom" language option.
7 |
8 | The `$meta.humanizer_language` key must be compatible with the library [humanize-duration](https://www.npmjs.com/package/humanize-duration), check their page for a list of compatible languages.
9 |
10 |
11 | ## Contributing:
12 | We need the community help to translate, and keep the translations updated and high-quality.
13 | For that you will need to:
14 | - Make a custom locale file with the instructions above;
15 | - Name the file using the language code in [this page](https://www.science.co.il/language/Locale-codes.php);
16 | - The `$meta.label` must be the language name in English (eg `Spanish` instead of `Español`);
17 | - Do a [Pull Request](https://github.com/tabarra/txAdmin/pulls) posting a few screenshots of evidence that you tested what you changed in-game.
18 |
19 | > **Pro Tip:** To quickly test your changes, you can edit the `locale.json` file and then in the settings page click "Save Global Settings" again to see the changes in the game menu without needing to restart txAdmin or the server.
20 |
21 | > **Pro Tip2:** To make sure you didn't miss anything in the locale file, you can download the txAdmin source code, execute `npm i`, move the `locale.json` to inside the `txAdmin/locale` folder and run `npm run locale:diff`. This will tell you about missing or extra keys.
22 |
23 | > **Note:** The performance of custom locale for big servers may not be ideal due to the way we need to sync dynamic content to clients. So it is strongly encouraged that you contribute with translations in our GitHub so it gets packed with the rest of txAdmin.
24 |
25 |
--------------------------------------------------------------------------------
/monitor/resource/menu/server/sv_player_modal.lua:
--------------------------------------------------------------------------------
1 | --Check Environment
2 | if GetConvar('txAdminServerMode', 'false') ~= 'true' then
3 | return
4 | end
5 |
6 | -- =============================================
7 | -- This file is for general server side handlers
8 | -- related to actions defined within Menu's
9 | -- "Player Modal"
10 | -- =============================================
11 |
12 | RegisterNetEvent('txAdmin:menu:tpToPlayer', function(tgtId)
13 | local src = source
14 |
15 | if type(tgtId) ~= 'number' then
16 | return
17 | end
18 |
19 | local allow = PlayerHasTxPermission(src, 'players.teleport')
20 | local data = { x = nil, y = nil, z = nil, target = id }
21 |
22 | data.playerName = "unknown"
23 | -- More OneSync dependent code
24 | if allow then
25 | -- Check for routing bucket diff
26 |
27 | local tgtBucket = GetPlayerRoutingBucket(tgtId)
28 | local srcBucket = GetPlayerRoutingBucket(src)
29 |
30 | -- This isn't stored anywhere for reversion,
31 | -- as TP to player is typically a one sided operation
32 | if tgtBucket ~= srcBucket then
33 | SetPlayerRoutingBucket(src, tgtBucket)
34 | end
35 |
36 | -- ensure the player ped exists
37 | local ped = GetPlayerPed(tgtId)
38 | if ped then
39 | data.playerName = GetPlayerName(tgtId)
40 | local coords = GetEntityCoords(ped)
41 | data.x = coords[1]
42 | data.y = coords[2]
43 | data.z = coords[3]
44 | TriggerClientEvent('txAdmin:menu:tpToCoords', src, data.x, data.y, data.z)
45 | end
46 | end
47 |
48 | TriggerEvent('txaLogger:menuEvent', src, 'teleportPlayer', allow, data)
49 | end)
50 |
51 | RegisterNetEvent('txAdmin:menu:summonPlayer', function(id)
52 | local src = source
53 | if type(id) ~= 'number' then
54 | return
55 | end
56 | local allow = PlayerHasTxPermission(src, 'players.teleport')
57 | if allow then
58 | -- ensure the target player ped exists
59 | local ped = GetPlayerPed(id)
60 | if ped then
61 | local coords = GetEntityCoords(GetPlayerPed(src))
62 | TriggerClientEvent('txAdmin:menu:tpToCoords', id, coords[1], coords[2], coords[3])
63 | end
64 | end
65 | TriggerEvent('txaLogger:menuEvent', src, 'summonPlayer', allow, id)
66 | end)
67 |
--------------------------------------------------------------------------------
/monitor/web/standalone/404.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | 404 - txAdmin
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |