You can only return a single datatype.
However, you can return a structure which contains multiple fields. Or you can pass a pointer as an argument.
I believe you're trying to use ReadProcessMemory to get the speed correct?
I don't really understand your question because you're passing float playerSpeed as an argument but not doing anything with it.
Then in your second code example you're calling GetPlayerGravity, not GetPlayerSpeed.
ReadProcessMemory you're passing &PlayerGravity, but where is PlayerGravity, is that a global variable?
But I'll assume this is what you're trying to do.
Code:
bool GetPlayerSpeed(HANDLE hProc, float* PlayerSpeed)
{
if (ReadProcessMemory(hProc, (LPCVOID)SpeedAddress, PlayerSpeed, sizeof(float), NULL))
{
return true;
}
return false;
}
Code:
float PlayerSpeed = 0;
if (GetPlayerSpeed(hProc, &PlayerSpeed))
{
cout << s << " = " << PlayerSpeed << endl;
}
else cout << "RPM returned false!" << endl;