Skip to content
Twiitchter edited this page Oct 8, 2021 · 10 revisions

_affiliation.lua


Contents


Contains a relationship table based on the default groups, plus any additional custom groups you may manage, to then iterate over in loops to set aggression, peace or other factors.


c.affil.GetGroups()

--- Returns Groups after merging the default and Newly created groups.
function c.affil.GetGroups()
    local newgroups = c.table.merge(groups, defaultgroups)
    return newgroups
end

c.affil.AddGroupToTable(name, grouphash, relations)

--- [Internal Function] - Add the created group to a table.
---@param name string "Name of group : 'NAME'"
---@param grouphash string "Hash number of the group, typically starts with: '0x'"
---@param relations table "'Table of relations to iterate over : {["Companion"] = {}, ["Respect"] = {}, ["Like"] = {}, ["Nutral"] = {}, ["Dislike"] = {}, ["Hate"] = {}}'"
function c.affil.AddGroupToTable(name, grouphash, relations)
    if not groups[name] then
        groups[name] = {["hash"] = grouphash, ["relations"] = relations} 
    end
end

c.affil.CreateGroup(name, relations)

--- Returns the cappitalized name as entered and hash of the new group.
---@param str string "Can be lower case, will convert to UPPERCASE"
---@param relations table "'Table of relations to iterate over : {["Companion"] = {}, ["Respect"] = {}, ["Like"] = {}, ["Nutral"] = {}, ["Dislike"] = {}, ["Hate"] = {}}'"
function c.affil.CreateGroup(str, relations)
    local name = c.check.String(string.upper(str))
    local _, grouphash = AddRelationshipGroup(name)
    c.affil.AddGroupToTable(name, grouphash, relations)
    return name, grouphash
end

_animations.lua


Contents


Provides a few premade animations as an example, registered to event, bound to command within _commands.lua.


_anti.lua


_blips.lua


_callbacks.lua


_cameras.lua


_commands.lua


_data.lua


_death.lua


_decorators.lua


_doors.lua


_events.lua


_functions.lua


_items.lua


_markers.lua


_modifiers.lua


_nui.lua


_status.lua


_text.lua


_time.lua


Contents


c.time.GetTime()


Gets the time set by the server, leveraging convar "Time" Note - "Server Time" is the convar for the real time of the server where is hosted, Pre being altered.


--- Get the current server time based on the GetConvar("Time").
function c.time.GetTime()
    local time = GetConvar("Time", "00:00")
    local hour = tonumber(time:sub(1,2))
    local min = tonumber(time:sub(4,5))
    return {hour, min}
end

c.time.UpdateTime()


This alters a local variable that is then used on a loop to set the time constantly. I used to leverage a set milliseconds per minute native. But it stopped working at some point... to test out again eventually.


-- Set a timeout loop to request the time again.
function c.time.UpdateTime()
    time = c.time.GetTime()
    local function Do()
        time = c.time.GetTime()
        SetTimeout(c.min, Do)
    end
    SetTimeout(c.min, Do)
end

_var.lua


client.lua