NAT2K15 Development
DiscordStoreConfigGithubStatus Page
  • NAT2K15 Documentation
  • Paid Scripts
    • FiveM Framework
      • 💻Choose your hosting
        • 💻Windows Hosting
          • 🛢️MySQL Installation (xampp)
          • 🛢️MySQL Connection String
          • 👨‍💻Installing Framework
        • 🐧Linux Hosting
          • 🛢️MySQL Installation
          • 🛢️MySQL Connection String
          • 👨‍💻Installing Framework
        • 🎮Panel Hosting
      • 📋Framework Addons
        • FiveM Scoreboard
        • ☎️Framework 911 (paid)
        • 📲NPWD X Framework
          • 📋Editing NPWD Config
          • 🧠Installing npwd-framework
      • ✒️Change Logs
      • ✍️Developers Usage
        • Client Side Exports
        • Server Side Exports
      • ❌Frequent Issues
    • Personal Vehicle V2
      • Discord Bot Token
      • Installing Dependency
      • Editing the Config
    • FiveM Discord Whitelist
      • Discord Bot Token
      • Edit the config
  • FiveM vMenu Modification
  • FiveM Vehicle & Weapon Management System
    • Installing Dependency
    • Configuration Guide
  • FiveM Admin Zone
  • Paid Bots
    • Ticket Bot V2
      • 💻Windows Hosting Guide
        • 🛢️MySQL Installation (xampp)
        • 👨‍💻Installing Node.js
    • Multi Server Control
      • 💻Windows Hosting Guide
        • 👨‍💻Installing Node.js
        • 🚂Starting The Bot
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Paid Scripts
  2. FiveM Framework
  3. Developers Usage

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))
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) 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)

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) then    
        TriggerClientEvent('chatMessage', source, "you are an admin your cool")
    else 
        TriggerClientEvent('chatMessage', source, "You are not an admin")
    end
end)

Framework.extractIdentifier()

Very usful function to extract all a players identifiers. Below a simple way to display someones identifier. Please note this also grabs ips as well.

RegisterCommand("extract", function(source, args, message)
    local everything = Framework.extractIdentifier(source)
    print(json.encode(everything); -- display everything
    print(everything.discord); -- display users discord

end)
PreviousClient Side ExportsNextFrequent Issues

Last updated 3 months ago

Was this helpful?

✍️