Client Exports
Client-side exports for Dime Skills
Client Exports
All client-side exports for interacting with Dime Skills.
getSkill
Returns the skill data for a specific skill.
exports.dime_skills:getSkill(skill)Parameters
Prop
Type
Returns
table | nil: Skill data object ornilif skill doesn't exist
Skill Data Structure:
Prop
Type
Example
local shootingSkill = exports.dime_skills:getSkill('shooting')
if shootingSkill then
print('Level:', shootingSkill.level)
print('XP:', shootingSkill.xp)
else
print('Skill not found')
endUsage
Use this export to:
- Check player's current skill levels
- Display skill information in custom UIs
- Create skill-based restrictions
- Reward players based on skill levels
getSkillName
Returns the display name (label) for a specific skill.
exports.dime_skills:getSkillName(skill)Parameters
skill(string): The skill name/identifier
Returns
string | nil: The skill's display label ornilif not found
Example
local skillLabel = exports.dime_skills:getSkillName('crafting')
print(skillLabel) -- Output: "Engineering"
-- Use in notifications
local name = exports.dime_skills:getSkillName('driving')
lib.notify({
title = 'Skill Progress',
description = ('You improved your %s skill!'):format(name)
})Usage
Use this export to:
- Get user-friendly skill names
- Display proper labels in custom UIs
- Create localized skill references
getOxygen
Returns the player's maximum oxygen capacity based on diving skill.
exports.dime_skills:getOxygen()Parameters
None
Returns
number: Maximum oxygen time in seconds
Example
local maxOxygen = exports.dime_skills:getOxygen()
print('Max underwater time:', maxOxygen, 'seconds')
-- Use for custom diving systems
CreateThread(function()
while IsPedSwimmingUnderWater(PlayerPedId()) do
local oxygen = exports.dime_skills:getOxygen()
-- Your custom oxygen display logic
Wait(1000)
end
end)Usage
Use this export to:
- Display oxygen capacity in custom UIs
- Create custom diving mechanics
- Integrate with other underwater systems
Oxygen capacity is automatically calculated based on diving skill level and whether the player has scuba gear.
handleDiving
Configures diving parameters based on whether the player has a scuba tank.
exports.dime_skills:handleDiving(hasTank)Parameters
hasTank(boolean): Whether player is using scuba gear
Returns
None
Example
-- Player equips scuba gear
RegisterNetEvent('myresource:equipScuba', function()
exports.dime_skills:handleDiving(true)
end)
-- Player removes scuba gear
RegisterNetEvent('myresource:removeScuba', function()
exports.dime_skills:handleDiving(false)
end)Behavior
With Tank (true):
oxygen = (diving_level * 1.5) + 60Without Tank (false):
oxygen = (diving_level * 1.5) + 10Usage
Call this export when:
- Player equips/unequips scuba gear
- Diving equipment state changes
- Switching between diving modes
Don't call this in a loop. Only trigger when equipment state actually changes.
setupDiving
Initializes diving skill effects without scuba gear.
exports.dime_skills:setupDiving()Parameters
None
Returns
None
Example
-- Called automatically on player login
-- Manual call if needed:
RegisterNetEvent('myresource:resetDiving', function()
exports.dime_skills:setupDiving()
end)Usage
This export is automatically called on player login. You typically don't need to call it manually unless:
- Resetting diving parameters
- Recovering from errors
- Custom diving system integration
viewSkills
Opens the skills UI showing another player's skills.
exports.dime_skills:viewSkills(serverid)Parameters
serverid(number): Target player's server ID
Returns
None
Example
-- View target player's skills
local targetPlayer = GetPlayerServerId(PlayerId())
exports.dime_skills:viewSkills(targetPlayer)
-- In a command
RegisterCommand('viewskills', function(source, args)
local targetId = tonumber(args[1])
if targetId then
exports.dime_skills:viewSkills(targetId)
end
end)
-- With ox_target
exports.ox_target:addGlobalPlayer({
{
name = 'view_skills',
label = 'View Skills',
icon = 'fa-solid fa-chart-line',
onSelect = function(data)
exports.dime_skills:viewSkills(data.entity)
end
}
})Permissions
You may want to add permission checks:
-- Example with framework check
local function canViewSkills()
-- Add your permission logic
return true -- or false based on job, etc.
end
if canViewSkills() then
exports.dime_skills:viewSkills(targetId)
endUsage
Use this export for:
- Admin tools to inspect player skills
- Roleplay scenarios (showing credentials)
- Social features (comparing skills)
- Job applications (verifying qualifications)
openUI
Opens the skills UI for the local player.
exports.dime_skills:openUI()Parameters
None
Returns
None
Example
-- Simple command
RegisterCommand('myskills', function()
exports.dime_skills:openUI()
end)
-- With custom keybind
RegisterKeyMapping('openskills', 'Open Skills Menu', 'keyboard', 'F7')
RegisterCommand('openskills', function()
exports.dime_skills:openUI()
end)
-- From another resource
exports.dime_skills:openUI()Usage
Use this export to:
- Create custom commands for opening skills
- Integrate with custom menus/UIs
- Add skill menu to radial menus
- Create alternative keybinds
The default keybind (U) and command (/skills) are already configured. This export is for additional access points.
loadPlayer
Loads and initializes player skill data from the server.
exports.dime_skills:loadPlayer()Parameters
None
Returns
None
Example
-- Typically called automatically on player spawn
-- Manual call if needed:
RegisterNetEvent('myframework:playerLoaded', function()
exports.dime_skills:loadPlayer()
end)Behavior
This export:
- Fetches player skills from server
- Loads server configuration
- Initializes built-in skill effects (stamina, diving, etc.)
- Sends locales to UI
- Updates UI with skill data
Usage
This is automatically called when the player spawns. You typically don't need to call it manually unless:
- Custom character selection system
- Reloading after errors
- Framework integration requires manual loading
Calling this multiple times may cause issues. Only use when necessary.
skillNotify
Triggers a skill notification showing XP gain or loss.
exports.dime_skills:skillNotify(data)Parameters
data(table): Notification data object
Data Structure:
{
skillName = 'Engineering', -- Skill display name
oldLevel = 5, -- Previous level
newLevel = 6, -- New level
oldPoints = 450.0, -- Previous XP
newPoints = 50.0, -- New XP (may wrap to next level)
oldProgress = 75.0, -- Previous progress %
newProgress = 8.3, -- New progress %
change = true, -- true = gain, false = loss
icon = 'tools', -- FontAwesome icon
iconColor = '#3B82F6' -- Hex color (optional)
}Returns
None
Example
-- Typically called by server events
-- Manual call for custom notifications:
exports.dime_skills:skillNotify({
skillName = 'Engineering',
oldLevel = 5,
newLevel = 5,
oldPoints = 400,
newPoints = 450,
oldProgress = 66.7,
newProgress = 75.0,
change = true,
icon = 'tools'
})Notification Types
UI Mode (skillNotify = 'UI'):
- Shows elegant popup with skill info
- Displays XP change amount
- Shows progress bar
- Auto-dismisses after timeout
ox_lib Mode (skillNotify = 'ox_lib'):
- Standard ox_lib notification
- Contains skill name and level
- Shows XP values
- Includes icon if provided
Usage
This is automatically triggered by server when skills change. Manual usage for:
- Custom skill systems
- Testing notifications
- Special event notifications
Players can toggle notifications off using the configured command (default: /togglenotifyskills)
Usage Examples
Skill-Based Restrictions
-- Check if player has required skill level
local function canCraftItem(requiredSkill, requiredLevel)
local skill = exports.dime_skills:getSkill(requiredSkill)
if not skill then
return false, 'Skill not found'
end
if skill.level < requiredLevel then
local skillName = exports.dime_skills:getSkillName(requiredSkill)
return false, ('Requires %s level %d'):format(skillName, requiredLevel)
end
return true
end
-- Usage
local canCraft, message = canCraftItem('crafting', 10)
if canCraft then
-- Allow crafting
else
lib.notify({ type = 'error', description = message })
endCustom Skill Display
-- Create custom skill display
local function showSkillsInChat()
local skills = {'shooting', 'driving', 'strength'}
for _, skillName in ipairs(skills) do
local skill = exports.dime_skills:getSkill(skillName)
local label = exports.dime_skills:getSkillName(skillName)
if skill and label then
print(('%s: Level %d (%d XP)'):format(label, skill.level, skill.xp))
end
end
end
RegisterCommand('myskills', showSkillsInChat)Diving Integration
-- Full diving system integration
local hasScuba = false
RegisterNetEvent('inventory:client:ItemBox', function(item, type)
if item.name == 'diving_gear' then
if type == 'add' then
hasScuba = true
exports.dime_skills:handleDiving(true)
elseif type == 'remove' then
hasScuba = false
exports.dime_skills:handleDiving(false)
end
end
end)
-- Display oxygen in custom UI
CreateThread(function()
while true do
if IsPedSwimmingUnderWater(PlayerPedId()) then
local maxOxygen = exports.dime_skills:getOxygen()
-- Update your UI with oxygen info
end
Wait(1000)
end
end)Best Practices
- Cache Skill Data: Don't call
getSkillin loops - Error Handling: Always check for
nilreturns - Performance: Use exports wisely, avoid constant calls
- User Experience: Show friendly skill names from
getSkillName - Notifications: Let players control notification preferences
Related
- Server Exports - Server-side functions
- Client Events - Client events
- Configuration - Config options