1. Post #41
    Gold Member
    GiGaBiTe's Avatar
    February 2005
    3,157 Posts
    I can't seem to get cvar2.ReplicateData() to work properly (it could be that I'm not using it right)

    Here's what I'm trying to do:
    Code:
    function sendPlayerCVARFlags(ply)
    	require("cvar2")
    	cvar2.ReplicateData(player.GetByID(ply), mat_yuv, 1)
    	ply:PrintMessage(HUD_PRINTCENTER,"Test")
    end
    
    hook.Add( "PlayerSpawn", "playerSpawn", sendPlayerCVARFlags )
    Error:
    Code:
    ERROR: Hook 'playerSpawn' Failed: autorun/server/cvar_unlock.lua:26: attempt to call field 'ReplicateData' (a nil value)
    Removing Hook 'playerSpawn'

  2. Post #42
    Gold Member
    blackops7799's Avatar
    December 2006
    1,714 Posts
    mat_yuv should be in quotes and player.GetByID(ply) should just be ply I think. That's all I see that's wrong.

  3. Post #43
    Gold Member
    GiGaBiTe's Avatar
    February 2005
    3,157 Posts
    Wee, finally got it to work. Downloaded the wrong module at the middle of the first page and it had this bind removed.

  4. Post #44
    infinitywrai's Avatar
    December 2007
    539 Posts
    System error 14001 when I try to use :(

  5. Post #45
    aualin's Avatar
    April 2007
    439 Posts
    cvar2.SetFlags("sv_cheats", cvar2.GetFlags("sv_cheats") - FCVAR_CHEAT)
    Win?
    Reply With Quote Edit / Delete Reply Sweden Show Events Late Late x 3Disagree Disagree x 1 (list)

  6. Post #46
    |FlapJack|'s Avatar
    July 2009
    6,138 Posts
    cvar2.SetFlags("sv_cheats", cvar2.GetFlags("sv_cheats") - FCVAR_CHEAT)
    Win?
    If you're using that on the client, No.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Dumb Dumb x 2Agree Agree x 1 (list)

  7. Post #47
    Chad Mobile's Avatar
    November 2009
    5,398 Posts
    Thanks, can't wait to use this :)

  8. Post #48
    King of the Oil Refinery
    Tobba's Avatar
    December 2008
    6,212 Posts
    Sorry for the bump but cvar2.GetAll seems to return concommands too, can you please add cvar2.Exists(name) or cvar2.IsCvar(name) ?

  9. Post #49
    King of the Oil Refinery
    Tobba's Avatar
    December 2008
    6,212 Posts
    G.ConVarExists

    stupid wiki search...

  10. Post #50
    likes men
    Python1320's Avatar
    May 2007
    1,717 Posts
    Any chance of a linux version?
    Reply With Quote Edit / Delete Reply Finland Show Events Agree Agree x 2 (list)

  11. Post #51
    CapsAdmin's Avatar
    August 2005
    3,943 Posts
    Linux version please.
    Reply With Quote Edit / Delete Reply Norway Show Events Agree Agree x 2 (list)

  12. Post #52
    Yakuza's Avatar
    May 2010
    27 Posts
    Is this DLL binary compatible with a linux server?
    if it is then someone please confirm it.
    im running a linux server and this DLL is required to run the gamemode im using.

  13. Post #53
    likes men
    Python1320's Avatar
    May 2007
    1,717 Posts
    No linux binaries so far.

  14. Post #54
    Yakuza's Avatar
    May 2010
    27 Posts
    No linux binaries so far.
    If someone reads this post and knows how to make modules, is anyone interested in making this module compatible with linux binaries?

    If you are then pm me on forums.

    Edited:

    Linux version please.
    Yes please!

  15. Post #55
    Box collector
    haza55's Avatar
    October 2005
    545 Posts
    Okay I'll do this tomoz.

  16. Post #56
    King of the Oil Refinery
    Tobba's Avatar
    December 2008
    6,212 Posts
    This module seems to crash on load in my gamemode, didnt before the update. but then it went like... shorter between every crash, now i nailed out that it was cvar2 that crashed server on startup...

  17. Post #57
    likes men
    Python1320's Avatar
    May 2007
    1,717 Posts
    This module alters around 200 cvars on load on my server and not a single startcrash has been detected. It must be something you're doing.

    And thanks haza55!

  18. Post #58
    King of the Oil Refinery
    Tobba's Avatar
    December 2008
    6,212 Posts
    Mine alters about 300 cvars, it worked just fine untill a few hours ago when it started crashing the server

  19. Post #59
    Box collector
    haza55's Avatar
    October 2005
    545 Posts
    Sigh Linux is going to be a bitch.
    Reply With Quote Edit / Delete Reply Australia Show Events Disagree Disagree x 1 (list)

  20. Post #60
    Gold Member
    ComWalk's Avatar
    August 2005
    107 Posts
    Sigh Linux is going to be a bitch.
    Taking a look at the least portable code in gm_cvar2, you can eliminate the sigscan by switching to how the new version of gatekeeper deals with getting clients. The way I scanned for them before (which is the way it still did it when you wrote this) was really messy, and it's a lot better now. Grabbing the cvar export shouldn't be a huge hassle.

    Copy the gatekeeper code for getting CBaseServer, use that instead of directly accessing the client list, and then the worst of it will be grabbing the export (which shouldn't be too bad).

  21. Post #61
    Gold Member
    raBBish's Avatar
    March 2007
    2,667 Posts
    Grabbing the cvar export shouldn't be a huge hassle.
    Should be as easy as this.

    ...
    
    ICvar* cvar = NULL;
    
    ...
    
    int Init( lua_State* L )
    {
    	if( !Sys_LoadInterface( "vstdlib", CVAR_INTERFACE_VERSION, NULL, reinterpret_cast<void**>( &cvar ) ) )
    		Lua()->Error( "Unable to load ICvar interface." );
    }
    
    ...
    Reply With Quote Edit / Delete Reply Finland Show Events Friendly Friendly x 1 (list)

  22. Post #62
    Skondra's Avatar
    June 2009
    333 Posts
    Should be as easy as this.

    ...
    
    ICvar* cvar = NULL;
    
    ...
    
    int Init( lua_State* L )
    {
    	if( !Sys_LoadInterface( "vstdlib", CVAR_INTERFACE_VERSION, NULL, reinterpret_cast<void**>( &cvar ) ) )
    		Lua()->Error( "Unable to load ICvar interface." );
    }
    
    ...
    I had a look at Sys_LoadInterface, it seems to cause a memory error when I close the game without unloading the module by disconnecting. Is there an unload function that's supposed to be used with it?

  23. Post #63
    Box collector
    haza55's Avatar
    October 2005
    545 Posts
    Code:
    // This is a helper function to load a module, get its factory, and get a specific interface.
    // You are expected to free all of these things.
    // Returns false and cleans up if any of the steps fail.
    bool Sys_LoadInterface(
    	const char *pModuleName,
    	const char *pInterfaceVersionName,
    	CSysModule **pOutModule,
    	void **pOutInterface );

  24. Post #64

    April 2010
    31 Posts
    Can someone tell me if this still works or another way I can do sv_airaccelerate and sv_accelerate, I really need it.

  25. Post #65
    Gold Member
    nicatronTg's Avatar
    July 2009
    4,698 Posts
    I'm thinking the flags need to be removed before the engine processes them, because it doesn't add the command back when you reboot the server.

  26. Post #66
    Gold Member
    blackops7799's Avatar
    December 2006
    1,714 Posts
    Can someone tell me if this still works or another way I can do sv_airaccelerate and sv_accelerate, I really need it.
    The module still works fine.

    for k,v in ipairs( cvar2.GetAll() ) do
    
    	if ConVarExists( v ) and GetConVar( v ) and cvar2.IsFlagSet( v, FCVAR_DEVELOPMENTONLY ) then
    	
    		cvar2.SetFlags( v, cvar2.GetFlags( v ) - FCVAR_DEVELOPMENTONLY )
    		
    	end
    	
    end

    Removes all of the dev flags from any convars that have them.

  27. Post #67

    April 2010
    31 Posts
    The module still works fine.

    for k,v in ipairs( cvar2.GetAll() ) do
    
    	if ConVarExists( v ) and GetConVar( v ) and cvar2.IsFlagSet( v, FCVAR_DEVELOPMENTONLY ) then
    	
    		cvar2.SetFlags( v, cvar2.GetFlags( v ) - FCVAR_DEVELOPMENTONLY )
    		
    	end
    	
    end

    Removes all of the dev flags from any convars that have them.
    What is that? Where do I put it? And wasn't I supposed to put require("modulename") before it?

    EDIT: Worked great with this! Thank you sooo much!
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 1 (list)

  28. Post #68
    likes men
    Python1320's Avatar
    May 2007
    1,717 Posts
    Broken, could you please fix this for the latest version of gmod?
    Reply With Quote Edit / Delete Reply Finland Show Events Agree Agree x 1 (list)

  29. Post #69
    MegaDeath's Avatar
    August 2007
    93 Posts
    As of this version, on loading there appears to be an access violation reading some apparently arbitrary location. More than that I have no idea on what to say other than "It's broken!"

  30. Post #70
    Box collector
    haza55's Avatar
    October 2005
    545 Posts
    This will be fixed soon.

    Edited:

    Updated. Download in first post.

    I removed 3 functions, which I will re-add later.

  31. Post #71
    Just going to throw out there that commands such as sv_airaccel don't require this module to work anymore.

  32. Post #72
    likes men
    Python1320's Avatar
    May 2007
    1,717 Posts
    Code:
    REMOVEDcvar2.ReplicateData(playerid, cvarName, datastr) // Doesn't seem to work with things like mat_fullbright sadly, just left it here for others to try out.  
    FCVAR_DEVELOPMENTONLY
    Damnit, This command was nice for replicating sv_cheats on clients without actually allowing serverside stuff like ent_fire. mat_fullbright and such work after making sv_cheats to appear to be 1 by the way.

  33. Post #73
    Box collector
    haza55's Avatar
    October 2005
    545 Posts
    Code:
    REMOVEDcvar2.ReplicateData(playerid, cvarName, datastr) // Doesn't seem to work with things like mat_fullbright sadly, just left it here for others to try out.  
    FCVAR_DEVELOPMENTONLY
    Damnit, This command was nice for replicating sv_cheats on clients without actually allowing serverside stuff like ent_fire. mat_fullbright and such work after making sv_cheats to appear to be 1 by the way.
    I'm bringing it back. Just wanted to get the update out as fast as possible.

  34. Post #74
    likes men
    Python1320's Avatar
    May 2007
    1,717 Posts
    Oh and another request. Could you, in future, compile cvar2 without external dll deps (msvc) since WINE servers really don't like that.

  35. Post #75
    Gold Member
    Kill coDer's Avatar
    April 2006
    956 Posts
    Is cvar2.ReplicateData the only way I can let other clients modify fog commands such as fog_override?

    If so, when do you think the update will be out?

  36. Post #76
    Box collector
    haza55's Avatar
    October 2005
    545 Posts
    Soon, on the top of my list once I get some work done.

  37. Post #77
    likes men
    Python1320's Avatar
    May 2007
    1,717 Posts
    Any luck with porting this on linux/getting the ReplicateData to work?
    Reply With Quote Edit / Delete Reply Finland Show Events Agree Agree x 1 (list)

  38. Post #78
    Gold Member
    Kill coDer's Avatar
    April 2006
    956 Posts
    It's been almost a month, I would really like to use it :C
    Reply With Quote Edit / Delete Reply Australia Show Events Agree Agree x 1 (list)

  39. Post #79
    Kate Adams
    COBRAa's Avatar
    June 2009
    975 Posts
    Why did you remove ExecuteCommandOnClient(), could it execute any command or something?

  40. Post #80
    likes men
    Python1320's Avatar
    May 2007
    1,717 Posts
    Why did you remove ExecuteCommandOnClient(), could it execute any command or something?
    It broke due to the engine update. Updates to the SDK haven't been released and something changed so it couldn't work without reverse engineering the new code.