About Exports
WX AntiCheat includes a set of server side exports. If you changed the wx_anticheat resource name, make sure to edit also the export. On example, if your anticheat resource name is fordraptor, you will use exports['fordraptor']
Banning
server.lua
exports['wx_anticheat']:ban(
playerId, -- [[ integer ]]
reason -- [[ string ]]
)
-- Example
exports['wx_anticheat']:ban(1,"Trying to cheat")
NOTE: This export will use the currently set punish method in your config!
Whitelisting Players
With this export, you can whitelist any player via their ID for a specific amount of time! This can be useful for example when you turned on Anti God Mode and the player has entered the vehicle shop.
server.lua
exports['wx_anticheat']:whitelistPlayer(
playerId, -- [[ integer ]]
time -- [[ integer ]]
)
-- Examples
exports['wx_anticheat']:whitelistPlayer(123,-1) -- "-1" = forever
exports['wx_anticheat']:whitelistPlayer(123,15000) -- 15s
server.lua
exports['wx_anticheat']:removeWhitelist(
playerId -- [[ integer ]]
)
-- Example
exports['wx_anticheat']:removeWhitelist(123)
Adding Admins
This export has been documented in Admins Section
Event Handlers
You can use two built-in event handlers to use in your other resources!
server.lua
AddEventHandler('wx_anticheat:playerBanned',function (data)
local fulldata = json.encode(data,{indent=true})
print(fulldata)
end)
-- Returns:
-- playerId, playerName, reason, banID, side
--[[ Example Return:
{
playerId = 1,
playerName = 'WX',
reason = "No-Clip",
banID = 'ABCD-EFGH',
side = 'client'
}
]]
server.lua
-- Example
AddEventHandler('wx_anticheat:playerBanned',function (data)
print(("Player %s (ID: %s) has been detected on the %s for %s. Ban ID: %s"):format(
data.playerName, --[[ string ]]
data.playerId, --[[ integer ]]
data.side, --[[ string ]]
data.reason, --[[ string ]]
data.banID --[[ string ]]
))
--[[ Example Return:
Player WX (ID: 123) has been detected on the client for No-Clip. Ban ID: #1234
]]
end)
server.lua
AddEventHandler('wx_anticheat:playerUnbanned',function (banID)
print(banID)
end)
-- Returns:
-- banID
server.lua
-- Example
AddEventHandler('wx_anticheat:playerUnbanned',function (banID)
print(("Player with Ban ID of %s has been unbanned"):format(
banID
))
end)