-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discussion]: Export driven developer API in monitor script #442
Comments
As stated in the PR's description, none of the implementation details above are considered final and are open to suggestions |
Sup, so basically what I would need and probably many others too are functions for:
Banning a player Kicking a player Warn a player and the most important function: Feel free to reply. |
Yes, this would be so nice, since right now we have 3 possible ways that player can get banned
It would make it so easier to just have a server event like RegisterServerEvent('txadmin:events:banplayer') expire, if you enter never the ban will be permanent, but you also can have syntaxes like 1d 1h 1j 1w 1m and so on |
Playtime (Both Server & Client Hooks) I'd love to see something that would allow me to easily get the playtime of a player, both in seconds (if its recorded in such way) and also the displayed date. An example for a use case would be the following
|
+1 this. Would be great to get this data |
Uhm... yes PLEASE! |
Along with this I also suggest an API integration where the bot can come back with the status and connection info for the server (as of now I can add in the simple line of code to reply with the connection information. but would like to have it added where the API also returns with online/offline using a simple check of the server IP (I might be overthinking and thinking it maybe just something i can code into the bot to ping the IP address and have it return with online/offline.)) |
This could come in useful for a lot of things. Currently working on creating a website where administrators can have access to not only FiveM Features, but also for other administrative things. This would let me create a resource where I could push data via Pusher to my Laravel PHP server and get info about Players and the Server itself. Allowing me to log and use the information to my liking. Having it stored in one place is quite a big thing for me, as it allows administrators to work quicker and not having multiple accounts for different things. I get that I could already do this, but this API would make it so much easier for everyone. Having the ability to use txAdmin accounts for checking permission in game would make it also way easier to identify when and who used a command/event. And thus being able to log it into one place. |
I'm in a similar boat. We also have a custom admin panel for our staff and our players to trade vehicles with eachother, do administrative tasks or for staff to screenshot players screens/kick/ban etc. The main data I am looking to get from txAdmin is the Play time/session time and a REST API or exports to kick/ban players. |
In addition to this I (and probably many others) would also like to be able to request a player history (with their previous warns, bans, kicks, etc.). |
Would be good to add in:
For example: I also agree with the playertime export, can be used really well to catch hackers (money vs playtime) and show up on the loading screen (we currently use the players.json and read it each time a player joins to do this without tx having any export in) Thanks for your time |
Anything such as triggering a server event to restart such as txAdmin:RestartServer, allowing me to use a permission framework that would mean players with certain groups could trigger server restarts. Rather than relying on giving them perms via the cfg using identifiers. Would also make it dynamic, meaning I wouldn't have to restart the serve to allow people perms, nor give them access to the txAdmin menu entirely. |
All of these ideas would be awesome to add. Banning, kicking, warning, restarting, stopping, or starting resources, getting player info such as playtime and join date, as well as all player punishment history. |
Just a quick note here on the thread: We are not actively replying but we are 100% taking note of everything being requested. |
What data specifically are you looking to consume? @Dalrae1 |
I was thinking everything in the "diagnostics" tab, so:
General stuff like that @TasoOneAsia |
A lot of this data is already available through default APIs, in the same manner txAdmin retrieves this info. I'm concerned that such an abstraction would serve no purpose if it isn't only attainable through a txAdmin API. |
I don't know what data you're referring to, other than "Server Uptime" (Which would require a separate resource to reliably get) Though much of the information is possible to get, having a separate resource (Such as txAdmin), which already uses this information, to act as an API to retrieve it would be very convenient. Similar to the "baseevents" resource included in cfx-server-data |
@Dalrae1 Thanks; we'll keep this suggestion in mind. My hesitation for adding an abstraction of this sort is just that it further increases the API surface that we need to maintain actively. As you said, you can retrieve env information using a C# or JS resource implementation for the timebeing. If you'd like to retrieve the txAdmin version, you can use the following non-replicated ConVar Edit: At the end of the day, we would like to scope this API strictly to txAdmin functionality, and you can see how sys information abstraction of this sort does not fall under the scope of strictly tx functionality. |
Alright, that makes sense |
This would be awesome ❤ |
A MUST HAVE FEATURE <3 |
Is there any way to ban players automatically in tx via another resource currently? |
@JordanZABOT Nope. |
Is this, or anything else in this thread, something that you guys are working on, or might be added in the future? |
Can you please tell me more? Maybe link to get a hold of you regarding this? |
Playtime extraction example. Used ox.lib callback for it. --- Fetches the data from playerDB.json file
---@return string | nil -- or maybe table
local function getTxAdminData()
local file_path = 'C:\\{where_is_your_server_located}\\txData\\{profile_name}\\data\\playersDB.json'
local file = io.open(file_path, "r")
if not file then
print("Could not open file: " .. file_path)
retur
end
local file_content = file:read("*a")
file:close()
return file_content
end
---@param source number
---@return number
lib.callback.register('rn-core:server:GetPlayerPlayTime', function(source)
local name = QBCore.Functions.GetPlayer(source).PlayerData.name
local data = getTxAdminData()
if not data return 0 end
local t = json.decode(data)
for _, v in pairs(t.players) do
if v.displayName == name then
return v.playTime
end
end
return 0
end) |
That's exactly what I did, the problem is that our playersDB.json is 12.9MB, causing a huge threadhitch. I actually just coded almost exactly what you have just last night lmao.
|
Yes, that is why i scrapped the whole thing. Well i wrote a server side script for playtime counting. Basically save the login time, and when the player exits then substract the two values then store it in the sql. |
Hello, it would be cool to get any export to check if a player/player identifier is banned or not. |
You should design an API that serves as a powerful tool for RP servers, enabling staff members to efficiently manage user-related actions and monitor server activity directly from their custom websites, streamlining administrative tasks and enhancing the overall server management experience. I've provided an example below of super useful information. Endpoints:1. User Information:
2. Actions:
Authentication and Authorisation:
Integration and Extensibility:
Documentation and Support:
|
This should be done ASAP <3 i completely agree, this would change the way we moderate, follow and develop moderation tools for your servers |
Just adding my idea: I'd like to dynamically add new admin accounts (and remove admin accounts) from a management platform. We'r using Gitlab for our Script Hosting, Discord Roles for in-game permissions and discord permissions and the txAdmin account for additional features like noclip and stuff. I'd like to create a management platform where i create the users accounts and the platform will then proceed and assign the required roles in discord, create a txadmin account and assign the required gitlab projects to the account, add the account to the grafana org, ... (and many more, just the beginning). The point in doing smth like this: If a Admin leaves the team i dont want to delete the users everywhere. Currently i have a check list for me in case a team member leaves so no permissions will be left. (like blocking the user in the SSO server, blocking the gitlab access, removing the txAdmin user, revoking the discord roles, setting the user group of ESX back to user, ....) For everything i can use APIs but not txAdmin so far :D My proposal for this would look smth like this:
{
"username": "SeaLife",
"discord": 1,
"fivem": "SeaLife",
"permissions": ["all_permissions"]
} And removing a user by its username:
Regards |
@SeaLife For admin management, I would prefer to use some standard protocol... but there are so many, and most are old ugly legacy enterprise protocols. |
Hi Tabarra, is there any apis open yet for stop/start ect?
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: tabarra ***@***.***>
Sent: Saturday, March 30, 2024 10:45:19 AM
To: tabarra/txAdmin ***@***.***>
Cc: roobr ***@***.***>; Comment ***@***.***>
Subject: Re: [tabarra/txAdmin] [Discussion]: Export driven developer API in monitor script (#442)
@SeaLife<https://github.com/SeaLife> For admin management, I would prefer to use some standard protocol... but there are so many, and most are old ugly legacy enterprise protocols.
—
Reply to this email directly, view it on GitHub<#442 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACFFR7PEGULKWMVVEXFDWLLY2X4I7AVCNFSM5DXZ4LEKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBSG44DENJXHE3Q>.
You are receiving this because you commented.Message ID: ***@***.***>
|
I'd definitely be adding a function to our discord bot, allowing us to ban people in discord and txadmin at the same time. Would need: API URL: Would be muchly appreciated! |
I'd really appreciate seeing Things like: |
@IkonoDim The features you are requesting don't make much sense... you trying to replace the txAdmin ui?! |
@tabarra No. But here's a tittle explaination about how I'd use each of these features:
|
Our goal is to automate server updates, which would significantly streamline our workflow. The plan is to have a test server updated daily and the main server on a weekly basis, each tied to their respective Git branches. A REST API would facilitate this process, allowing server management through endpoints like https://{server_ip}:{port}/api/v1/shutdownServer, with secure authentication via Bearer Token or User + Password. The challenge lies in ensuring TxAdmin remains operational during updates, which it isn’t if we need to shutdown FxServer in order to do this. Also we can’t update while FxServer is running as this led to data corruption in earlier attempts. |
Hey, so we'r running a Pipeline with Gitlab CI for our scripts which works very well. The "Production" Server is restarted everyday at 10am. The Development-Server is restart every morning at 4am. With TxAdmin if you want to "restart" your Server from external, you could just "stop" the server by the console command "quit" and txAdmin will reboot it. (Is kinda klunky, but it works). We'r doing that on our pre-live server when updating ESX. (because ESX cant be restarted without konsequencens) But, we'r running some custom pipeline scripts for this and our configuration for something like ESX looks like that:
So you dont really need a restart API to do a restart if thats the only thing you care about. |
Thanks @SeaLife for telling me this! Is there any way to then listen for when the Server is started again? |
Not as far as i know, but you could use a RCON library and check if the server responds to the RCON command as a workaround. |
Hey everyone, an API is finally on the works!Very soon I'm starting the planning for the API, but no ETA on delivery just yet. |
Scope
Developer API
Feature Description
Summary
Provide a public API for third party resources to trigger methods or fetch useful data within txAdmin.
API Scope
This export API should be limited mainly to txAdmin Game Script related functionality defined in the
scripts
folder. No relaying of data should be done through game scripts as a means of communicating with the txAdmin backend.Possible Concerns
This API's structure and scope is not final and is open to feedback and comments from contributors and users.
Use Case
We encourage you share any use cases for exports that you may find useful
Additional Info
Proposed Examples:
See the following somewhat related issues #179, #436
The text was updated successfully, but these errors were encountered: