question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Discussion]: Export driven developer API in monitor script

See original GitHub issue

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

  • What limitations should we establish for exposing internal methods & data?
  • Should we tie txAdmin player state directly into a state bag, or should we prevent undefined behavior by not allowing for this data to be directly mutated by a user?

This API’s structure and scope is not final and is open to feedback and comments from contributors and users.

Use Case

  • Enables implementation of #390 through export calls
  • Tie into menu state for correct handling of players (Ex. To check if a player has been frozen by a server moderator before modifying a ped’s state)

We encourage you share any use cases for exports that you may find useful

Additional Info

Proposed Examples:

--- An export returning whether a player has a given txAdmin permission
--- if the player has the 'all_permissions' flag, this function will always
--- return true.
--- @param playerSrc number|string The target player's server ID
--- @param permission string The permission to check against
local function doesPlayerHavePermission(playerSrc, permission)
  return PlayerHasTxPermission(playerSrc, permission)
end
exports('doesPlayerHavePermission', doesPlayerHavePermission)

--- Add an announcement using the in-game menu announcement
--- alerts.
--- @param msg string The announcement message to display
local function addAnnouncement(msg)
  TriggerClientEvent('txAdmin:receiveAnnounce', -1, msg)
end
exports('addAnnouncement', addAnnouncement)

See the following somewhat related issues #179, #436

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:55
  • Comments:24 (5 by maintainers)

github_iconTop GitHub Comments

12reactions
MonsterZockerHDcommented, Nov 24, 2021

Sup, so basically what I would need and probably many others too are functions for:

  • banning a player
  • kicking a player
  • warn a player
  • send stuff to server log easily, not something like (TriggerServerEvent('txaLogger:DebugMessage', 'Goats are ugly')

Banning a player Would be nice to have for Anticheats to trigger. Therefore, a function would need to contain: script-label (to identify the resource it's coming from more easily), player, reason

Kicking a player Would be nice to have for Anticheats to trigger too (And similar detection methods, like the ones included in some ESX-based scripts). Therefore, a function would need to contain: script-label (to identify the resource it's coming from more easily), player, reason

Warn a player Would be nice to have for Anticheats to trigger, in addition it could be useful for people using bad words in the chat or other similar stuff. : Therefore, a function would need to contain: script-label (to identify the resource it's coming from more easily), player, reason

and the most important function: Sending stuff to the log more easily. A function would need to contain the options: script-label (to identify the resource it's coming from more easily), player, message, category

Feel free to reply.

10reactions
DamonOnYTcommented, Mar 6, 2022

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


AddEventHandler('playerConnecting', function(name, setKickReason, deferrals)

// defferal stuff here

	local license = ExtractIdentifiers(src).license;
        local playtime = exports.txAdmin:GetPlaytime(license, "seconds")
 
 // I would use it to give an ace perm here,

// end defferal
end)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Export All Reports, In Bulk, Via PowerShell And API - Orion SDK
I "borrowed" KMSigma​'s PowerShell script, which exports the device templates, and converted it to export the reports. I take absolutely 0% of the...
Read more >
DevOps: REST API Execution Through Bash Shell Scripting
This is the first part of a paper proposing a framework that enables DevOps teams to issue REST API calls via bash shell...
Read more >
Discussions API - GitLab Documentation
Discussions are a set of related notes on: Snippets; Issues; Epics; Merge requests; Commits. This includes comments and threads and system notes.
Read more >
Monitor Apps Script use in your organization
You can view the actions people take on Apps Script projects with Drive log events reporting in the Admin console. Take the following...
Read more >
Monitoring your APIs - Postman Learning Center
Because they run Postman requests and scripts, collection-based monitors can be used to monitor APIs in a variety of ways. Here are some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found