Move the extracted folder into your resources directory.
Add the following line to your server.cfg:
ensure cas-metabolism
Restart your server.
You're good to go! 🎉
Exports
Client Side
getMetabolismValue
--@param metabolism string [stamina, hunger, thirst, stress, dirt, microphone, weather, drunk, horsehealth, horsestamina, health]
RegisterCommand("getMetabolismValue", function(metabolism)
local val = exports["cas-metabolism"]:getMetabolismValue(metabolism)
if val == nil then
return print("\27[31m[CAS-Metabolism] Invalid metabolism key: " .. metabolism .. "\27[0m")
end
if type(val) == "table" then
print("\27[32m[CAS-Metabolism] " .. metabolism .. ": inner: " .. val.inner .. ", outer: " .. val.outer .. "\27[0m")
else
print("\27[32m[CAS-Metabolism] " .. metabolism .. ": " .. val .. "\27[0m")
end
end)
setMetabolismValue
--@param metabolism string [stamina, hunger, thirst, stress, dirt, microphone, weather, drunk, horsehealth, horsestamina, health]
--@param value number [0-100] or table [inner, outer]
RegisterCommand("setMetabolismValue", function(metabolism, value)
if metabolism == nil then
return print("\27[31m[CAS-Metabolism] Metabolism is nil!\27[0m")
end
exports["cas-metabolism"]:setMetabolismValue(metabolism, value)
end)
Server Side
addXP
--@param amount number
--@param identifier string [steam, license, discord, xbl, live]
--@param source number [source]
RegisterCommand("addXP", function(source, args, rawCommand)
local amount = tonumber(args[1])
local identifier = args[2]
if (amount == nil) then
return print("\27[31m[CAS-Metabolism] Amount is nil!\27[0m")
end
if (identifier == nil) then
return print("\27[31m[CAS-Metabolism] Identifier is nil!\27[0m")
end
exports["cas-metabolism"]:addXP(amount, identifier, source)
end)
removeXP
--@param amount number
--@param identifier string
RegisterCommand("removeXP", function(source, args, rawCommand)
local amount = tonumber(args[1])
local identifier = args[2]
if (amount == nil) then
return print("\27[31m[CAS-Metabolism] Amount is nil!\27[0m")
end
if (identifier == nil) then
return print("\27[31m[CAS-Metabolism] Identifier is nil!\27[0m")
end
exports["cas-metabolism"]:removeXP(amount, identifier, source)
end)
getLevel
RegisterCommand("getuserlevel", function(source)
local src = source
local identifier = "steam:......."
local userLevel = exports["cas-metabolism"]:getLevel(identifier, source)
print("\27[32m[CAS-Metabolism] User level: " .. userLevel .. "\27[0m")
end)