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!

C# with GLua

Discussion in 'Help' started by JamesBrody, Feb 8, 2014.

  1. Greetings all.

    I'm interesting in making binary modules for GMod, b lut my knowledge about C is too low.
    Can someone teach me? :3
     
  2. Is it working with VS 2012?
     
  3. Yep.
     
  4. Good, thank you, I will try.
     
  5. And also, how encrypt dll file?
     
  6. I'm not sure.
     
  7. I mean, protection for code?
    Or it's already included?
     
  8. Razor

    Razor Guest

    Look up stuff on obfuscating your code.
     
  9. I meet a problem, i can't understand what does this function:
    Code:
    LUA->Call(0, 0);
    Can someone explain what it does?
     
  10. Razor

    Razor Guest

    You can check the lua docs
     
  11. Lol :D
    I want add chat.AddText, but me need push color D:
    How i can do it?
     
  12. RJ

    RJ no pay Legend Clockwork Customer

    LUA->Call pretty much pushes out the function's arguments with the first number being the # of expected arguments with that function and the second number being the expected # of things returned from the function.
     
  13. Thank you, do you how make chat.AddText(col, text) in module ?
     
  14. I'm still new to modules, but it'd be something like this, I think.

    Code:
    double R, G, B, A = 255;
    int Color;
    const char* Message = "Test";
    
    LUA->PushSpecial(GarrysMod::Lua::SPECIAL_GLOB);
    LUA->GetField(-1, "Color");
    LUA->PushNumber(R); LUA->PushNumber(G); LUA->PushNumber(B); LUA->PushNumber(A);
    LUA->Call(4, 1);
    Color = LUA->ReferenceCreate();
    LUA->Pop();
    
    LUA->PushSpecial(GarrysMod::Lua::SPECIAL_GLOB);
    LUA->GetField(-1, "chat");
    LUA->GetField(-1, "AddText");
    LUA->ReferencePush(Color);
    LUA->PushString(Message);
    LUA->Call(2, 0);
    LUA->Pop();
    LUA->ReferenceFree(Color);
    
    return 0;
    It'd have to be in a clientside module (gmcl)
     
  15. Duck, thank you a lot. You're real cool man C:
     
  16. Did it actually work? :eek:

    And no problem, dude.
     

Previous Readers (Total: 0)