mackal

Untitled

Sep 16th, 2015
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.58 KB | None | 0 0
  1. VOID WindowState(PSPAWNINFO pChar, PCHAR szLine)
  2. {
  3.     CHAR Arg1[MAX_STRING] = {0};
  4.     CHAR Arg2[MAX_STRING] = {0};
  5.     GetArg(Arg1,szLine,1);
  6.     GetArg(Arg2,szLine,2);
  7.     if (PCSIDLWND pWnd=(PCSIDLWND)FindMQ2Window(Arg1))
  8.     {
  9.         DWORD ShowWindow = (DWORD)pWnd->pvfTable->ShowWindow;
  10.         CHAR szBuffer[MAX_STRING] = {0};
  11.         BYTE State=99;
  12.         if (!stricmp(Arg2,"open")) State=1;
  13.         if (!stricmp(Arg2,"close")) State=0;
  14.         if (pWnd->dShow==State) State=99;
  15.         switch (State) {
  16.                 case 0:
  17.                     ((CXWnd*)pWnd)->Show(0,1);
  18.                     sprintf(szBuffer,"Window '%s' is now closed.",pWnd->WindowText ? pWnd->WindowText->Text : Arg1);
  19.                     ((CSidlScreenWnd*)pWnd)->StoreIniVis();
  20.                     break;
  21.                 case 1:
  22.                     __asm {
  23.                         push ecx;
  24.                         mov ecx, [pWnd];
  25.                         call dword ptr [ShowWindow];
  26.                         pop ecx;
  27.                     }
  28.                     sprintf(szBuffer,"Window '%s' is now open.",pWnd->WindowText ? pWnd->WindowText->Text : Arg1);
  29.                     ((CSidlScreenWnd*)pWnd)->StoreIniVis();
  30.                     break;
  31.                 case 99:
  32.                     sprintf(szBuffer,"Window '%s' is currently %s",pWnd->WindowText ? pWnd->WindowText->Text : Arg1,(pWnd->dShow==0)?"closed":"open");
  33.                     break;
  34.         }
  35.         WriteChatColor(szBuffer,USERCOLOR_DEFAULT);
  36.         return;
  37.     }
  38.     SyntaxError("Usage: /windowstate <window> [open|close]");
  39. }
Advertisement
Add Comment
Please, Sign In to add comment