Skip to main content

RetrieveDataTransaction

Server
string | nil Lyn.Player.RetrieveDataTransaction(Player ply, string steamid64, txn txn)Hook

Description

Called before a player's auth, data retrieval transaction begins.

You can use this hook to set up any necessary data before "Lyn.Player.Auth" is called.

You are inside a coroutine, so you can yield inside this hook if needed.

The txn functions already yield internally, so you don't need to yield when using them.

Example

hook.Add("Lyn.Player.RetrieveDataTransaction", "MyRetrieveDataTransactionHook", function(ply, steamid64, txn)
if not ply:IsValid() then return end

local err, res = txn:Fetch([[SELECT {1};]], params = { ply:SteamID64() })
if err then return err end

Lyn.Player.SetVar(ply, "MyData", res)
end)

Params

  1. Player ply
  2. string steamid64
  3. txn txn

Returns

  1. string | nil error

    An error message incase of failure, or nil on success. Can be anything that works with tostring().