public void GetUserData() { IntPtr buffer = new IntPtr(); WinAPIHelper.ReadProcessMemory(gameProcessHandle, (IntPtr)HookHelper.PlayerClientNumAddress, ref buffer, 4, IntPtr.Zero); //get clientnum userData.ClientNum = buffer.ToInt32(); userData.Name = GetPlayerName(userData.ClientNum); }
public string GetPlayerName(int clientNum) { if (clientNum < 0 && clientNum >= 32) { return(null); } IntPtr playerdataOffset = new IntPtr(); WinAPIHelper.ReadProcessMemory(gameProcessHandle, (IntPtr)0x977d54 + 4 * (1131 + clientNum), ref playerdataOffset, 4, IntPtr.Zero); //get if (playerdataOffset.ToInt32() == 0) { return(null); } StringBuilder clientData = new StringBuilder(2000); WinAPIHelper.ReadProcessMemory(gameProcessHandle, new IntPtr(0x9797e4 + playerdataOffset.ToInt32()), clientData, 1024, IntPtr.Zero); string[] stats = clientData.ToString().Split('\\'); return(RemoveColorModifiers(stats[1])); //hardcoded name offset }