1. Post #1
    Gold Member
    Drak_Thing's Avatar
    May 2005
    453 Posts
    From my understanding, network vars only update ents in there PVS?
    So If I set a network var on a player (server-side) and another player (outside the set players PVS) calls GetNWInit (client-side) to grab that set variable on the other player. He won't be able to retrieve it?
    (I'm trying to allow other players to see other players saved information when they have there crosshair over them)

    Also, is there any downside in querying the SQLLite server alot instead of Set/Get networked vars?

  2. Post #2
    Blue Triangle Wizard!
    Chuteuk's Avatar
    May 2007
    68 Posts
    Yes setting a NetworkedVar clientside will only set it for that client. Unless these values are constantly changing, consider using Usermessages. Entity.SetNetworkedVar Umsg.Start

    How often are you running queries from the SQLite db?
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Friendly Friendly x 1 (list)

  3. Post #3
    Gold Member
    Drak_Thing's Avatar
    May 2005
    453 Posts
    Yes setting a NetworkedVar clientside will only set it for that client. Unless these values are constantly changing, consider using Usermessages. Entity.SetNetworkedVar Umsg.Start

    How often are you running queries from the SQLite db?
    Well, inside HUDPaint, I do a trace that checks for players you are viewing. So it would be alot.
    But i'm setting the network var server side. But would like to RETRIEVE it client-side, but it could be any player. Hard for me to explain

    pseudoish code that shows what i'm trying todo.
    #if CLIENT
    
    function GM:HUDPaint()
    	// do trace
    	// run TracedPlayer:GetNWInit("whatwhat")
    end function
    
    #end
    
    #if SERVER
    
    function setvar()
    	// set SomePlayer:SetNWInit("whatwhat") = 10
    end function
    
    #end
    

    So currently I load information from the SQL server, into a network var (server-side) for a specific player.
    Then I would like a DIFFERENT player to be able to retrieve that information. (client-side)

  4. Post #4
    SharpCoder's Avatar
    February 2012
    59 Posts
    Well, inside HUDPaint, I do a trace that checks for players you are viewing. So it would be alot.
    -snip-
    I am not sure of the actual code solution to this, but I would just like to point out that you should avoid hitting that database so often - avoid it at all costs. I think a possible solution would be to load all of the values you want to access into a table stored on the server (not in the database, but in a LUA table of some kind). And then when you need to retrieve the values for a given player, look up the respective table from your serverside variable instead of actually hitting the database.

    Does that make sense?

    I hope this helps!