Server Side Exports
Working on this docs! [NOT FINISHED]
At the top of your server 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"]:getServerFunctions() 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 in pairs(Framework.getPlayers()) do
print(json.encode(player))
endFramework.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) then
TriggerClientEvent('chatMessage', player.src, player.dob)
else
TriggerClientEvent('chatMessage', source, "You are on in the framework")
end
end)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) then
TriggerClientEvent('chatMessage', player.src, player.discord)
else
local discord = Framework.getDiscord(source)
if(discord) then
TriggerClientEvent('chatMessage', source, discord)
else
TriggerClientEvet('chatMessage', source, "Your discord isnt linked")
end
end
end)Framework.getSteam()
There are two ways you can get someones discord. If they are logged in the framework. Use the Framework.getPlayer() otherwise Framework.getSteam(). Here is an example:
RegisterCommand('steam', 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) then
TriggerClientEvent('chatMessage', player.src, player.steam)
else
local steam = Framework.getSteam(source)
if(steam) then
TriggerClientEvent('chatMessage', source, steam )
end
end
end)Last updated