❓ [Help] GMod game is crashing

Posts 1–2 of 2 · Page 1 of 1
❓ [Help] GMod game is crashing
Hey guys, I'm working on a hack and its crashing my game. And it's quite frustrating when I do lua_openscript_cl module.lua.

Heres my code.

Code:
#define GMMODULE

#include "GarrysMod\Lua\Interface.h"
#include "GarrysMod\Lua\UserData.h"
#include "mathlib/vector.h"
#include <string>
#include <chrono>
#include "basehandle.h"
#include "GarrysMod/Lua/Interface.h"
#include "CMoveData.h"
#include "CUserCmd.h"
#include <Windows.h>
#include "convar.h"
#include <iostream>
#include <fstream>
#include <string>
#include<cstdio>

using namespace GarrysMod::Lua;

CUserCmd* userCmd;
CMoveData* moveData;
ConVar* convar;
ICvar* GModCheck;


std::string stringVar = "Hello world!";

HWND gmod = FindWindow(NULL, TEXT("Garry's Mod"));

int VeriCheckProcess(lua_State* state) {
	if (!gmod) {
		GModCheck->ConsolePrintf("GMod not found");
	}
	else if (gmod) {
		GModCheck->ConsolePrintf("GMod found!");
	}

	return 0;
}

int VeriSVCheatsBP(lua_State* state) {
	convar->GetName();
	if (convar->GetName() == "sv_cheats") {
		convar->SetValue("sv_cheats 1");
		if (convar->IsRegistered) {
			GModCheck->ConsolePrintf("sv_cheats set to one!");
		}
	}
    return 0;
}

GMOD_MODULE_OPEN() {
	LUA->PushSpecial(SPECIAL_GLOB);
		LUA->PushCFunction(VeriSVCheatsBP);
		LUA->SetField(-2, "VeriSVCheatsBP");
		LUA->PushCFunction(VeriCheckProcess);
		LUA->SetField(-2, "VeriCheckProcess");
	LUA->Pop();

	return 0;
}

GMOD_MODULE_CLOSE() {
	return 0;
}
I put the dll in lua/bin. All help's appreciated, thanks. Also, please forgive me for my ignorance, as I'm quite new to hacking.
I've fixed it.
Code:
GModCheck->ConsolePrintf
was causing problems. But I've got a new issue.

I'm trying to make a simple bhop. Heres what I got

Code:
int VeriBHop(lua_State* state) {
	userCmd->upmove = 200.0f;

	return 0;
}
I really don't know whats wrong, but once again, when I type lua_openscript_cl module.lua it crashes the game. Here's my lua file.

Code:
require("veriscript26")

hook.Add( "KeyPress", "VeriBHop", function( ply, key )
	if ( key == IN_USE ) then
		VeriBHop()
	end
end )
VeriCheckProcess()
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us