--Upgrade skills
Added an in house skill system, nests skills tables inside player metadata. This is convenient for us as data tied to player - no save logic/load logic required on our end. Tested in qbx/esx no issues. Given slapping *large* tables in this would be bad but this is tiny and useful.
This commit is contained in:
1 parent
cba16a1c31
commit
98451f023d
2 files changed
+88
-20
No files matched your search
@@ -1,23 +1,25 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
Skills = Skills or {}
|
||||
|
||||
local function warnUser()
|
||||
print("Currently only a few skill systems are supported by Community Bridge, you are using a resource that requires the skills module to be used.")
|
||||
end
|
||||
|
||||
---This will get the name of the Skills system being being used.
|
||||
---@return string
|
||||
Skills.GetResourceName = function()
|
||||
return "none"
|
||||
return "community_bridge"
|
||||
end
|
||||
|
||||
---This will get the skill level of the passed skill name.
|
||||
---This will get the skill level of the passed skill name. (returns 1 if not found)
|
||||
---@param skillName string
|
||||
---@return number
|
||||
---@return nil
|
||||
Skills.GetSkillLevel = function(skillName)
|
||||
warnUser()
|
||||
return 0
|
||||
if not skillName then return 0 end
|
||||
local plyrSkills = Framework.GetPlayerMetaData("community_bridge_skills")
|
||||
if not plyrSkills or not plyrSkills[skillName] then return 1 end
|
||||
return plyrSkills[skillName].level or 1
|
||||
end
|
||||
|
||||
-- RegisterCommand("getfishingLevel", function(source, args)
|
||||
-- local level = Skills.GetSkillLevel("fishing")
|
||||
-- print("Client Fishing Level issssssssss " .. level)
|
||||
-- end, false)
|
||||
|
||||
return Skills
|
||||
Reference in new issue
Block a user