Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- PLAYER DATA MANAGMENT
- --
- accountRoot = createElement("accountNode", "accountNode")
- -- This function initializes the account node for the given player, with the accountData table from MySQL.
- -- PRECONDITION: The player must be logged out, the account must be empty.
- function initializeAccountNode(player, accountData)
- if getElementType(player) ~= "player" or type(accountData) ~= "table" then
- error("Invalid arguments to initializePlayerNode()!", 1)
- end
- if isAccountInUse(accountData.id) or isPlayerLoggedIn(player) then
- return false
- end
- local accountNode = createElement("accountNode", "account"..accountData.id)
- setElementData(accountNode, "ID", accountData.id)
- setElementData(accountNode, "playerElement", player, false)
- for key, value in pairs(accountData) do
- if key ~= "id" and key ~= "password" and key ~= "mta_serial" then
- setElementData(accountNode, key, value)
- end
- end
- setElementParent(accountNode, accountRoot)
- setElementData(player, "ID", accountData.id)
- setElementData(player, "accountNode", newNode)
- return true
- end
Add Comment
Please, Sign In to add comment