sd-skills is a comprehensive and flexible skills script for FiveM, allowing you to add, manage, and track player skills, levels, and progress within your server.
Author: Samuel#0008
Discord: Join the Discord
Store: Click Here
- Download the latest release from the GitHub repository.
- Extract the downloaded file and rename the folder to
sd_skills. - Place the
sd_skillsfolder into your server'sresourcesdirectory. - Add
ensure sd_skillsto yourserver.cfgto ensure the resource starts with your server. - Import the provided SQL file (
run_me.sql) into your database to create the necessary tables.
You can use /skills to open the UI, this can be changed in the client/main.lua.
sd-skills provides a set of exported functions and events that allow you to manage player skills and XP. You can increase or decrease a player's XP, set their XP directly, and retrieve their current level and progress towards the next level.
To edit what skills are available and define what the level caps are for each of them, take a look at the skills.lua
The following functions are exported and can be used in your scripts:
-
GetPlayerXP(playerId, skillName)- Description: Retrieves a player's current XP in a specific skill.
- Parameters:
playerId(number): The player's server ID.skillName(string): The name of the skill.
- Returns:
- (number): The player's current XP in the specified skill.
-
GetPlayerLevelAndProgress(playerId, skillName)- Description: Retrieves a player's level and progress in a skill based on their current XP.
- Parameters:
playerId(number): The player's server ID.skillName(string): The name of the skill.
- Returns:
- (table) containing:
level(number): The player's current level in the skill.progress(number): The percentage progress towards the next level.
- (table) containing:
-
SetPlayerXP(playerId, skillName, xpAmount)- Description: Sets a player's XP in a specific skill.
- Parameters:
playerId(number): The player's server ID.skillName(string): The name of the skill.xpAmount(number): The new XP amount to set.
- Returns:
- None (This function does not return a value).
-
IncreasePlayerXP(playerId, skillName, amount)- Description: Increases a player's XP in a skill by a given amount.
- Parameters:
playerId(number): The player's server ID.skillName(string): The name of the skill.amount(number): The amount of XP to add.
- Returns:
- None (This function does not return a value).
-
DecreasePlayerXP(playerId, skillName, amount)- Description: Decreases a player's XP in a skill by a given amount.
- Parameters:
playerId(number): The player's server ID.skillName(string): The name of the skill.amount(number): The amount of XP to subtract.
- Returns:
- None (This function does not return a value).
Here's how you can use these exports in your scripts:
-- Get a player's current XP in a skill
local currentXP = exports['sd_skills']:GetPlayerXP(source, 'MINING')
print('Current Mining XP:', currentXP)
-- Increase a player's XP in a skill
exports['sd_skills']:IncreasePlayerXP(source, 'MINING', 150)
-- Decrease a player's XP in a skill
exports['sd_skills']:DecreasePlayerXP(source, 'LOCKPICKING', 50)
-- Set a player's XP in a skill directly
exports['sd_skills']:SetPlayerXP(source, 'FISHING', 5000)
-- Get a player's level and progress in a skill
local levelData = exports['sd_skills']:GetPlayerLevelAndProgress(playerId, 'CRAFTING')
print('Level:', levelData.level)
print('Progress:', levelData.progress .. '%')