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()whiletruedo Citizen.Wait(500)if Framework.isPlayerLoadedIn() thenprint("Player is loaded in")elseprint("Player is not loaded in")endendend)
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) thenTriggerEvent('chatMessage', "Your name is " .. player.char_name)elseTriggerEvent('chatMessage', "you are not loaded in via the framework")endend)
Framework.getAop()
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) thenlocal aop = Framework.getAop()if(aop) thenprint("The current AOP is " .. aop)elseprint("AOP has been disabled in the framework")endend)
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.