CompletePlayerConsumableUse: Difference between revisions
Jump to navigation
Jump to search
Document Lua APIs available or improved from G1R:MP 0.1.2 |
Clarify GothicRP consumable persistence ownership |
||
| Line 38: | Line 38: | ||
== Notes == | == Notes == | ||
* Available only in server-side resource scripts. | * Available only in server-side resource scripts. | ||
* This is an | * This is an internal transaction-completion capability for the bundled <code>gothic_rp</code> persistence workflow, not a general gameplay function. | ||
* The runtime accepts this call only when the calling resource is named exactly <code>gothic_rp</code>; every other resource receives <code>false</code>. | |||
* The player, sequence and commit key must match the pending server operation. Reusing values from a different operation is rejected. | * The player, sequence and commit key must match the pending server operation. Reusing values from a different operation is rejected. | ||
* Call it exactly once after the corresponding persistence result is known; do not use it to start a consumable animation or grant an effect. | * Call it exactly once after the corresponding persistence result is known; do not use it to start a consumable animation or grant an effect. | ||
Latest revision as of 14:06, 8 September 2026
completePlayerConsumableUse
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 a pending authoritative consumable inventory commit after the resource has persisted its result.
Syntax
bool completePlayerConsumableUse(int playerId, int sequence, 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. |
commitKey |
string |
yes | The non-empty commit key supplied for the same pending operation; maximum 96 bytes. |
committed |
bool |
yes | True after the inventory mutation was committed, or false after it was rejected or rolled back. |
Returns
Returns true only when the matching pending completion is accepted; otherwise returns false.
Examples
Acknowledge a successfully persisted consumable use:
if not completePlayerConsumableUse(playerId, sequence, commitKey, true) then
outputDebugString("Consumable commit acknowledgement was rejected", 1)
end
Notes
- Available only in server-side resource scripts.
- This is an internal transaction-completion capability for the bundled
gothic_rppersistence workflow, not a general gameplay function. - The runtime accepts this call only when the calling resource is named exactly
gothic_rp; every other resource receivesfalse. - The player, sequence and commit key must match the pending server operation. Reusing values from a different operation is rejected.
- Call it exactly once after the corresponding persistence result is known; do not use it to start a consumable animation or grant an effect.