Combat Log Detector

Commands, Exports & Events

Every command, export and event of Combat Log Detector, with what to pass, what you get back and an example.

View in store

Everything other resources can use to work with Combat Log Detector: chat commands, exports you can call from your own scripts, and events you can listen to or trigger.

Commands

Command

/combatlogtest

Creates a test panel at your position so you can see how it looks. The name is Config.TestCommand.Name.

Arguments

None.

Who can use it

Admins

Server exports

ServerExport

GetDrops

Lists the panels that are showing right now (players who left recently).

What you pass

Nothing.

What you get back

  • dropstable[]

    Each has id, coords (x, y, z), serverId, name, identifier, leftAt (time text), reason and hasAvatar.

Example

Lua
for _, drop in ipairs(exports.lg_combatlog:GetDrops()) do
    print(drop.name, drop.reason, drop.leftAt)
end
ServerExport

CreateDrop

Creates a panel at a player's current position, as if they had just left.

What you pass

  • sourcenumber

    The player's server id.

  • reasonstringoptional

    Text shown on the panel. Defaults to "Unknown".

  • secondsnumberoptional

    How long it stays. Defaults to Config.DropTTL.

What you get back

  • dropIdnumber | nil

    Id of the new panel, or nil if the player has no ped.

Example

Lua
local id = exports.lg_combatlog:CreateDrop(source, 'Manual', 120)
ServerExport

RemoveDrop

Removes one panel.

What you pass

  • dropIdnumber

    Id from CreateDrop or GetDrops.

What you get back

  • removedboolean

    false when no panel has that id.

Example

Lua
exports.lg_combatlog:RemoveDrop(id)
ServerExport

ClearDrops

Removes every panel.

What you pass

Nothing.

What you get back

Nothing.

Example

Lua
exports.lg_combatlog:ClearDrops()

Client exports

ClientExport

GetDrops

The panels this player currently knows about.

What you pass

Nothing.

What you get back

  • dropstable[]

    Same fields as the server export.

Events

ServerEventYou listen to it

lg_combatlog:server:dropCreated

Fired for every new panel, e.g. to send it to your own logs.

What you receive

  • droptable

    Same fields as an entry of GetDrops.

Example

Lua
AddEventHandler('lg_combatlog:server:dropCreated', function(drop)
    print(('%s left: %s'):format(drop.name, drop.reason))
end)
ClientEventYou listen to it

lg_combatlog:client:setDrops

Sent by the server to every player whenever the list of panels changes.

What you receive

  • dropstable[]

    The full current list.

Last updated