Payday 2 LUA Hook TUT (Easy)
this is for the beta anyway, it wasn't updated for the full release yet.
Hey Sloth, I hate to ask but is there any way you could send this to me over skype or so?
Fair enough. I'll wait, hopefully it'll be up soon
Hopefully this gets approved soon!
lol, you can find this exact hook by googling "payday 2 lua hook"
And it works for the full release.
And don't take credit for others work.
And that's all folks.
And it works for the full release.
And don't take credit for others work.
And that's all folks.
do you mean that code?
#include "stdafx.h"
typedef int (__cdecl* luaL_loadstring_t)(lua_State *L, const char *s);
typedef int (__cdecl* lua_pcall_t)(lua_State* L, int nargs, int nresults, int errfunc);
typedef const char* (__cdecl* lua_tolstring_t)(lua_State *L, int idx, size_t *len);
typedef int (__thiscall* runData_t)(PaydayLua*, int, const char*);
luaL_loadstring_t pluaL_loadstring = (luaL_loadstring_t) 0x007BBC40;
lua_pcall_t plua_pcall = (lua_pcall_t) 0x007ACA10;
lua_tolstring_t plua_tolstring = (lua_tolstring_t) 0x007A6680;
_luaL_loadfile loadfile = (_luaL_loadfile)0x007BB9A0;
runData_t prunData = NULL;
void exec(lua_State* L, char* s)
{
gApp.AddToLogFileA("p.log", "Executing buffer...");
if(L == NULL)
{
gApp.AddToLogFileA("p.log", "L is NULL");
return;
}
//Load
int r1 = pluaL_loadstring(L, s);
if(r1 != 0)
{
if( LUA_ERRSYNTAX == r1 )
{
gApp.AddToLogFileA( "p.log", "Error loading Lua code into buffer with name (Syntax Error)[%s]", plua_tolstring(L, -1, NULL));
}
else if( LUA_ERRMEM == r1 )
{
gApp.AddToLogFileA( "p.log", "Error loading Lua code into buffer with name (Memory Allocation Error)[%s]", plua_tolstring(L, -1, NULL));
}
else
{
gApp.AddToLogFileA( "p.log", "Error loading Lua code into buffer with name (%i)", r1 );
}
return;
}
gApp.AddToLogFileA("p.log", "Load Success!");
//Call
int r2 = plua_pcall(L, 0, LUA_MULTRET, 0);
if(r2 != 0)
{
if( LUA_ERRRUN == r2 )
{
gApp.AddToLogFileA( "p.log", "Error calling Lua code (Runtime Error)[%s]", plua_tolstring(L, -1, NULL));
}
else if( LUA_ERRMEM == r2 )
{
gApp.AddToLogFileA( "p.log", "Error calling Lua code (Memory Allocation Error)[%s]", plua_tolstring(L, -1, NULL));
}
else if( LUA_ERRERR == r2 )
{
gApp.AddToLogFileA( "p.log", "Error calling Lua code (Error while running error handler)[%s]", plua_tolstring(L, -1, NULL));
}
else
{
gApp.AddToLogFileA( "p.log", "Error calling Lua code (%i)", r2 );
}
return;
}
gApp.AddToLogFileA("p.log", "Call Success!");
}
int __fastcall new_runData(PaydayLua* pthis, void* _EDX, int a2, const char* desc)
{
if(!_stricmp(desc, "update") && pthis->state)
{
if(GetAsyncKeyState(VK_INSERT) & 1)
{
exec(pthis->state, "print(\"s0beit rulz da moon\")");
}
}
return prunData(pthis, a2, desc);
}
BOOL APIENTRY DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved )
{
if(dwReason == DLL_PROCESS_ATTACH)
{
gApp.BaseUponModule(hModule);
gApp.AddToLogFileA("p.log", "PAYDAY 2 LUA HACK INITIALIZE");
prunData = (runData_t) DetourFunction((BYTE*)0x759A10, (BYTE*)new_runData);
}
return TRUE;
}
typedef int (__cdecl* luaL_loadstring_t)(lua_State *L, const char *s);
typedef int (__cdecl* lua_pcall_t)(lua_State* L, int nargs, int nresults, int errfunc);
typedef const char* (__cdecl* lua_tolstring_t)(lua_State *L, int idx, size_t *len);
typedef int (__thiscall* runData_t)(PaydayLua*, int, const char*);
luaL_loadstring_t pluaL_loadstring = (luaL_loadstring_t) 0x007BBC40;
lua_pcall_t plua_pcall = (lua_pcall_t) 0x007ACA10;
lua_tolstring_t plua_tolstring = (lua_tolstring_t) 0x007A6680;
_luaL_loadfile loadfile = (_luaL_loadfile)0x007BB9A0;
runData_t prunData = NULL;
void exec(lua_State* L, char* s)
{
gApp.AddToLogFileA("p.log", "Executing buffer...");
if(L == NULL)
{
gApp.AddToLogFileA("p.log", "L is NULL");
return;
}
//Load
int r1 = pluaL_loadstring(L, s);
if(r1 != 0)
{
if( LUA_ERRSYNTAX == r1 )
{
gApp.AddToLogFileA( "p.log", "Error loading Lua code into buffer with name (Syntax Error)[%s]", plua_tolstring(L, -1, NULL));
}
else if( LUA_ERRMEM == r1 )
{
gApp.AddToLogFileA( "p.log", "Error loading Lua code into buffer with name (Memory Allocation Error)[%s]", plua_tolstring(L, -1, NULL));
}
else
{
gApp.AddToLogFileA( "p.log", "Error loading Lua code into buffer with name (%i)", r1 );
}
return;
}
gApp.AddToLogFileA("p.log", "Load Success!");
//Call
int r2 = plua_pcall(L, 0, LUA_MULTRET, 0);
if(r2 != 0)
{
if( LUA_ERRRUN == r2 )
{
gApp.AddToLogFileA( "p.log", "Error calling Lua code (Runtime Error)[%s]", plua_tolstring(L, -1, NULL));
}
else if( LUA_ERRMEM == r2 )
{
gApp.AddToLogFileA( "p.log", "Error calling Lua code (Memory Allocation Error)[%s]", plua_tolstring(L, -1, NULL));
}
else if( LUA_ERRERR == r2 )
{
gApp.AddToLogFileA( "p.log", "Error calling Lua code (Error while running error handler)[%s]", plua_tolstring(L, -1, NULL));
}
else
{
gApp.AddToLogFileA( "p.log", "Error calling Lua code (%i)", r2 );
}
return;
}
gApp.AddToLogFileA("p.log", "Call Success!");
}
int __fastcall new_runData(PaydayLua* pthis, void* _EDX, int a2, const char* desc)
{
if(!_stricmp(desc, "update") && pthis->state)
{
if(GetAsyncKeyState(VK_INSERT) & 1)
{
exec(pthis->state, "print(\"s0beit rulz da moon\")");
}
}
return prunData(pthis, a2, desc);
}
BOOL APIENTRY DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved )
{
if(dwReason == DLL_PROCESS_ATTACH)
{
gApp.BaseUponModule(hModule);
gApp.AddToLogFileA("p.log", "PAYDAY 2 LUA HACK INITIALIZE");
prunData = (runData_t) DetourFunction((BYTE*)0x759A10, (BYTE*)new_runData);
}
return TRUE;
}
Sloth add your AV links so it can get approved
He said he couldn't post any AV links.
Why not? Its not like he cant edit his post
This thread is closed for replies.
Similar Threads
WarRock - International Hackstut How to hook tut 6 1 Crysis 2 Tutorials[Tut]Easy lvl 50 text onlyVI 22 Programming Tutorials[TUT] Easy Login/Register Form [NOOB FRIENDLY]IM 8 Programming Tutorials[TUT] Easy .DLL Injector ( Hand made Not Copy and Pasted )
3 Combat Arms Hacks & CheatsSpeed Hack TuT (Easy Directions W/ Pictures) 46
