Framework Events API

C7 Framework V3 provides server and client events that fire whenever a player loads or unloads a character.

These events allow developers to integrate jobs, inventories, HUDs, and other systems that depend on character data.

All events below are triggered automatically by the framework.

Player Load Events

1

C7FW:PLAYER_LOADED

Triggered when a player finishes selecting a character and has fully loaded into the game world.

chevron-rightWhat this event can be used for:hashtag

This is the main entry point for loading:

  • jobs

  • inventories

  • HUD systems

  • duty systems

  • character-based data

chevron-rightServer Event:hashtag

Event Name

C7FW:PLAYER_LOADED

Arguments

Name
Type
Description

src

number

Player server ID

character

table

Character data table

Example

AddEventHandler("C7FW:PLAYER_LOADED", function(src, character)
    print(("[C7FW] Player %s loaded character %s %s"):format(
        src,
        character.char_first_name,
        character.char_last_name
    ))

    -- Load job systems
    -- Give duty items
    -- Initialize inventory
end)
chevron-rightClient Event:hashtag

Event Name

C7FW:PLAYER_LOADED

Arguments

Name
Type
Description

character

table

Character data table

Example

AddEventHandler("C7FW:PLAYER_LOADED", function(character)
    print("Character loaded:", character.char_first_name, character.char_last_name)

    -- Enable HUD
    -- Hide loading UI
    -- Start client systems
end)
2

C7FW:PLAYER_UNLOADED

chevron-rightWhat this event can be used for:hashtag

Triggered whenever a character is unloaded, including:

  • Player disconnect

  • Character switch

  • Character deletion

  • Resource restart

  • Forced cleanup

This ensures all external systems can safely shut down.

chevron-rightServer Event:hashtag

Event Name

C7FW:PLAYER_UNLOADED

Arguments

Name
Type
Description

src

number

Player server ID

character

table

Character data table

Example

AddEventHandler("C7FW:PLAYER_UNLOADED", function(src, character)
    print(("[C7FW] Player %s unloaded %s %s"):format(
        src,
        character.char_first_name,
        character.char_last_name
    ))

    -- Stop duty timers
    -- Save custom data
    -- Cleanup inventory
end)
chevron-rightClient Event:hashtag
AddEventHandler("C7FW:PLAYER_UNLOADED", function(character)
    print("Character unloaded:", character.char_first_name, character.char_last_name)

    -- Clear HUD
    -- Reset UI
    -- Stop client systems
end)

Character Read Database Events

These events fire when characters are created, modified, or removed. They are intended for logging, syncing external systems, or backend integrations.

All events below are server-side only.

1

C7FW:CharacterCreated

This fires when a character has been successfully created.

chevron-rightWhat this event can be used for:hashtag

chevron-rightServer Event:hashtag

Event

c7fw:CharacterCreated

Arguments

Name
Type
Description

src

number

Player server ID

payload

table

Event payload

Example

AddEventHandler("c7fw:CharacterCreated", function(src, payload)
    local char = payload.character
    print("Character created:", char.char_id)
end)
2

C7FW:CharacterModified

Fires whenever a character is updated.

chevron-rightWhat this event can be used for:hashtag

chevron-rightServer Event:hashtag

Event

c7fw:CharacterModified

Example

AddEventHandler("c7fw:CharacterModified", function(src, payload)
    local char = payload.character
    local old = payload.old

    print("Character updated:", char.char_id)

    if old and old.char_callsign ~= char.char_callsign then
        print("Callsign changed:", old.char_callsign, "", char.char_callsign)
    end
end)
3

C7FW:CharacterRemoved

chevron-rightWhat this event can be used for:hashtag

chevron-rightServer Event:hashtag

Event

c7fw:CharacterRemoved

Example

AddEventHandler("c7fw:CharacterRemoved", function(src, payload)
    print("Character removed:", payload.character.char_id)
end)
4

Payload Structure

All database events use the same payload format:

payload.old is only present on CharacterModified.

Character Force Database Events

These events allow administrators or backend systems to force create, edit, or remove characters directly in the database.

They bypass normal UI flows and are intended for:

  • admin panels

  • staff tools

  • migrations

  • external integrations

All events below are server-side only.

1

C7FW:ForceCreateCharacter

This forces a new character to be created in the database.

chevron-rightWhat this event can be used for:hashtag
  • Admin character creation tools

  • Discord bot integrations

  • CAD sync

  • Data imports

  • Staff recovery tools

chevron-rightServer Event:hashtag

Event

Arguments

Name
Type
Description

target

number | string

Player server ID OR license

data

table

Character data

cb

function

Callback (success, result)

Data Table Fields

All fields are optional unless stated.

Field
Description

first / char_first_name

First name

last / char_last_name

Last name

dob / char_dob

Date of birth

gender / char_gender

Gender

ethnicity / char_ethnicity

Ethnicity

department / char_department

Department

callsign / char_callsign

Callsign

image_url / char_image_url

Image URL

height / char_height

Height

weight / char_weight

Weight

license / char_steamid

License override

discord / char_discord

Discord ID override

char_id

Optional custom character ID

Callback Returns

Value
Description

success

boolean

result

charID or error string

Example

2

C7FW:ForceEditCharacter

This updates an existing character in the database.

If the character is currently loaded, it will be unloaded and refreshed.

chevron-rightWhat this event can be used for:hashtag
  • Admin editing tools

  • CAD sync updates

  • Department changes

  • Callsign updates

  • Staff correction tools

chevron-rightServer Event:hashtag

Event

Arguments

Name
Type
Description

charID

string

Character ID

data

table

Updated fields

cb

function

Callback

Callback Returns

Value
Description

success

boolean

result

affected rows or error

Example

3

C7FW:ForceRemoveCharacter

This permanently deletes a character from the database.

If the character is active, it will be unloaded first.

chevron-rightWhat this event can be used for:hashtag
  • Admin removal tools

  • Wipes

  • Character recovery fixes

  • Sync with external systems

chevron-rightServer Event:hashtag

Event

Arguments

Name
Type
Description

charID

string

Character ID

cb

function

Callback

Callback Returns

Value
Description

success

boolean

result

affected rows or error

Example

Event Flow Overview

On Join


On Switch / Disconnect


On Database Changes


Best Practices

  • Use PLAYER_LOADED for gameplay systems

  • Use CharacterCreated for logging/backends

  • Never assume client order of execution

  • Events are case-sensitive

  • All character tables are safe copies

Last updated