CompletePlayerConsumableFinalize
completePlayerConsumableFinalize
AVAILABLE FROM UPDATE 0.1.2
This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.
Completes or rejects the persistence-finalization stage of a pending authoritative consumable operation.
Syntax
bool completePlayerConsumableFinalize(int playerId, int sequence, int generation, string commitKey, bool committed)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
sequence |
int |
yes | The positive consumable-use sequence received by the resource. |
generation |
int |
yes | The positive session generation supplied for this finalization request. |
commitKey |
string |
yes | The non-empty commit key supplied for the same pending operation; maximum 96 bytes. |
committed |
bool |
yes | True after final persistence succeeded, or false after it was rejected or rolled back. |
Returns
Returns true only when the matching pending finalization is accepted; otherwise returns false.
Examples
Confirm a persisted consumable finalization:
local accepted = completePlayerConsumableFinalize(
playerId, sequence, generation, commitKey, true
)
if not accepted then
outputDebugString("Consumable finalization acknowledgement was rejected", 1)
end
Notes
- Available only in server-side resource scripts.
- This is an advanced transaction-completion function intended for the resource that owns the authoritative inventory workflow.
- The player, sequence, generation and commit key must all match the pending operation.
- Call it only after the final persistence result is known; it does not play an animation or apply a consumable effect by itself.