Gridbase
Paid releasesDime Skill Tree

Exports

Server and client exports for Dime Skill Tree

Exports

All exports for interacting with Dime Skill Tree from other resources.

These exports are from the dime_skilltree resource. For Dime Skills DLC integration exports, see Dime Skills Server Exports.


Dime Skills Integration Exports

These exports are provided by Dime Skills for the skill tree to use:


Skill Tree Events

Events fired by Dime Skills that the skill tree listens to:

dime_skills:onLevelUp

Fired when any skill levels up (server and client).

AddEventHandler('dime_skills:onLevelUp', function(src, eventData)
    -- eventData structure:
    -- {
    --     skillName = 'driving',
    --     oldLevel = 14,
    --     newLevel = 15,
    --     totalPoints = 150,
    --     pointsGained = 1,
    --     citizenID = 'ABC12345'
    -- }
    
    print(('Player %d gained %d skill tree points!'):format(src, eventData.pointsGained))
end)
RegisterNetEvent('dime_skills:onLevelUp', function(eventData)
    -- Same structure as server
    -- Use to update UI, show notifications, etc.
end)

dime_skills:nodeUnlocked

Fired when a tree node is unlocked (server and client).

AddEventHandler('dime_skills:nodeUnlocked', function(src, nodeId, nodeData)
    print(('Player %d unlocked node: %s'):format(src, nodeId))
    
    -- Check for specific nodes
    if nodeId == 'combat_master' then
        -- Grant achievement, etc.
    end
end)
RegisterNetEvent('dime_skills:nodeUnlocked', function(nodeId, nodeData)
    -- Play unlock animation, sound, etc.
    PlaySoundFrontend(-1, 'MEDAL_UP', 'HUD_MINI_GAME_SOUNDSET', true)
end)

Skill Tree Resource Exports

These exports are from the dime_skilltree resource itself:


Usage Examples

Gating Content

-- Server: Check before allowing action
RegisterNetEvent('crafting:attemptAdvanced', function()
    local source = source
    
    if not exports.dime_skilltree:hasNode(source, 'crafting_advanced') then
        return TriggerClientEvent('ox_lib:notify', source, {
            type = 'error',
            description = 'Requires "Advanced Crafting" node!'
        })
    end
    
    -- Allow crafting...
end)

Custom Node Effects

-- Register effects on resource start
CreateThread(function()
    -- Speed boost node
    exports.dime_skills:registerNodeEffect('survival_speed', function(src, data)
        local boost = data.value or 1.1
        Player(src).state:set('speedMultiplier', boost, true)
    end)
    
    -- Health boost node
    exports.dime_skills:registerNodeEffect('survival_health', function(src, data)
        local bonus = data.value or 25
        TriggerClientEvent('myresource:addMaxHealth', src, bonus)
    end)
    
    -- Ability unlock node
    exports.dime_skills:registerNodeEffect('combat_execute', function(src, data)
        TriggerClientEvent('myresource:unlockAbility', src, 'execute')
    end)
end)

Integrating with Other Resources

-- Check nodes for job application
exports('meetsJobRequirements', function(source, jobName)
    local requirements = {
        mechanic = { 'crafting_basic', 'crafting_advanced' },
        hitman = { 'combat_master', 'ranged_accuracy' },
    }
    
    local required = requirements[jobName]
    if not required then return true end
    
    for _, nodeId in ipairs(required) do
        if not exports.dime_skilltree:hasNode(source, nodeId) then
            return false
        end
    end
    
    return true
end)

UI Integration

-- Add skill tree button to your custom menu
RegisterNUICallback('openSkillTree', function(_, cb)
    exports.dime_skilltree:openUI()
    cb('ok')
end)

-- Show available points in HUD
CreateThread(function()
    while true do
        local available = exports.dime_skilltree:getAvailablePoints()
        if available > 0 then
            -- Show indicator that points are available
            SendNUIMessage({
                type = 'skillPointsAvailable',
                count = available
            })
        end
        Wait(5000)
    end
end)

Best Practices

  1. Cache node checks - Don't call hasNode every frame
  2. Use events - Listen for nodeUnlocked instead of polling
  3. Register effects early - Register node effects during resource start
  4. Handle missing nodes - Always check return values for nil
  5. Validate server-side - Don't trust client for unlock checks