Mads' Resource Documentation
  • 📺Youtube
  • 🤝Discord
  • ⭐Tebex
  • 👨‍💻GitHub
  • 👋Welcome!
  • General Info
    • ❓Questions and Answers
      • Is X script locked/encrypted?
      • I need support, where can I reach out?
      • How do I update my server artifacts?
      • How do I transfer a script from one account to another?
      • How do I set my game build?
    • ⚠️Common Problems
      • You lack the required entitlement
      • Failed to verify protected resource
      • Could not find dependency /assetpacks for resource
  • Resources
    • 🪑Sit Anywhere
      • Adding Custom Models
      • Falling Through the Map
      • Exports
      • Events
    • 🚁Helicopter Camera
      • Adding custom helicopters
      • Moving the UI above the minimap
      • Adding controller inputs
      • Controls
      • Exports
      • Events
    • 🚙Slash Tires
      • Exports
      • Events
    • 🕶️Stungrenade
      • Adding the Stungrenade as an item
      • Measures Against Cheaters
      • Exports
      • Events
    • 🪖CS Styled Killfeed
      • General Information
      • Exports - Client Side
      • Exports - Server Side
      • Examples
      • Adding Messages to the feed
      • Weapons List / Death Reasons
      • Changing the position if the killfeed
    • Crouch & Crawl
      • Exports
    • 🔫Taser Effect
    • 🔭Telescopes
    • 🩺Crutches
      • How to make the script compatible with ps-walkstyle
    • ⛽No Exploding Pumps
    • 👠Hookers
Powered by GitBook
On this page
  • Groups
  • Using the OverwriteNextDeath function
  1. Resources
  2. CS Styled Killfeed

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)
PreviousExports - Server SideNextAdding Messages to the feed

Last updated 1 year ago

🪖