1. Check out the Store if you're looking to Buy HL2RP or other schemas for your server. You can click Buy Schemas on the very top navigation bar to visit the store.
  2. Use the Plugin Center to easily subscribe to and auto-install Clockwork plugins to your server, or submit and share plugins you have developed.
  3. Having trouble setting up or developing with Clockwork? Check out the Wiki or post in the Support Forum for advice from fellow users.
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. JamesBrody

    JamesBrody Active Member

    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. JamesBrody

    JamesBrody Active Member

    Is it working with VS 2012?
     
  3. Yep.
     
  4. JamesBrody

    JamesBrody Active Member

    Good, thank you, I will try.
     
  5. JamesBrody

    JamesBrody Active Member

    And also, how encrypt dll file?
     
  6. I'm not sure.
     
  7. JamesBrody

    JamesBrody Active Member

    I mean, protection for code?
    Or it's already included?
     
  8. Razor

    Razor Guest

    Look up stuff on obfuscating your code.
     
  9. JamesBrody

    JamesBrody Active Member

    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. JamesBrody

    JamesBrody Active Member

    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. JamesBrody

    JamesBrody Active Member

    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. JamesBrody

    JamesBrody Active Member

    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)