|
08-29-2008
void JumpHeight(const char*, const char* CmdParams)
{
static const float JumpHeightLandOrig = *reinterpret_cast<float*>(__gf_JumpHeightLand);
static const float JumpHeightWaterOrig = *reinterpret_cast<float*>(__gf_JumpHeightWater);
stringstream Param(CmdParams);
float Multiplier;
Param >> Multiplier;
if (Multiplier < 0)
{
string Output = "Deviant: Please enter a valid jump height multiplier.";
gpConsole->Print(0,255,0,Output.c_str());
return;
}
DWORD dwOldProtectLand = 0;
void * LandAddress = reinterpret_cast<void*>(__gf_JumpHeightLand);
VirtualProtect(LandAddress, 8, PAGE_EXECUTE_READWRITE, &dwOldProtectLand);
*(float*)LandAddress = JumpHeightLandOrig * Multiplier;
VirtualProtect(LandAddress, 8, dwOldProtectLand, &dwOldProtectLand);
DWORD dwOldProtectWater = 0;
void * WaterAddress = reinterpret_cast<void*>(__gf_JumpHeightWater);
VirtualProtect(WaterAddress, 8, PAGE_EXECUTE_READWRITE, &dwOldProtectWater);
*(float*)WaterAddress = JumpHeightWaterOrig * Multiplier;
VirtualProtect(WaterAddress, 8, dwOldProtectWater, &dwOldProtectWater);
stringstream ssJumpHeight;
ssJumpHeight << Multiplier;
string Output = "Deviant: Set jump height multiplier to ";
Output.append(ssJumpHeight.str());
Output.append(".");
gpConsole->Print(0,255,0,Output.c_str());
} "Dream as if you'll live forever, live as if you'll die today." - James Dean |