Starting a Binary Module

Hello, I am new to making Binary Modules.
I have followed this tutorial: http://www.facepunch.com/threads/949978/

When I went to compiling it failed and that tutorial has all of its pictures missing. Would anyone here mind creating a new tutorial or possibly adding me on steam and helping me set up for creating modules, maybe even help me create a simple first one? Anyway I hope to hear from someone, my steam is on my profile.

Is there any way to paste my lua code into a dll?
I do not know a lot about C++

Say I want to put this code into a dll


-- Player SteamID and UniqueID Fetcher:
function PrintSteamInfo()
    for _, v in ipairs( player.GetAll() ) do
        print( v:Nick().."'s SteamID is: "..v:SteamID().. " and UniqueID is: "..v:UniqueID() )
    end
end
concommand.Add("hawk_print_info", PrintSteamInfo)

How would I do that and still be able to use that console command?

[cpp]
int EntryPoint( lua_State L )
{
ILuaInterface
sLua = Lua();

const char* code = "concommand.Add('hawt_print_info', function() for _, v in ipairs( player.GetAll() ) do print(v:Nick()..'s SteamID is '..v:SteamID()..' and UniqueID is: '..v:UniqueID()); end end)";

sLua->Msg("Loading lua...

“);
sLua->RunString(”", “”, code, true, true);
sLua->Msg("Executed lua!
");
}
[/cpp]

So where do I put that in this?


// Skip rarely used Windows API functions
#define WIN32_LEAN_AND_MEAN
 
// Headers
#include <GMLuaModule.h>
 
// Module definition
GMOD_MODULE( Init, Shutdown );
 
// Globals
ILuaInterface* g_Lua;
 
// Initialization
int Init( lua_State *L )
{
	g_Lua = Lua();
 
	return 0;
}
 
 
// Shutdown
int Shutdown( lua_State *L )
{
	return 0;
}


// Skip rarely used Windows API functions
#define WIN32_LEAN_AND_MEAN
 
// Headers
#include <GMLuaModule.h>
 
// Module definition
GMOD_MODULE( Init, Shutdown );
 
// Globals
ILuaInterface* g_Lua;
 
// Initialization
int Init( lua_State *L )
{
    g_Lua = Lua();
    const char* code = "concommand.Add('hawt_print_info', function() for _, v in ipairs( player.GetAll() ) do print(v:Nick()..'s SteamID is '..v:SteamID()..' and UniqueID is: '..v:UniqueID()); end end)";
 
    g_Lua->Msg("Loading lua...
");
        g_Lua->RunString("", "", code, true, true);
    g_Lua->Msg("Executed lua!
");
    return 0;
}
 
 
// Shutdown
int Shutdown( lua_State *L )
{
    return 0;
}

So do I just put the dll file then in the addons folder or where do I place it?

includes/modules/

I placed the dll there and the command did not work when I typed it into console.
Does it auto run from that folder or do I need a lua script saying to run that dll?

you need to create a lua file in autorun/client. In that file call the require() function. This will load your module.

so this should be it

tutorial.lua



require("gm_tutorial")


or



require("gm_tutorial.dll")


or



require("tutorial")


or



require("tutorial.dll")


3rd one

even if my dll is name gm_tutorial.dll

Ignore gmcl_, gmsv_, gm_, .dll.

You just need to require the name of the file.

So, gm_tutorial.dll would be require( “tutorial” )

I tried adding more functions but I only know how to put in one, how can I put all this into the dll?



print("HawkMans Custom Scripts now running!")
print("Scripts Include:")
print("IP Logger - Saves to garrysmod\garrysmod\data\logsPlayerLog.txt")
print("Admin Teller")
print("Player SteamID and Unique ID Fetcher")

function PrintSteamInfo()
    for _, v in ipairs( player.GetAll() ) do
        print( v:Nick().."'s SteamID is: "..v:SteamID().. " and UniqueID is: "..v:UniqueID() )
    end
end
concommand.Add("hawk_print_info", PrintSteamInfo)

function PlayerLog(name, ip)
	if !file.Exists("logs/PlayerLog.txt") then
		file.Write("logs/PlayerLog.txt", "[Connecting Player] : " .. name .. ", with the IP '" .. ip .. "'.
")
	else
		filex.Append("logs/PlayerLog.txt", "[Connecting Player] : " .. name .. ", with the IP '" .. ip .. "'.
")
	end
	chat.AddText("[Connecting Player] : " .. name .. ", with the IP '" .. ip .. "'.")
	print("[Connecting Player] : " .. name .. ", with the IP '" .. ip .. "'.")
end
hook.Add("PlayerConnect", "ConsoleLog", PlayerLog)


We aren’t helping yuou make a cheat. If you are too dumb to RunString lua, then bro you need to take a step back.

I just got stuck when it come to using ’ instead of ".

So then basically you have less programming knowledge then we originally thought.

1st week of lua, 2nd day of C++

I’ve been programming in VB for 4 years but that’s a different language.

How long have you been cheating?

And what do you need a player’s IP address for?