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.getPlayers()
Using this export you will be able to get all the active players with all their character info and print it. here is an exmaple
for _, player inpairs(Framework.getPlayers()) doprint(json.encode(player))end
Framework.getPlayer()
Using this export you can get any player as long as they are in the server and logged in.
RegisterCommand("dob", function(source,args,message)local player = Framework.getPlayer(source)if(player) thenTriggerClientEvent('chatMessage', player.src, player.dob)elseTriggerClientEvent('chatMessage', source, "You are on in the framework")endend)
Framerwork.getDiscord()
There are two ways you can get someones discord. If they are logged in the framework. Use the Framework.getPlayer() otherwise Framework.getDiscord(). Here is an example
RegisterCommand('discord', function(source,args,message) local player = Framework.getPlayer(source)-- If the player isn't online in the framework it will use the native way.if(player) thenTriggerClientEvent('chatMessage', player.src, player.discord)elselocal discord = Framework.getDiscord(source)if(discord) thenTriggerClientEvent('chatMessage', player.src, discord)elseTriggerClientEvet('chatMessage', source, "Your discord isnt linked")endendend)
Framework.checkAdmin()
To check if a user is an admin is very simple. This will also check if they are logged into the framework. here is an exmaple
RegisterCommand('checkadmin', function(source,message,args) if(Framework.checkAdmin(source) thenTriggerClientEvent('chatMessage', source, "you are an admin your cool")elseTriggerClientEvent('chatMessage', source, "You are not an admin")endend)