GetPlayerAccountBindingSerial: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Document Lua functions planned for G1R:MP update 0.1.2
 
Document Lua APIs available or improved from G1R:MP 0.1.2
 
Line 1: Line 1:
= getPlayerAccountBindingSerial =
= getPlayerAccountBindingSerial =
<div style="background:#0b0b0b; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#f1f1f1; padding:0.85rem 1rem; margin:0.75rem 0 1rem;">
<div style="background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;">
<div style="color:#ff5a5a; font-weight:bold; letter-spacing:0.04em;">COMING IN UPDATE 0.1.2</div>
<div style="color:#111111; font-weight:bold; letter-spacing:0.04em;">AVAILABLE FROM UPDATE 0.1.2</div>
<div style="color:#f1f1f1; margin-top:0.25rem;">This function is documented in advance and is not yet available in the current public release.</div>
<div style="color:#111111; margin-top:0.25rem;">This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.</div>
</div>
</div>



Latest revision as of 18:39, 3 September 2026

getPlayerAccountBindingSerial

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.

Returns the serial value that a server resource should use when binding one validated account key to the connected client.

Syntax

string|false getPlayerAccountBindingSerial(int playerId, string accountKey)

Parameters

Name Type Required Description
playerId int yes The connected player identifier.
accountKey string yes A normalized account key containing 3-24 ASCII characters. It must start with a letter; the remaining characters may be letters, digits or underscores.

Returns

Returns a 32-character binding serial, or false when the player, serial or account key is invalid.

Examples

Read the binding serial only after validating an account name:

local bindingSerial = getPlayerAccountBindingSerial(playerId, accountName)
if not bindingSerial then
    outputChatBox("The account binding could not be verified.", playerId)
    return
end

Notes

  • Available only in server-side resource scripts.
  • The function lowercases the account key before validating it.
  • Production builds return the connected player's verified serial. The isolated two-client development build derives a deterministic per-account alias so two local sessions can test account flows without weakening production serial checks.
  • Treat the returned value as a persistent identifier, not as a secret, and keep authorization decisions on the server.