but if i join a Game, CF crashes...D3DVIEWPORT9 g_ViewPort;
LPD3DXFONT g_pFont;
void DrawString(int x, int y, DWORD color, const char *fmt, ...)
{
RECT FontPos = { x, y, x + 120, y + 16 };
char buf[1024] = {'\0'};
va_list va_alist;
va_start(va_alist, fmt);
vsprintf(buf, fmt, va_alist);
va_end(va_alist);
g_pFont->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
}
HRESULT WINAPI hkEndScene (LPDIRECT3DDEVICE9 pDevice)
{
if(g_pFont == NULL) D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Verdana", &g_pFont);
pDevice->GetViewport(&g_ViewPort);
DrawString(g_ViewPort.Width/2,g_ViewPort.Height/2, 0xFF00FF00, "Values Saved");
return oEndScene (pDevice);
}

BOOL bInit = FALSE;
HRESULT WINAPI hkEndScene (LPDIRECT3DDEVICE9 pDevice)
{
_asm PUSHAD;
if( !bInit ) {
D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Verdana", &g_pFont);
bInit = TRUE;
}
pDevice->GetViewport(&g_ViewPort);
DrawString(g_ViewPort.Width/2,g_ViewPort.Height/2, 0xFF00FF00, "Values Saved");
_asm POPAD;
return oEndScene (pDevice);
}
HRESULT WINAPI ResetMe ( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS *pParameters )
{
if( g_pFont ) g_pFont->OnLostDevice();
HRESULT hRet = Reset_o( pDevice, pParameters );
if( g_pFont ) g_pFont->OnResetDevice();
return hRet;
}