Examples

Groups

Creating Groups

There are two ways to add groups, one is to add all the attributes on creation, and the other is to add/change them individually whenever needed.

exports.killfeed:CreateGroup("supporter", { colour = { r = 220, g = 180, b = 0 }, tag = "[SUPPORTER] ", tagColour = { r = 190, g = 160, b = 0 } })

This will do the same as above:

exports.killfeed:CreateGroup("supporter")
exports.killfeed:SetGroupAttribute("supporter", "colour", { r = 220, g = 180, b = 0 })
exports.killfeed:SetGroupAttribute("supporter", "tag", "[SUPPORTER] ")
exports.killfeed:SetGroupAttribute("supporter", "tagColour", { r = 190, g = 160, b = 0 })

Adding Players

Adding players is pretty simple, just trigger the AddPlayerToGroup function.

AddEventHandler("framework:gangs:onGangChange", function(playerId, gang)
    exports.killfeed:AddPlayerToGroup(playerId, gang)
end)

Removing Players

Expanding on the previous example:

AddEventHandler("framework:gangs:onGangChange", function(playerId, gang)
    local group = exports.killfeed:GetPlayerGroup(playerId)
    if group then
        exports.killfeed:RemovePlayerFromGroup(playerId, group)
    end
    exports.killfeed:AddPlayerToGroup(playerId, gang)
end)

Using the OverwriteNextDeath function

OverwriteNextDeath is a client-side function that is used to overwrite the next death, this should be used when a script kills the player, for example when they starve to death etc.

If you don't overwrite the next death and kill them through a script it'll display as if they fell to death (GTA does this).

Example:

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(1000)
        if hunger > 0 then
            hunger = hunger - 100
        else
            local playerPed = PlayerPedId()
            local health = GetEntityHealth(playerPed)
            if health <= 10 then
                exports.killfeed:OverwriteNextDeath('starvation')
                SetEntityHealth(playerPed, 0)
            else
                SetEntityHealth(playerPed, health - 10)
            end
        end
    end
end)

Last updated