Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- thanks to TheRouletteBoi: https://pastebin.com/VCfMb46E
- void PatchInJump(int Address, int Destination, bool Linked) {
- // use this data to copy over the address
- int FuncBytes[4];
- // Get the actual destination address
- Destination = *(int *)Destination;
- FuncBytes[0] = 0x3D600000 + ((Destination >> 16) & 0xFFFF); // lis %r11, dest>>16
- if (Destination & 0x8000) // If bit 16 is 1
- FuncBytes[0] += 1;
- FuncBytes[1] = 0x396B0000 + (Destination & 0xFFFF); // addi %r11, %r11, dest&0xFFFF
- FuncBytes[2] = 0x7D6903A6; // mtctr %r11
- FuncBytes[3] = 0x4E800420; // bctr
- if (Linked)
- FuncBytes[3] += 1; // bctrl
- write_process((void*)Address, FuncBytes, 4 * 4);
- }
- void branch_link(uint32_t branchTo, uint32_t branchFrom)
- {
- uint32_t branch;
- if (branchTo > branchFrom)
- {
- branch = 0x48000001 + (branchTo - branchFrom);
- }
- else
- {
- branch = 0x4C000001 - (branchFrom - branchTo);
- }
- write_process((void*)branchFrom, &branch, 4);
- }
- void PatchInBranch(uint32_t* address, uint32_t destination, bool linked)
- {
- uint32_t inst_branch = 0x48000000 + ((destination - (uint32_t)address) & 0x3FFFFFF); // b Destination
- if (linked)
- inst_branch += 1; // bl Destination
- write_process(address, &inst_branch, sizeof(inst_branch));
- }
- void PatchInVmt(uint32_t* address, uint32_t destination)
- {
- uint64_t raw = GetRawDestination(uint64_t, destination);
- write_process(address, &raw, sizeof(raw));
- }
- other class: https://github.com/Mr-X-GTA/GTAV-Classes-1/tree/master
- #define MAX_PLAYERS 64
- #define NAME_LENGTH 32
- typedef struct {
- char playerName[NAME_LENGTH]; // Nome del giocatore (buffer statico)
- } NetworkedPlayer;
- NetworkedPlayer Players[MAX_PLAYERS];
- int PlayersCount = 0;
- int NetworkedPlayersIndex = 0;
- uint32_t hashString(const char* str) {
- uint32_t hash = 5381;
- int c;
- while ((c = *str++)) {
- hash = ((hash << 5) + hash) + c;
- }
- return hash % MAX_PLAYERS;
- }
- int findPlayer(const char* name) {
- uint32_t hash = hashString(name);
- for (int i = 0; i < PlayersCount; i++) {
- if (hashString(Players[i].playerName) == hash && strcmp(Players[i].playerName, name) == 0) {
- return i;
- }
- }
- return -1;
- }
- void addPlayer(const char* name) {
- if (findPlayer(name) != -1) return; // already saved...
- if (PlayersCount < MAX_PLAYERS) {
- strncpy(Players[PlayersCount].playerName, name, NAME_LENGTH - 1);
- Players[PlayersCount].playerName[NAME_LENGTH - 1] = '\0';
- PlayersCount++;
- printf("Aggiunto: %s\n", name);
- }
- else {
- printf("The list is full! You can't add more players.\n");
- }
- }
- void removePlayer(const char* name) {
- int index = findPlayer(name);
- if (index != -1) {
- for (int i = index; i < PlayersCount - 1; i++) {
- Players[i] = Players[i + 1]; // Shift elements
- }
- PlayersCount--;
- printf("Removed: %s\n", name);
- }
- }
- void clearPlayers() {
- PlayersCount = 0;
- printf("Player list cleared.\n");
- }
- //in any your hook
- /*
- char* playerName = (char*)(*(int*)(dwNetPlayer + 0x78) + 0x10);
- addPlayer(playerName);
- */
- //Classic menu base:
- /*
- tip: add clearPlayers to "Networked Players" list.
- */
- case YourNetPlayers:
- addTitle("Networked Players");
- for (int i = 0; i < PlayersCount; i++) {
- if (Players[i].playerName == NULL) continue;
- char displayText[64];
- snprintf(displayText, sizeof(displayText), "%s", Players[i].playerName);
- addOption(displayText);
- }
- if (optionPress && currentOption - 1 >= 0)
- {
- NetworkedPlayersIndex = currentOption - 1;
- changeSubmenu(NetworkedPlayersIndexOpt);
- }
- break;
- case NetworkedPlayersIndexOpt:
- addTitle("Networked Players Index");
- addOption("Send Invite");
- addOption("Remove Player"); // remove player from your array
- switch (getOption())
- {
- case 1:
- SendGameInvite(PLAYER::GET_PLAYER_NAME(NetworkedPlayersIndex));
- break;
- case 2:
- removePlayer(PLAYER::GET_PLAYER_NAME(NetworkedPlayersIndex));
- break;
- }
- break;
- // I have not tested, but with this shit you can send invalid info to session (like your model hash). I dont write this shit for you. I have releasing this just for give ability to ppl how work desync and protections
- //0xA076FC UpdateNetworkObject aka SendCloneSync
- void hook::SendCloneSync(void* netSendData, void* netObject, void* syncTree, void* unk, int sendImmediately)
- {
- NetObject* obj = (NetObject*)netObject;
- printf("SendCloneSync | Count: %X\n", obj->syncCount);
- if (CloneCrashSpoof)
- {
- printf("[CRASH TEST] Overflowing sync buffer...\n");
- if (obj->syncBuffer)
- {
- for (int i = 0; i < 0x100; i++)
- {
- obj->syncBuffer[i] = 0xDE; // buffer overflow
- }
- }
- obj->timestamp = 0xFFFFFFFF;
- obj->syncCount = 0xFFFF;
- }
- Original Send Clone Sync = (netSendData, netObject, syncTree, unk, sendImmediately);
- }
- void vehicle::SetVehicleLight(float value) // visible to other player
- {
- int vehAddr = GetEntityAddress(PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false));
- if (vehAddr)
- *(float*)(vehAddr + 0x520) = value;
- }
- void vehicle::SetDirtyLevel(float level) // visible to other player
- {
- int vehAddr = GetEntityAddress(PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false));
- if (vehAddr)
- *(float*)(vehAddr + 0x50C) = level;
- }
- void vehicle::SetWheelType(int wheelType) // im not sure if it work
- {
- int vehAddr = GetEntityAddress(PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false));
- if (vehAddr)
- *(int*)(vehicleAddress + 0x664) = wheelType;
- }
- // pseudo code - gadgetId is hash - so, do you think if you set to another hash (like car), can freeze ppl? wtf R*
- void ped::SetGadget(int scriptHandle, uint32_t gadgetId, uint8_t flag) // flag always true
- {
- uint32_t* pedAddress = GetEntityAddress(scriptHandle); // debug it
- if (pedAddress == NULL)
- return;
- uint32_t** vtable = *(uint32_t***)pedAddress;
- if (vtable == NULL)
- return;
- if (call<int>(0x152060C)(pedAddress, gadgetId) == 0) // seems like check if pedAddress and gadgetId is valid
- return;
- int valBD4 = *(int*)((char*)pedAddress + 0xBD4);
- if (valBD4 == 0)
- return;
- int valBD8 = *(int*)((char*)pedAddress + 0xBD8);
- if (valBD8 == 0)
- return;
- // something for set it
- call<void>(0xFDA134)(pedAddress, gadgetId, -1, flag, 0, 0);
- }
- //this is just a pseudo code
- void ChangePedSyncTreeType(unsigned short newType) {
- //nah, it freeze all mod menu
- }
- struct CSyncDataWriter {
- uint8_t* buffer;
- size_t size;
- size_t pos;
- void Init(size_t bufferSize) {
- if (buffer) delete[] buffer;
- buffer = new uint8_t[bufferSize];
- size = bufferSize;
- pos = 0;
- memset(buffer, 0, size);
- }
- bool Write(const void* data, size_t dataSize) {
- if (pos + dataSize > size) return false; // overflow buffer
- memcpy(buffer + pos, data, dataSize);
- pos += dataSize;
- return true;
- }
- bool WriteUint64(uint64_t value) {
- return Write(&value, sizeof(value));
- }
- bool WriteUint32(uint32_t value) {
- return Write(&value, sizeof(value));
- }
- bool WriteByte(uint8_t value) {
- return Write(&value, sizeof(value));
- }
- void Reset() {
- pos = 0;
- if (buffer) memset(buffer, 0, size);
- }
- ~CSyncDataWriter() {
- if (buffer) {
- delete[] buffer;
- buffer = nullptr;
- }
- }
- };
- struct ConnectionType {
- int connectionId;
- bool isValid;
- };
- struct CLocalPlayerMgr {
- uint32_t playerId;
- char playerName[32];
- bool isConnected;
- };
- // Function to send a kick command
- void SendKick_v1(CNetGamePlayer* target, ConnectionType* connection, CLocalPlayerMgr* localPlayerMgr) {
- // 1. Prepare writer (initialize struct, then call function to setup)
- CSyncDataWriter writer = {}; // zero initialize
- call<void>(0xA8B814, &writer); // Assume function fills writer, returns void
- // 2. Buffer to hold the packet to send
- uint8_t extraData[0x3D6] = {};
- // 3. Prepare extra data from writer into extraData buffer
- call<void>(0xA8B908, &writer, extraData, sizeof(extraData));
- // 4. Write Kick message ID
- static const uint32_t MsgKickPlayer_AutoIdDesc = 0x1888B90;
- call<void>(0x1626844, &MsgKickPlayer_AutoIdDesc, &writer);
- // 5. Write hostToken (player UUID) of target player (64 bits)
- call<void>(0xA8BF68, &writer, target->playerInfo->uuid, 0x40);
- // 6. Serialize data into final buffer
- call<uint32_t>(0xA8B5FC, &writer);
- // 7. Optionally deserialize for checks
- call<uint32_t>(0xA8BBBC, &writer);
- // 8. Get final bit flag (state flags or similar)
- uint64_t bitFlag = call<uint64_t>(0xA8B978, &writer);
- // 9. Send reliable command with the prepared data
- call<uint32_t>(0xD11D0C, connection, localPlayerMgr, extraData, 1, bitFlag);
- }
- // I have not tested, if work... enjoy lol
- void SendKick(int selectedPlayer)
- {
- CNetGamePlayer* targetPlayer = CNetGamePlayerfn(selectedPlayer);
- if (!targetPlayer) {
- // handle error
- return;
- }
- ConnectionType connection = { true, 42 };
- CLocalPlayerMgr localPlayer = { 1, "" }; // i'm not sure
- strncpy(localPlayer.playerName, "LocalPlayer", sizeof(localPlayer.playerName)); // maybe use another name like
- get_player_name(selectedPlayer)...
- localPlayer.isConnected = true;
- SendKick_v1(targetPlayer, &connection, &localPlayer);
- }
Advertisement
Add Comment
Please, Sign In to add comment