OnPlayerAuditViolation
The item check found items the server cannot explain - return false to vouch for them.
The player holds amount of an item class - what their game reports - where the server’s records credit allowed: what it
bound to the player (the spawn outfit, GivePlayerItem, a pickup, a take from a container, a shop purchase) plus the gives
still on their way. The excess has stood for a second and a half and is about to be removed from their game, one exact item
at a time. A single unexplained item is removed, never a kick: a player is kicked only for cheating proven beyond doubt,
through OnPlayerCheatDetected and [audit] action. With [audit] mode = "observe" the call comes all the same and the
removal is only logged. For the purse class is the game’s money item and the amounts are its own count, tenths of a
Groschen (10 = one Groschen). The class may be one of a horse’s saddlebags that the player’s game holds, and the call does
not say which. Return false to vouch: the records take the whole excess, in observe too, and nothing is removed. Anything
else and the excess goes.
When it is asked. Once the excess has stood its second and a half and is still there; never for an item whose pickup or
take the server itself refused (OnPlayerPickup, OnPlayerTakeWorldItem) - that one goes at once, in every mode; and at
most 8 times in a tick and 30 times a minute for one player, after which the removal goes ahead without asking, so answer from
memory and never from a database query. What the game made itself is OnPlayerNativeItem’s, asked as the item arrives.
Vouch only for what the mode handed out in a way the server does not see - an event’s reward given by a client script - and
never for a class in general: a vouched item is the player’s from then on.
Syntax
Section titled “Syntax”function OnPlayerAuditViolation(pid, class, amount, allowed, origins) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
class |
string | the item class GUID (GetItemName names it) |
amount |
number | how many the player holds (what their client reports) |
allowed |
number | how many the server’s records credit |
origins |
string | where the unexplained items came from, comma-separated (empty when nothing is known): native <maker> - the game made it |
itself (native unmapped is a maker the server cannot name, see OnPlayerNativeItem for the others), unknown - the count |
||
| went up with nothing of the game’s own seen making it (an edited amount, or a way of the game’s the server does not follow), | ||
foreign_inv - moved in from an inventory the server does not follow, outfit, pickup, level, container, ammo, |
||
own drop. A server older than 0.43 passes nothing here |
Returns
Section titled “Returns”false vouches for the items; anything else lets the excess be removed
Example
Section titled “Example”function OnPlayerAuditViolation(pid, class, amount, allowed, origins) Log(string.format("audit: %s holds %d x %s, %d explained (%s)", GetPlayerName(pid), amount, GetItemName(class), allowed, origins or "")) if GetPlayerData(pid, "event_loot") then return false end -- the event handed things out itselfendSee also
Section titled “See also”OnPlayerNativeItem · OnPlayerCheatDetected · GetPlayerAuditViolations · GivePlayerItem · GetPlayerInventory · the Accounts, admins, bans and the audit group of the index
