1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

Important Shared Variables

Discussion in 'Development' started by Gr4Ss, Mar 9, 2015.

  1. With todays GMod update and the CW update that went with it, it's important to note the following:
    • You must register shared vars now or they will not work (done in the ClockworkAddSharedVars hook). There are error messages in the server's console for unregistered vars being used, but not on the client. I'll look into automatically registering shared vars in the future with the type of the value they are given if they don't exist yet.
    • Global/Player shared vars must now follow the type they are registered with. Global vars didn't have this restriction before, they do now.
     
  2. kurozael

    kurozael Cloud Sixteen Director Staff Member Administrator Investor

    Alternatively feel free to use your own networking vars system until all bugs are ironed out, or manually the invoke the GMod methods.
     
  3. duck

    duck Phant0m Legend

    Also cool, you can share tables if you specify a third argument for Clockwork.kernel:SetSharedVar.
    Code:
    Clockwork.kernel:SetSharedVar("TableKey", {nyaah = 1}, "MySharedTable");
    Clockwork.kernel:GetSharedVar("TableKey", "MySharedTable");
    All connected clients will receive the table, and all future clients will receive it as well. You can individually share a table with a single player using
    Code:
    Clockwork.player:SetSharedVar(player, "TableKey", {nyaah = 1}, "MySharedTable");
    It uses datastreaming.
     

Previous Readers (Total: 0)