Author Topic: ULX MySQL (ULib.ucl.addUser)  (Read 3607 times)

0 Members and 3 Guests are viewing this topic.

Offline yahan

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
ULX MySQL (ULib.ucl.addUser)
« on: October 26, 2010, 09:41:48 PM »
Quote

local function addUser( pl, res, status, err )
    pl:ChatPrint("Loading " .. pl:Nick() .. "'s account \n")
 
    print( err )

    ULib.ucl.addUser( pl:Nick(), "steamid", pl:SteamID(), { res[1] }  )
   
    pl:ChatPrint("Loaded " .. pl:Nick() .. "'s rank.\n")
 
    ULib.ucl.probe( pl )
end
 
local function LoadUsers( pl )
    local steamID = pl:SteamID()

   ULib.ucl.authed[ pl ] = nil
   ULib.ucl.awaitingauth[ pl ] = nil

    tmysql.query( "SELECT Rank FROM rank WHERE SteamID = '" .. steamID .. "'", addUser, nil, pl )
end
hook.Add( "PlayerInitialSpawn", "LoadUserRank", LoadUsers )
hook.Remove( "PlayerInitialSpawn", "ucl_initialspawn" )
Quote
13:40:39 Lua Error: ERROR: Hook 'LoadUserRank' Failed: [addons\ulx\lua\ulx\init.lua:79] attempt to index field 'awaitingauth' (a nil value)
13:40:39 Lua Error: Removing Hook 'LoadUserRank'

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX MySQL (ULib.ucl.addUser)
« Reply #1 on: October 27, 2010, 07:55:12 AM »
You never defined the awaitingauth field, so it's understandably nil.
Experiencing God's grace one day at a time.