Cod4 SendConsole Command

void SendConsoleCommand(int x,int y,char *cvar)

{
       _asm push cvar //push the arguments to stack

       _asm push x2   //push the arguments to stack

       _asm push x    //push the arguments to stack

       _asm mov esi, 0x4F9AB0  //Set up the call

       _asm call esi  //Do the call 

}

# Usage
if(GetAsyncKeyState(VK_F11))
{
      MessageBoxA(0, "", "Closing", 4);
      EngGameHook.CG_trap_SendConsoleCommand(1, 1, "quit"); // if we press F11 then it'll quit
}
原文地址:https://www.cnblogs.com/matt1985/p/13121320.html