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 data
Here 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.
Command example
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)
Framework.DisplayHelpText()
This export will display the message on the top left of your screen.
RegisterCommand('showhelp', function(source, args, message)
Framework.DisplayHelpText("I need help")
end)
Framework.setHealth()
Very simple export that will set the players health. It will set the clients health to the amount provided.
Framework.setHealth(100)
Framework.setArmor()
Very simple export that will set the players armor. It will set the clients armor to the amount provided.