Skip to main content

Protection Event

Guard fires the server-side event o1:AntiDump when it detects a player attempting to dump resources or otherwise abuse the server.

Event signature

AddEventHandler("o1:AntiDump", function(playerId)
-- Your logic here
end)

Getting player identifiers

You can retrieve the player's identifiers using the standard FiveM function:

local identifiers = GetPlayerIdentifiers(playerId)

This returns identifiers such as Discord, FiveM license, Steam, and others.

Examples

Log to console

AddEventHandler("o1:AntiDump", function(playerId)
print("Player " .. playerId .. " triggered the anti-dump protection.")
end)

Kick the player

AddEventHandler("o1:AntiDump", function(playerId)
DropPlayer(playerId, "Dumping is not allowed.")
end)

Ban the player

AddEventHandler("o1:AntiDump", function(playerId)
-- Replace with your ban system's function
MyBanSystem(playerId, "Dumping detected", "Permanent")
end)

Send a Discord webhook

AddEventHandler("o1:AntiDump", function(playerId)
local identifiers = GetPlayerIdentifiers(playerId)
local idString = table.concat(identifiers, "\n")

PerformHttpRequest("YOUR_WEBHOOK_URL", function() end, "POST", json.encode({
username = "o1 Guard",
content = "**Dump attempt detected**\nPlayer ID: " .. playerId .. "\nIdentifiers:\n" .. idString
}), { ["Content-Type"] = "application/json" })
end)
tip

Combine actions

You can combine multiple actions in one handler. For example, log the attempt, send a Discord notification, and kick the player.

Custom logic

The handler runs server-side, so you can apply any logic your server needs, such as warnings, temporary bans, or staff alerts.