Client Side Exports
This docs is fairly new does not have all of the export we provide please be patient while we slowly work on this.
At the top of your client file. You will need to call the Framework's exports. This step is very crucial for all the exports to work properly.
Framework = exports["framework"]:getClientFunctions() The "framework" will be the folder name the FiveM owner has in its resource. We recommend making this option configurable as not all users will have the default folder called framework.
Framework.isPlayerLoadedIn()
This will check if the player is fully loaded in to a character. It will return either a false or true here is an example.
Citizen.CreateThread(function()
while true do
Citizen.Wait(500)
if Framework.isPlayerLoadedIn() then
print("Player is loaded in")
else
print("Player is not loaded in")
end
end
end)Framework.getPlayer(Framework.serverId)
In the client side you can only request the clients data. We have disabled the option to allow you to request any users data as it should all be done on the server side. To simply request the data do
local player = Framework.getPlayer(Framework.serverId)
print(json.encode(player)) -- this will print all of the users dataHere is an example of it working in a command
RegisterCommand("whatsmyname", function(source, args, message)
local player = Framework.getPlayer(Framework.serverId)
if(player) then
TriggerEvent('chatMessage', "Your name is " .. player.char_name)
else
TriggerEvent('chatMessage', "you are not loaded in via the framework")
end
end)Framework.getCurrentAop()
Will return the current AOP you have in the server. If the AOP is disabled in the framework it will return a nil value.
RegisterCommand("getcurrentaop", function(source, args, message) then
local aop = Framework.getAop()
if(aop) then
print("The current AOP is " .. aop)
else
print("AOP has been disabled in the framework")
end
end)Framework.ShowInfo()
If you want to show text on the bottom left of the screen above the hud you can now simply do that with this export
RegisterCommand('showinfo', function(source, args, message)
Framework.ShowInfo("This is a test message")
end)
Last updated
