Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //hidend
- #include <Windows.h>
- #include <d3d9.h>
- #include <cstdio>
- #include <iostream>
- uint32_t samp_base = 0;
- const DWORD OFFSETS[6][2]{
- /*ChatInfo, AddMsg*/
- {0x21A0E4, 0x645A0}, // 037-r1 - 0
- {0x021A0EC, 0x64670}, // 037-r2 - 1
- {0x026E8C8, 0x679F0}, // 037-r3_1 - 2
- {0x026E9F8, 0x68130}, // 037-r4 - 3
- {0x026E9F8, 0x68170}, // 037-r4_2 -4
- {0x026EB80, 0x68170}, // 037-r5_1 - 5
- };
- int get_samp_version_id()
- {
- int version_current = -1;
- if (samp_base)
- {
- std::cout << "Dentro!" << std::endl;
- int* x = reinterpret_cast<int*>((char*)samp_base + 0x128);
- int version_id = *x; // Directly dereference the pointer
- std::cout << "Version1: " << version_id << std::endl;
- switch (version_id) {
- case 0x5542F47A: //
- std::cout << "Hit!" << version_id << std::endl;
- version_current = 0;
- break;
- case 0x59C30C94: // R2
- version_current = 1;
- break;
- version_id = *(DWORD*)(samp_base + 0x120);
- switch (version_id) {
- case 0x5C0B4243: // R3
- version_current = 2;
- break;
- case 0x5DD606CD: // R4 - v1
- version_current = 3;
- break;
- case 0x6094ACAB: // R4 - v2
- version_current = 4;
- break;
- case 0x6372C39E: // R5, ni nos interesa pero meh
- version_current = 5;
- break;
- }
- }
- }
- return version_current;
- }
- void addMessageToChat(D3DCOLOR dwColor, const char* szMsg, ...)
- {
- int version = get_samp_version_id();
- std::cout << "Version2: " << version << std::endl;
- if (version == -1)
- return;
- DWORD chatInfoOffset = OFFSETS[version][0];
- DWORD addMsgOffset = OFFSETS[version][1];
- std::cout << "chatInfoOffset: " << chatInfoOffset << std::endl;
- std::cout << "addMsgOffset: " << addMsgOffset << std::endl;
- auto addMessage = reinterpret_cast<void(__thiscall*)(void* pChat, unsigned color, const char* message)>(samp_base + addMsgOffset);
- addMessage(*reinterpret_cast<void**>(samp_base + chatInfoOffset), dwColor, szMsg);
- }
- int init()
- {
- std::cout << "init" << std::endl;
- samp_base = (DWORD)LoadLibraryA("samp.dll");
- while (true)
- {
- addMessageToChat(-1, "Hidend // Shaarawy // <3");
- Sleep(5000);
- }
- return true;
- }
- BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
- {
- switch (dwReasonForCall)
- {
- case DLL_PROCESS_ATTACH:
- AllocConsole();
- freopen("CONOUT$", "w", stdout);
- std::cout << "injected" << std::endl;
- CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)init, NULL, NULL, NULL);
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement