Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VOID WindowState(PSPAWNINFO pChar, PCHAR szLine)
- {
- CHAR Arg1[MAX_STRING] = {0};
- CHAR Arg2[MAX_STRING] = {0};
- GetArg(Arg1,szLine,1);
- GetArg(Arg2,szLine,2);
- if (PCSIDLWND pWnd=(PCSIDLWND)FindMQ2Window(Arg1))
- {
- DWORD ShowWindow = (DWORD)pWnd->pvfTable->ShowWindow;
- CHAR szBuffer[MAX_STRING] = {0};
- BYTE State=99;
- if (!stricmp(Arg2,"open")) State=1;
- if (!stricmp(Arg2,"close")) State=0;
- if (pWnd->dShow==State) State=99;
- switch (State) {
- case 0:
- ((CXWnd*)pWnd)->Show(0,1);
- sprintf(szBuffer,"Window '%s' is now closed.",pWnd->WindowText ? pWnd->WindowText->Text : Arg1);
- ((CSidlScreenWnd*)pWnd)->StoreIniVis();
- break;
- case 1:
- __asm {
- push ecx;
- mov ecx, [pWnd];
- call dword ptr [ShowWindow];
- pop ecx;
- }
- sprintf(szBuffer,"Window '%s' is now open.",pWnd->WindowText ? pWnd->WindowText->Text : Arg1);
- ((CSidlScreenWnd*)pWnd)->StoreIniVis();
- break;
- case 99:
- sprintf(szBuffer,"Window '%s' is currently %s",pWnd->WindowText ? pWnd->WindowText->Text : Arg1,(pWnd->dShow==0)?"closed":"open");
- break;
- }
- WriteChatColor(szBuffer,USERCOLOR_DEFAULT);
- return;
- }
- SyntaxError("Usage: /windowstate <window> [open|close]");
- }
Advertisement
Add Comment
Please, Sign In to add comment