Notify

Severities

Tag
Severity

'd'

Debug

'i'

Info

'w'

Warning

'e'

Error

's'

Success

Functions

sWatch.notify

Send a notification to one or more players. Staff may not receive notifications depending on your ingame options.

Arguments

  1. (Table) notification

    • (String) severity - See Severities

    • (String) module - Helps user to understand what this message is about

    • (String) message

    • (SteamID32|SteamID64|Player) player (optional) - NOT the recipient! Who is this notify about? Name and Avatar will get displayed in top right corner of notify.

  2. (String|Player|SteamID32|SteamID64) recipient

    Possible values for recipient:

    • 'protected' - sends to all protected players

    • [SteamID32|SteamID64] - sends to a specific player

    • [Player] - sends to a specific player

    • default - sends to all staff and protected players

Example

// Send warning notification to all protected players
sWatch.notify({
    ["severity"] = "w",
    ["module"] = "mymodule",
    ["message"] = sWatch.lang("my_message"),
}, "protected")

// Send info notification to all staff and protected players
sWatch.notify({
    ["severity"] = "i",
    ["module"] = "mymodule",
    ["message"] = sWatch.lang("my_message"),
})

// Send success notification to a specific player (staff or protected!)
sWatch.notify({
    ["severity"] = "s",
    ["module"] = "mymodule",
    ["message"] = sWatch.lang("my_message"),
}, targetPlayer)

// Send warning notification to all staff about a player 
sWatch.notify({
    ["severity"] = "w",
    ["module"] = "mymodule",
    ["message"] = sWatch.lang("my_message"),
    ["ply"] = attacker
})
sWatch.askAction

Ask a staff of protected player what to do against a bad guy. Depending on your settings, this won't get sent to staff.

Arguments

  1. (Table) notification

    • (String) identifier - See Detections

    • (String) action_key - Settings key where all possible actions for this detection are listed

    • (String) reason - Message to be shown, what this person did

    • (SteamID32|SteamID64|Player) ply - Player that we take action about

  2. (Function) callback

    1. (String) answer (nil if nobody answered, false if duplicate or invalid)

    2. (SteamID32) admin - player that took action

Example

// Ask staff/protected what to do about player
sWatch.askAction({
    ["identifier"] = "network_spam",
    ["action_key"] = "networking_netcollector_spam_action",
    ["reason"] = "Reason for punishment",
    ["ply"] = attacker
}, function(answer, admin) 
    if IsValid(attacker) and answer == "kick" then
        attacker:Kick()
    end
end)

Last updated