-
Notifications
You must be signed in to change notification settings - Fork 651
Open
Labels
discussionA discussion based issueA discussion based issueenhancementNew feature or requestNew feature or requestmenu
Description
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 Suggestion: Timed Announcements/Chat Messages #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)TasoOneAsia, GrapsZ, AvarianKnight, PegosStelios, kotzeimer and 64 moreJaccosf, TasoOneAsia, AvarianKnight, PegosStelios, nicxes and 8 moreTasoOneAsia, GrapsZ, AvarianKnight, kotzeimer, eXahostCOM and 8 moreTasoOneAsia, GrapsZ, AvarianKnight, PegosStelios, kotzeimer and 18 more
Metadata
Metadata
Assignees
Labels
discussionA discussion based issueA discussion based issueenhancementNew feature or requestNew feature or requestmenu