Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CheckRobloxObject(lua_State* L, const int32_t idx) //some functions need this lol
- {
- const uint8_t Type = lua_type(L, idx);
- switch (Type)
- {
- case LUA_TFUNCTION:
- {
- if (reinterpret_cast<uintptr_t>(lua_tocfunction(L, idx)) == reinterpret_cast<uintptr_t>(FunctionHandling::RobloxCall))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- case LUA_TTABLE:
- {
- if (luaL_getmetafield(L, idx, "__key"))
- {
- lua_pop(L, 1);
- return true;
- }
- else
- {
- return false;
- }
- }
- case LUA_TUSERDATA:
- {
- uintptr_t RL = ExtraSpace::GetRoot(L)->RL;
- Wrapping::Wrap(L, RL, idx);
- if (r_luaL_getmetafield(RL, -1, "__type"))
- {
- r_lua_pop(RL, 2);
- return true;
- }
- else
- {
- r_lua_pop(RL, 1);
- return false;
- }
- }
- case LUA_TTHREAD:
- {
- if (ExtraSpace::GetRoot(L)->RLRef = NULL)
- return true;
- else
- return false;
- }
- default:
- {
- return false;
- }
- }
- }
- }
- }
- uintptr_t GetAddress(uintptr_t Closure); //some functions need this lol
- void SetAddress(uintptr_t Closure, uintptr_t To);
- const char* GetName(uintptr_t Closure);
- int SetFFlag(lua_State* L)
- {
- const std::string FlagName = lua_tostring(L, 1);
- const std::string SetTo = lua_tostring(L, 2);
- const bool Return = reinterpret_cast<int(__cdecl*)(const std::string&, const std::string&, int, bool)>(aslr(0x15A5DB0))(FlagName, SetTo, 1, true);//SetFFlag
- if (!Return)
- {
- lua_pushfstring(L, "%s FFlag does not exist!", FlagName.c_str());
- return lua_error(L);
- }
- return 0;
- }
- int HookFunction(lua_State* L)
- {
- const bool IsR = RobloxFunc::CheckRobloxObject(L, 1);
- if (IsR)
- {
- auto Space = ExtraSpace::GetRoot(L);
- uintptr_t RL = Space->RL;
- r_lua_settop(RL, 0);
- const uintptr_t Key = reinterpret_cast<uintptr_t>(lua_topointer(L, 2));
- Wrapping::Wrap(L, RL, 1);
- Wrapping::Wrap(L, RL, 2);
- if (r_lua_iscfunction(RL, 1))
- {
- const uintptr_t Replacement = GetAddress(reinterpret_cast<uintptr_t>(r_lua_topointer(RL, 2)));
- uintptr_t Closure2 = reinterpret_cast<uintptr_t>(r_lua_topointer(RL, 1));
- uintptr_t Index2Adr = reinterpret_cast<uintptr_t>(r_index2adr(RL, -2));
- uintptr_t Old = GetAddress(Closure2);
- uint8_t nupvals = *reinterpret_cast<uint8_t*>(Closure2 + x_closurenups);
- for (int i = 1; i <= nupvals; ++i)
- RobloxFunc::r2_lua_getupvalue(RL, -2 + ((i - 1) * -1), i);
- r_lua_pushcclosure(RL, Old, reinterpret_cast<int>(GetName(Closure2)), nupvals, NULL);
- Wrapping::Wrap(RL, L, -1);
- r_lua_pop(RL, 1);
- SetAddress(Closure2, Replacement);
- r_lua_newtable(RL);
- r_lua_pushstring(RL, "__func");
- r_lua_pushnumber(RL, Key);
- r_lua_settable(RL, -3);
- r_lua_pushstring(RL, "__thread");
- r_lua_pushlightuserdata(RL, Space->Main);
- r_lua_settable(RL, -3);
- r_lua_setfenv(RL, -3);
- r_lua_pop(RL, 2);
- return 1;
- }
- return luaL_error(L, "LClosure support not added");
- }
- else
- {
- return luaL_error(L, "Vanilla Closures support not added");
- }
- }
- int getconnections(lua_State* L) {
- if (!lua_isuserdata(L, 1) || !checksignal(L, 1))
- return luaL_argerror(L, 1, "signal expected");
- const auto EventInstance = *reinterpret_cast<std::uintptr_t*>(lua_touserdata(L, 1));
- const auto Source = reinterpret_cast<std::weak_ptr<uintptr_t>*>(EventInstance + 4)->lock();
- const auto Signal = reinterpret_cast<uintptr_t(__thiscall*)(uintptr_t*, bool)>(*reinterpret_cast<std::uintptr_t*>(EventInstance + 48))(Source.get(), true);
- return 1;
- }
- int getconnectionfunc(lua_State* L) {
- if (!lua_isuserdata(L, 1))
- return luaL_argerror(L, 1, "signal expected");
- DWORD Conn = (DWORD)lua_touserdata(L, 1);
- DWORD TR = GetConnectionTR(L, Conn);
- DWORD NRL = *(DWORD*)(*(DWORD*)(TR + 0x38) + 0x8);
- DWORD Idx = *(DWORD*)(TR + 0x40);
- lua_pushinteger(LS, Idx);
- lua_gettable(LS, LUA_REGISTRYINDEX);
- lua_xmove(LS, L, 1);
- return 1;
- }
- int getconnectionstate(lua_State* L)
- {
- if (!lua_isuserdata(L, 1))
- return luaL_argerror(L, 1, "signal expected");
- DWORD Conn = (DWORD)lua_touserdata(L, 1);
- DWORD TR = GetConnectionTR(L, Conn);
- DWORD NRL = *(DWORD*)(*(DWORD*)(TR + 0x38) + 0x8);
- lua_pushlightuserdata(L, (void*)NRL);
- return 1;
- }
- int GetNameCallMethod(lua_State* L)
- {
- uintptr_t RL = ExtraSpace::GetRoot(L)->RL;
- RobloxFunc::r_lua_pushobject(RL, *reinterpret_cast<uintptr_t*>(RL + x_namecall), R_LUA_TSTRING);
- Wrapping::Wrap(RL, L, -1);
- r_lua_pop(RL, 1);
- return 1;
- }
- int SetNameCallMethod(lua_State* L)
- {
- uintptr_t RL = ExtraSpace::GetRoot(L)->RL;
- *reinterpret_cast<uintptr_t*>(RL + x_namecall) = reinterpret_cast<uintptr_t>(index2adr(L, 1)->value.p);
- return 0;
- }
- int CheckCaller(lua_State* L)
- {
- uintptr_t Thread = ExtraSpace::GetRoot(L)->RLGiven;
- const uintptr_t Space = *reinterpret_cast<uintptr_t*>(Thread + x_Identity2);
- const uintptr_t Script = *reinterpret_cast<uintptr_t*>(Space + x_ScriptPtr);
- lua_pushboolean(L, !Script);
- return 1;
- }
- int UnLockModule(lua_State* L)
- {
- uintptr_t RL = ExtraSpace::GetRoot(L)->RL;
- Wrapping::Wrap(L, RL, 1);
- const uintptr_t Module = *reinterpret_cast<uintptr_t*>(r_lua_touserdata(RL, -1));
- *reinterpret_cast<int8_t*>(Module + x_UnLockModule) = 1;
- r_lua_pop(RL, 1);
- return 0;
- }
- int GetRawMetaTable(lua_State* L)
- {
- const bool RObject = RobloxFunc::CheckRobloxObject(L, 1);
- if (RObject)
- {
- uintptr_t RL = ExtraSpace::GetRoot(L)->RL;
- Wrapping::Wrap(L, RL, 1);
- if (r_lua_getmetatable(RL, -1))
- {
- Wrapping::Wrap(RL, L, -1);
- r_lua_pop(RL, 2);
- }
- else
- {
- r_lua_pop(RL, 1);
- return luaL_error(L, "Attempt to call getrawmetatable failed: Passed value does not have a metatable\n");
- }
- }
- else
- {
- if (!lua_getmetatable(L, 1))
- {
- return luaL_error(L, "Attempt to call getrawmetatable failed: Passed value does not have a metatable\n");
- }
- }
- return 1;
- }
- int FireClickDetector(lua_State* L)
- {
- uintptr_t RL = ExtraSpace::GetRoot(L)->RL;
- Wrapping::Wrap(L, RL, 1);
- const uintptr_t Click = *reinterpret_cast<uintptr_t*>(r_lua_touserdata(RL, -1));
- float Distance = 0;
- if (lua_gettop(L) > 1)
- Distance = lua_tonumber(L, 2);
- r_lua_getglobal(RL, "game");
- r_lua_getfield(RL, -1, "GetService");
- r_lua_insert(RL, -2);
- r_lua_pushstring(RL, "Players");
- r_lua_pcall(RL, 2, 1, 0);
- r_lua_getfield(RL, -1, "LocalPlayer");
- const uintptr_t LP = *reinterpret_cast<uintptr_t*>(r_lua_touserdata(RL, -1));
- r_fireclickdetector(Click, Distance, LP);
- r_lua_pop(RL, 2);
- return 0;
- }
- int GetGC(lua_State* L)
- {
- int Index = 1;
- uintptr_t RL = ExtraSpace::GetRoot(L)->RL;
- uintptr_t GlobalState = GetGlobalState(RL);
- GCObject* GC_Objects = *reinterpret_cast<GCObject**>(GlobalState + x_rootgc);
- r_lua_newtable(RL);
- while (GC_Objects != nullptr)
- {
- const auto GC_Type = *reinterpret_cast<uint8_t*>((reinterpret_cast<uint32_t>(GC_Objects) + x_gchtt));
- if ((GC_Type == R_LUA_TTABLE || GC_Type == R_LUA_TFUNCTION || GC_Type == R_LUA_TUSERDATA))
- {
- RobloxFunc::r_lua_pushobject(RL, reinterpret_cast<uintptr_t>(GC_Objects), GC_Type);
- r_lua_rawseti(RL, -2, Index++);
- }
- GC_Objects = GC_Objects->gch.next;
- }
- Wrapping::Wrap(RL, L, -1);
- r_lua_pop(RL, 1);
- return 1;
- }
- int SetClipboard(lua_State* L)
- {
- std::size_t Length;
- const char* Setting = lua_tolstring(L, 1, &Length);
- if (OpenClipboard(NULL))
- {
- if (EmptyClipboard())
- {
- HGLOBAL hglbCopy = GlobalAlloc(GMEM_FIXED, Length + 1);
- if (hglbCopy == NULL)
- {
- CloseClipboard();
- return luaL_error(L, "Failed to SetClipboard");
- }
- memcpy(hglbCopy, Setting, Length + 1);
- if (!SetClipboardData(CF_TEXT, hglbCopy))
- {
- CloseClipboard();
- GlobalFree(hglbCopy);
- return luaL_error(L, "Failed to SetClipboard");
- }
- CloseClipboard();
- }
- else
- {
- return luaL_error(L, "Failed to SetClipboard");
- }
- }
- else
- {
- return luaL_error(L, "Failed to SetClipboard");
- }
- return 0;
- }
- int GetClipboard(lua_State* L)
- {
- std::size_t Length;
- const char* Setting = lua_tolstring(L, 1, &Length);
- if (OpenClipboard(NULL))
- {
- HANDLE Got = GetClipboardData(CF_TEXT);
- if (Got == nullptr)
- {
- CloseClipboard();
- return luaL_error(L, "Failed to GetClipboard");
- }
- char* pszText = static_cast<char*>(GlobalLock(Got));
- if (pszText == nullptr)
- {
- CloseClipboard();
- return luaL_error(L, "Failed to GetClipboard");
- }
- std::string text(pszText);
- GlobalUnlock(Got);
- CloseClipboard();
- lua_pushstring(L, text.c_str());
- return 1;
- }
- else
- {
- return luaL_error(L, "Failed to GetClipboard");
- }
- }
- int GetRegList(lua_State* L)
- {
- uintptr_t RL = ExtraSpace::GetRoot(L)->RL;
- r_lua_pushlightuserdata(RL, reinterpret_cast<void*>(aslr(x_RobloxInstancePushFunction)));
- r_lua_rawget(RL, LUA_REGISTRYINDEX);
- Wrapping::Wrap(RL, L, -1);
- r_lua_pop(RL, 1);
- return 1;
- }
- int IsCClosure(lua_State* L)
- {
- luaL_checktype(L, 1, LUA_TFUNCTION);
- const bool IsR = RobloxFunc::CheckRobloxObject(L, 1);
- if (IsR)
- {
- uintptr_t RL = ExtraSpace::GetRoot(L)->RL;
- Wrapping::Wrap(L, RL, 1);
- lua_pushboolean(L, r_lua_iscfunction(RL, -1));
- r_lua_pop(RL, 1);
- }
- else
- {
- lua_pushboolean(L, lua_iscfunction(L, 1));
- }
- return 1;
- }
- int newcclosure(lua_State* L) {
- if (!lua_iscfunction(L, -1))
- return luaL_argerror(L, -1, "expected function as argument #1");
- Wrapper::UnWrap(L, RLS, 1);
- lua_tocfunction(L, -1);
- return 1;
- }
- int setreadonly(lua_State* L)//Table, Bool
- {
- luaL_checktype(L, 1, LUA_TTABLE);
- luaL_checktype(L, 2, LUA_TBOOLEAN);
- if (!luaL_getmetafield(L, 1, "__key"))
- {
- index2adr(L, 1)->value.gc->h.readonly = lua_toboolean(L, 2);
- }
- else
- {
- lua_pop(L, 1);
- *reinterpret_cast<uint8_t*>(index2adr(L, 1)->value.gc->h.readonly) = lua_toboolean(L, 2);
- }
- return 0;
- }
- int isreadonly(lua_State* L)
- {
- luaL_checkany(L, 1);
- if (!luaL_getmetafield(L, 1, "__key"))
- {
- lua_pushboolean(L, index2adr(L, 1)->value.gc->h.readonly);
- }
- else
- {
- lua_pop(L, 1);
- lua_pushboolean(L, *reinterpret_cast<uint8_t*>(index2adr(L, 1)->value.gc->h.readonly));
- }
- return 1;
- }
- int ReadFile(lua_State* L)
- {
- const char* Name = lua_tostring(L, 1);
- std::string Dir = Tools::Files::GetDLLPath("\\workspace").append("\\" + std::string(Name));
- std::ifstream infile(Dir.c_str());
- if (!infile.good())
- {
- return luaL_error(L, "File Does Not Exist!");
- }
- lua_pushstring(L, Tools::Files::ReadFile(Dir).c_str());
- return 1;
- }
- int WriteFile(lua_State* L)
- {
- const char* Name = lua_tostring(L, 1);
- const char* Writing = lua_tostring(L, 2);
- Tools::Files::WriteFile(Tools::Files::GetDLLPath("\\workspace").append("\\" + std::string(Name)), Writing);
- return 0;
- }
- static int getgenv(lua_State* L) {
- lua_pushvalue(LS, LUA_GLOBALSINDEX);
- lua_xmove(LS, L, 1);
- return 1;
- }
- int getsenv(lua_State* LS) {
- lua_pushvalue(LS, LUA_ENVIRONINDEX);
- Wrapper::Wrap(RLS, LS, -1);
- return 1;
- }
- int getrenv(lua_State* L) {
- r_lua_pushvalue(RLS, int(RLS));
- Wrapper::Wrap(RLS, L, -1);
- return 1;
- }
- int getreg(lua_State* L) {
- lua_pushvalue(L, LUA_REGISTRYINDEX);
- return 1;
- }
- int getfenv(lua_State* m_L) {
- lua_pushvalue(LS, LUA_GLOBALSINDEX);
- lua_xmove(LS, m_L, 1);
- return 1;
- }
- int setidentity(lua_State* L) {
- int unk[] = { NULL, NULL };
- int level = lua_tonumber(L, -1);
- SandBoxThread(RLS, &level, (int)unk);
- return 0;
- }
- int isrbxactive(lua_State* L) {
- HWND RobloxWindow;
- RobloxWindow = FindMainWindow(GetCurrentProcessId());
- lua_pushboolean(L, GetForegroundWindow() == RobloxWindow);
- return 1;
- }
- int error(lua_State* L) {
- Print(3, lua_tostring(L, -1));
- return 1;
- }
- int info(lua_State* L) {
- Print(1, lua_tostring(L, -1));
- return 1;
- }
- int Debug_SetMetaTable(lua_State* L) {
- if (lua_gettop(L) == 0) {
- luaL_error(L, "'debug.setmetatable' needs at least 1 argument.");
- return 0;
- }
- r_lua_pushboolean(RLS, lua_setmetatable(L, 1));
- return 1;
- }
- static int Debug_setfenv(lua_State* L) {
- luaL_checktype(L, 2, LUA_TTABLE);
- lua_settop(L, 2);
- if (lua_setfenv(L, 1) == 0)
- luaL_error(L, LUA_QL("setfenv")
- " cannot change environment of given object");
- return 1;
- }
- int Debug_GetMetaTable(lua_State* L) {
- if (lua_gettop(L) == 0) {
- luaL_error(L, "'debug.getrawmetatable' needs 1 argument.");
- return 0;
- }
- Wrapper::Wrap(RLS, L, 1);
- if (r_lua_getmetatable(RLS, -1) == 0) {
- lua_pushnil(L);
- return 0;
- }
- Wrapper::UnWrap(L, RLS, -1);
- return 1;
- }
- int Debug_GetRegistry(lua_State* L) {
- r_lua_pushvalue(RLS, LUA_REGISTRYINDEX);
- return 1;
- }
- static int Debug_traceback(lua_State* L) {
- int level;
- int firstpart = 1; /* still before eventual `...' */
- int arg;
- lua_State* L1 = getthread(L, &arg);
- lua_Debug ar;
- if (lua_isnumber(L, arg + 2)) {
- level = (int)lua_tointeger(L, arg + 2);
- lua_pop(L, 1);
- }
- else
- level = (L == L1) ? 1 : 0; /* level 0 may be this own function */
- if (lua_gettop(L) == arg)
- lua_pushliteral(L, "");
- else if (!lua_isstring(L, arg + 1)) return 1; /* message is not a string */
- else lua_pushliteral(L, "\n");
- lua_pushliteral(L, "stack traceback:");
- while (lua_getstack(L1, level++, &ar)) {
- if (level > LEVELS1 && firstpart) {
- /* no more than `LEVELS2' more levels? */
- if (!lua_getstack(L1, level + LEVELS2, &ar))
- level--; /* keep going */
- else {
- lua_pushliteral(L, "\n\t..."); /* too many levels */
- while (lua_getstack(L1, level + LEVELS2, &ar)) /* find last levels */
- level++;
- }
- firstpart = 0;
- continue;
- }
- lua_pushliteral(L, "\n\t");
- lua_getinfo(L1, "Snl", &ar);
- lua_pushfstring(L, "%s:", ar.short_src);
- if (ar.currentline > 0)
- lua_pushfstring(L, "%d:", ar.currentline);
- if (*ar.namewhat != '\0') /* is there a name? */
- lua_pushfstring(L, " in function " LUA_QS, ar.name);
- else {
- if (*ar.what == 'm') /* main? */
- lua_pushfstring(L, " in main chunk");
- else if (*ar.what == 'C' || *ar.what == 't')
- lua_pushliteral(L, " ?"); /* C function or tail call */
- else
- lua_pushfstring(L, " in function <%s:%d>",
- ar.short_src, ar.linedefined);
- }
- lua_concat(L, lua_gettop(L) - arg);
- }
- lua_concat(L, lua_gettop(L) - arg);
- return 1;
- }
- int getupvalues(lua_State* L)
- {
- lua_pushvalue(L, 1);
- lua_newtable(L);
- int idx = 1;
- while (true)
- {
- const char* name = lua_getupvalue(L, -2, idx);
- if (!name)
- {
- break;
- }
- lua_setfield(L, -2, name);
- idx++;
- }
- return 1;
- }
- static int Debug_getupvalue(lua_State* L) {
- return auxupvalue(L, 1);
- }
- static int Debug_setupvalue(lua_State* L) {
- luaL_checkany(L, 3);
- return auxupvalue(L, 0);
- }
- int setlocal(lua_State* L) {
- luaL_checktype(L, 1, R_LUA_TNUMBER);
- luaL_checktype(L, 2, R_LUA_TSTRING);
- luaL_checkany(L, 3);
- const char* Name = lua_tostring(L, 2);
- lua_Debug ar;
- if (!lua_getstack(L, lua_tointeger(L, 1), &ar))
- return luaL_argerror(L, 1, "level out of range");
- int n = 1;
- while (const char* name = lua_getlocal(L, &ar, n))
- {
- lua_pop(L, 1);
- if (!strcmp(name, Name))
- {
- lua_pushvalue(L, 3);
- lua_setlocal(L, &ar, n);
- lua_pushboolean(L, true);
- return 1;
- }
- n++;
- }
- lua_pushboolean(L, false);
- return 1;
- }
- int getlocal(lua_State* L) {
- luaL_checktype(L, 1, R_LUA_TNUMBER);
- luaL_checktype(L, 2, R_LUA_TSTRING);
- const char* Name = lua_tostring(L, 2);
- lua_Debug ar;
- if (!lua_getstack(L, lua_tointeger(L, 1), &ar))
- return luaL_argerror(L, 1, "level out of range");
- int n = 1;
- while (const char* name = lua_getlocal(L, &ar, n))
- {
- if (!strcmp(name, Name)) return 1;
- lua_pop(L, 1);
- n++;
- }
- lua_pushnil(L);
- return 1;
- }
- int getlocals2(lua_State* L) {
- lua_Debug ar;
- if (!lua_getstack(L, luaL_checkinteger(L, 1), &ar))
- return luaL_argerror(L, 1, "level out of range");
- lua_newtable(L);
- int n = 1;
- while (const char* name = lua_getlocal(L, &ar, n))
- {
- if (strcmp("(*temporary)", name) != 0)
- {
- lua_pushstring(L, name);
- lua_pushvalue(L, -2);
- lua_settable(L, -4);
- }
- lua_pop(L, 1);
- n++;
- }
- return 1;
- }
- static void settabss(lua_State* L, const char* i, const char* v) { //needed for getinfo
- lua_pushstring(L, v);
- lua_setfield(L, -2, i);
- }
- static void settabsi(lua_State* L, const char* i, int v) { //needed for getinfo
- lua_pushinteger(L, v);
- lua_setfield(L, -2, i);
- }
- static int Debug_getinfo(lua_State* L) {
- lua_Debug ar;
- int arg;
- lua_State* L1 = getthread(L, &arg);
- const char* options = luaL_optstring(L, arg + 2, "flnSu");
- if (lua_isnumber(L, arg + 1)) {
- if (!lua_getstack(L1, (int)lua_tointeger(L, arg + 1), &ar)) {
- lua_pushnil(L); /* level out of range */
- return 1;
- }
- }
- else if (lua_isfunction(L, arg + 1)) {
- lua_pushfstring(L, ">%s", options);
- options = lua_tostring(L, -1);
- lua_pushvalue(L, arg + 1);
- lua_xmove(L, L1, 1);
- }
- else
- return luaL_argerror(L, arg + 1, "function or level expected");
- if (!lua_getinfo(L1, options, &ar))
- return luaL_argerror(L, arg + 2, "invalid option");
- lua_createtable(L, 0, 2);
- if (strchr(options, 'S')) {
- settabss(L, "source", ar.source);
- settabss(L, "short_src", ar.short_src);
- settabsi(L, "linedefined", ar.linedefined);
- settabsi(L, "lastlinedefined", ar.lastlinedefined);
- settabss(L, "what", ar.what);
- }
- if (strchr(options, 'l'))
- settabsi(L, "currentline", ar.currentline);
- if (strchr(options, 'u'))
- settabsi(L, "nups", ar.nups);
- if (strchr(options, 'n')) {
- settabss(L, "name", ar.name);
- settabss(L, "namewhat", ar.namewhat);
- }
- if (strchr(options, 'L'))
- treatstackoption(L, L1, "activelines");
- if (strchr(options, 'f'))
- treatstackoption(L, L1, "func");
- return 1; /* return table */
- }
- //mouse lib
- INPUT Inputs[1] = { 0 };
- int Mouse1Down(lua_State* LS) {
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN;
- SendInput(1, Inputs, sizeof(INPUT));
- return 0;
- }
- int Mouse1Up(lua_State* L) {
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP;
- SendInput(1, Inputs, sizeof(INPUT));
- return 0;
- }
- int Mouse2Down(lua_State* L) {
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_RIGHTDOWN;
- SendInput(1, Inputs, sizeof(INPUT));
- return 0;
- }
- int Mouse2Up(lua_State* L) {
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_RIGHTUP;
- SendInput(1, Inputs, sizeof(INPUT));
- return 0;
- }
- int Mouse1Click(lua_State* L) {
- float n = lua_tonumber(L, -1);
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN;
- SendInput(1, Inputs, sizeof(INPUT));
- Sleep(n);
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP;
- SendInput(1, Inputs, sizeof(INPUT));
- return 0;
- }
- int Mouse2Click(lua_State* L) {
- float n = lua_tonumber(L, -1);
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN;
- SendInput(1, Inputs, sizeof(INPUT));
- Sleep(n);
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP;
- SendInput(1, Inputs, sizeof(INPUT));
- return 0;
- }
- int MouseScroll(lua_State* L) {
- int amount = lua_tonumber(L, -1);
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_HWHEEL;
- Inputs[0].mi.mouseData = amount;
- SendInput(1, Inputs, sizeof(INPUT));
- Inputs[0].mi.mouseData = NULL;
- return 0;
- }
- int MouseMoveRelative(lua_State* L) {
- LONG x = lua_tonumber(L, -2);
- LONG y = lua_tonumber(L, -1);
- POINT p;
- if (GetCursorPos(&p))
- {
- Inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
- Inputs[0].mi.dx = ((p.x + x) * 0xFFFF / GetSystemMetrics(SM_CXSCREEN) + 1);
- Inputs[0].mi.dy = ((p.y + y) * 0xFFFF / GetSystemMetrics(SM_CYSCREEN) + 1);
- SendInput(1, Inputs, sizeof(INPUT));
- }
- return 0;
- }
- //keyboard lib
- INPUT Inputs[1] = { 0 };
- int KeyPress(lua_State* L) {
- WORD key = lua_tonumber(L, -1);
- Inputs[0].ki.wVk = key;
- SendInput(1, Inputs, sizeof(INPUT));
- Inputs[0].ki.wVk = NULL;
- return 0;
- }
- int KeyRelease(lua_State* L) {
- WORD key = lua_tonumber(L, -1);
- Inputs[0].ki.wVk = key;
- Inputs[0].mi.dwFlags = KEYEVENTF_KEYUP;
- SendInput(1, Inputs, sizeof(INPUT));
- Inputs[0].mi.dwFlags = NULL;
- Inputs[0].ki.wVk = NULL;
- return 0;
- }
- int KeyTap(lua_State* L) {
- WORD key = lua_tonumber(L, -2);
- int delay = lua_tonumber(L, -1);
- Inputs[0].ki.wVk = key;
- SendInput(1, Inputs, sizeof(INPUT));
- Sleep(delay);
- Inputs[0].mi.dwFlags = KEYEVENTF_KEYUP;
- SendInput(1, Inputs, sizeof(INPUT));
- Inputs[0].mi.dwFlags = NULL;
- Inputs[0].ki.wVk = NULL;
- return 0;
- }
- int IsReady(lua_State* L) {
- lua_pushboolean(L, READY);
- return 1;
- }
- int hashProtect(lua_State* L) { // to use this function you need to add sha.cpp in ur project this is the code for that https://pastebin.com/raw/xQdrkJqf
- string input = lua_tostring(L, -1);
- lua_pushstring(L, sha256(input).c_str());
- return 1;
- }
- int EncodeBase64(lua_State* L) { // to use this function you need to add Base64.cpp in ur project this is the code for that https://pastebin.com/raw/2HjcFtiy
- string data = lua_tostring(L, 1);
- lua_pushstring(L, base64_encode(data).c_str());
- return 1;
- }
- int DecodeBase64(lua_State* L) { // to use this function you need to add Base64.cpp in ur project this is the code for that https://pastebin.com/raw/2HjcFtiy
- string data = lua_tostring(L, 1);
- lua_pushstring(L, base64_decode(data).c_str());
- return 1;
- }
- static int EQ(lua_State* Thread) {
- lua_pushboolean(Thread, (*(DWORD*)lua_touserdata(Thread, 1) == *(DWORD*)lua_touserdata(Thread, 2)));
- return 1;
- }
- static int GC(lua_State* Thread) {
- void* UD = lua_touserdata(Thread, 1);
- if (RLS) {
- r_lua_rawgeti(RLS, LUA_REGISTRYINDEX, (int)UD);
- if (r_lua_type(RLS, -1) <= R_LUA_TNIL) {
- lua_pushnil(Thread);
- lua_rawseti(Thread, LUA_REGISTRYINDEX, (int)UD);
- }
- }
- return 0;
- }
- //how to register them lol
- lua_register(LS, "setfflag", SetFFlag);
- lua_register(LS, "hookfunction", HookFunction);
- lua_register(LS, "getconnections", getconnections);
- lua_register(LS, "getconnectionfunc", getconnectionfunc);
- lua_register(LS, "getconnectionstate", getconnectionstate);
- lua_register(LS, "getnamecallmethod", GetNameCallMethod);
- lua_register(LS, "setnamecallmethod", SetNameCallMethod);
- lua_register(LS, "checkcaller", CheckCaller);
- lua_register(LS, "unlockmodule", UnLockModule);
- lua_register(LS, "getrawmetatable", GetRawMetaTable);
- lua_register(LS, "fireclickdetector", FireClickDetector);
- lua_register(LS, "getgc", GetGC);
- lua_register(LS, "setclipboard", SetClipboard);
- lua_register(LS, "getclipboard", GetClipboard);
- lua_register(LS, "getreglist", GetRegList);
- lua_register(LS, "iscclosure", IsCClosure);
- lua_register(LS, "newcclosure", newcclosure);
- lua_register(LS, "setreadonly", setreadonly);
- lua_register(LS, "isreadonly", isreadonly);
- lua_register(LS, "readfile", ReadFile);
- lua_register(LS, "writefile", WriteFile);
- lua_register(LS, "getgenv", getgenv);
- lua_register(LS, "getsenv", getsenv);
- lua_register(LS, "getrenv", getrenv);
- lua_register(LS, "getreg", getreg);
- lua_register(LS, "getfenv", getfenv);
- lua_register(LS, "setidentity", setidentity);
- lua_register(LS, "isrbxactive", isrbxactive);
- lua_register(LS, "error", error);
- lua_register(LS, "warn", warn);
- lua_register(LS, "setmetatable", Debug_SetMetaTable);
- lua_register(LS, "setfenv", Debug_SetFenv);
- lua_register(LS, "getmetatable", Debug_GetMetaTable);
- lua_register(LS, "getregistry", Debug_GetRegistry);
- lua_register(LS, "traceback", Debug_traceback);
- lua_register(LS, "getupvalues", getupvalues);
- lua_register(LS, "getupvalue", Debug_getupvalue);
- lua_register(LS, "setupvalue", Debug_setupvalue);
- lua_register(LS, "setlocal", setlocal);
- lua_register(LS, "getlocal", getlocal);
- lua_register(LS, "getlocals", getlocals2);
- lua_register(LS, "getinfo", Debug_getinfo);
- lua_register(LS, "mousemoverel", MouseMoveRelative);
- lua_register(LS, "mousemoverelative", MouseMoveRelative);
- lua_register(LS, "mousescroll", MouseScroll);
- lua_register(LS, "MouseButton1Click", Mouse1Click);
- lua_register(LS, "MouseButton1Press", Mouse1Down);
- lua_register(LS, "MouseButton1Release", Mouse1Up);
- lua_register(LS, "MouseButton2Click", Mouse2Click);
- lua_register(LS, "MouseButton2Press", Mouse2Down);
- lua_register(LS, "MouseButton2Release", Mouse2Up);
- lua_register(LS, "MouseButton1Down", Mouse1Down);
- lua_register(LS, "MouseButton1Up", Mouse1Up);
- lua_register(LS, "MouseButton2Down", Mouse2Down);
- lua_register(LS, "MouseButton2Up", Mouse2Up);
- lua_register(LS, "keypress", KeyPress);
- lua_register(LS, "keyrelease", KeyRelease);
- lua_register(LS, "keytap", KeyTap);
- lua_register(LS, "isready", IsReady);
- lua_register(LS, "hashprotect", hashProtect); // to use this function you need to add sha.cpp in ur project this is the code for that https://pastebin.com/raw/xQdrkJqf
- lua_register(LS, "EncodeBase64", EncodeBase64); // to use this function you need to add Base64.cpp in ur project this is the code for that https://pastebin.com/raw/2HjcFtiy
- lua_register(LS, "DecodeBase64", DecodeBase64); // to use this function you need to add Base64.cpp in ur project this is the code for that https://pastebin.com/raw/2HjcFtiy
- lua_register(LS, "EQ", EQ);
- lua_register(LS, "GC", GC);
Add Comment
Please, Sign In to add comment