Bridge Framework
---@module[]
LGF.CoreThe LGF.Core module provides utility functions for interacting with player data based on the current framework used by the application. The supported frameworks include LEGACYCORE, es_extended, and qbx_core.
Bridge Common
LGF.Core:GetPlayer
Returns
- Returns the
PlayerDatabased on the current framework.
LGF.Core:GetJob
Returns
- Returns the
job Nameof the player.
LGF.Core:GetName
Returns
- Return the
full nameof the player.
LGF.Core:PlayerLoaded
Returns
- Returns
trueif player is loaded otherwhisefalse.
LGF.Core:GiveVehicle
Returns
- Returns
any.
LGF.Core:ManageAccount
Returns
- Returns
any.
LGF.Core:GetGender
Returns
- Returns the
genderof the player.
LGF.Core:GetIdentifier
Returns
- Return the
identifierof the player.
LGF.Core:GetGroup
Returns
- Returns the current
groupof the player.
Framework Events
LGF_Utility:PlayerLoaded
Description:
The LGF_Utility:PlayerLoaded event is triggered when a player successfully loads into the game. This indicates that the player's data has been initialized and is ready for interaction. The event returns all parameters relevant to the player, which may vary depending on the framework being used (e.g., LEGACYCORE, es_extended, or qbx_core).
Parameters:
The event can accept any number of parameters. The content of these parameters will depend on the specific framework detected at runtime. For instance:
- LEGACYCORE:
slot,playerdata,newPlayer. - es_extended: Could return
xPlayer,isNew,skinprovided by the framework. - qbx_core or qb-core: May provide custom player data relevant to those frameworks.
Example Usage
AddEventHandler("LGF_Utility:PlayerLoaded", function(...)
local FrameworkParams = {...} -- Collect all parameters into a table
print("Player loaded with FrameworkParams: ", json.encode(FrameworkParams))
-- Initialize player state or update the user interface here
end)LGF_Utility:PlayerUnloaded
Description:
The LGF_Utility:PlayerUnloaded event is triggered when a player logs out or disconnects from the game. This allows for necessary cleanup and state management related to the player's departure. The event does not return any parameters.
Parameters:
This event does not accept any parameters, enabling straightforward handling of player disconnections without the need for additional data.
Example Usage
AddEventHandler("LGF_Utility:PlayerUnloaded", function(...) ---??
print("Player is in Logout")
end)