playerCheatSuspicionRequest
Asks your gamemode when the server suspects a player of cheating. Without an answer the player is kicked.
Renamed in 0.28 from cheatSuspectRequest; see renamed names.
Signature
Section titled “Signature”server.on("playerCheatSuspicionRequest", ({ player, checkName, suspicionScore, details }) => "kick" | "ban" | "ignore" | void | Promise<"kick" | "ban" | "ignore" | void>)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerSnapshot |
The suspected player. |
checkName |
string |
A short name for what the server saw, for your log. |
suspicionScore |
number |
How strongly the server suspects the player. |
details |
string |
More about what the server saw, for your log. |
Returns
Section titled “Returns”| Answer | Effect |
|---|---|
"kick" |
The player is disconnected with the reason “cheat suspected (checkName)”. |
"ban" |
The player is banned by network address with the same reason, then disconnected. |
"ignore" |
The player stays. |
The first handler that returns one of these decides. No answer, another value or an error kicks the player. See how decisions work.
Example
Section titled “Example”Keep admins, ban repeat offenders.
import { server } from "nativemp";
const admins = new Set(["Alice"]);const warned = new Set<string>();server.on("playerCheatSuspicionRequest", ({ player, checkName }) => { if (admins.has(player.name)) return "ignore"; if (warned.has(player.name)) return "ban"; warned.add(player.name); server.log(`${player.name} kicked for ${checkName}`); return "kick";});Related
Section titled “Related”players.kickandplayers.banAddress: the same actions from your own code