Alerd Posted March 23, 2013 Author Share Posted March 23, 2013 I'm looking for code that will block the possibility of logging out in combatI found something but the ee: <http://www.touchofdeathforums.com/community/index.php?/topic/80925-disallow-log-out-while-fighting/page__hl__logout Link to comment Share on other sites More sharing options...
Yuko Posted March 23, 2013 Share Posted March 23, 2013 I don't know if those codes on there work.I think instead of finding a way to not let them combat log is to go like let them combat log, but when they logout within like 10 seconds of a fight, they would die and their stuff would drop.That's a good idea I think. Link to comment Share on other sites More sharing options...
tslusny Posted March 23, 2013 Share Posted March 23, 2013 This tut http://www.touchofdeathforums.com/community/index.php?/topic/80925-disallow-log-out-while-fighting/page__hl__logout is….. Do not try to fix it, it is waste of time. Players can still use Alt+F4 to exit game or end task throught task manager. That tut is waste of time. Link to comment Share on other sites More sharing options...
Matt Posted March 24, 2013 Share Posted March 24, 2013 Add a value in the playerrec and when the player attacks something, or is attacked, the value is set to, say 10\. Then every second in serverloop, the value goes down by one. That should give you an idea on how to do it. Link to comment Share on other sites More sharing options...
tslusny Posted March 24, 2013 Share Posted March 24, 2013 Some little snippet what will disable Alt ESC and Ctrl ESC (it can disable Alt F4 also). It is usefull for this thing. I found it here: [http://www.vbforums….LT-F4-(Globally](http://www.vbforums.com/showthread.php?506097-Resolved-Disable-ALT-F4-(Globally))```Private Const WH_KEYBOARD_LL = 13& 'enables monitoring of keyboard'input events about to be posted'in a thread input queuePrivate Const HC_ACTION = 0& 'wParam and lParam parameters'contain information about a'keyboard messagePrivate Const LLKHF_EXTENDED = &H1& 'test the extended-key flagPrivate Const LLKHF_INJECTED = &H10& 'test the event-injected flagPrivate Const LLKHF_ALTDOWN = &H20& 'test the context codePrivate Const LLKHF_UP = &H80& 'test the transition-state flagPrivate Const VK_TAB = &H9 'virtual key constantsPrivate Const VK_CONTROL = &H11Private Const VK_ESCAPE = &H1BPrivate Type KBDLLHOOKSTRUCTvkCode As Long 'a virtual-key code in the range 1 to 254scanCode As Long 'hardware scan code for the keyflags As Long 'specifies the extended-key flag,'event-injected flag, context code,'and transition-state flagtime As Long 'time stamp for this messagedwExtraInfo As Long 'extra info associated with the messageEnd TypePrivate Declare Function SetWindowsHookEx Lib "user32" _Alias "SetWindowsHookExA" _(ByVal idHook As Long, _ByVal lpfn As Long, _ByVal hmod As Long, _ByVal dwThreadId As Long) As LongPrivate Declare Function UnhookWindowsHookEx Lib "user32" _(ByVal hHook As Long) As LongPrivate Declare Function CallNextHookEx Lib "user32" _(ByVal hHook As Long, _ByVal nCode As Long, _ByVal wParam As Long, _ByVal lParam As Long) As LongPrivate Declare Sub CopyMemory Lib "kernel32" _Alias "RtlMoveMemory" _(pDest As Any, _pSource As Any, _ByVal cb As Long)Private Declare Function GetAsyncKeyState Lib "user32" _(ByVal vKey As Long) As IntegerPrivate m_hDllKbdHook As Long 'private variable holding'the handle to the hook procedurePublic Sub Main()'set and obtain the handle to the keyboard hookm_hDllKbdHook = SetWindowsHookEx(WH_KEYBOARD_LL, _AddressOf LowLevelKeyboardProc, _App.hInstance, _0&)If m_hDllKbdHook <> 0 Then'It's hooked! Show a messagebox'to temporarily suspend the app here'(the LowLevelKeyboardProc will continue'to process messages), and follow the'messagebox, for this demo, with the'unhook call. See the text above for'specific information.MsgBox "Ctrl+Esc, Alt+Tab and Alt+Esc are blocked. " & _"Click OK to quit and re-enable the keys.", _vbOKOnly Or vbInformation, _"Keyboard Hook Active"'Placement for this demo only.'Move to the unload event of the'main form when used in an application.Call UnhookWindowsHookEx(m_hDllKbdHook)ElseMsgBox "Failed to install low-level keyboard hook - " & Err.LastDllErrorEnd IfEnd SubPublic Function LowLevelKeyboardProc(ByVal nCode As Long, _ByVal wParam As Long, _ByVal lParam As Long) As Long'Application-defined callback function'used with the SetWindowsHookEx function.'The system calls this function every'time a new keyboard input event is about'to be posted into a thread input queue.'The keyboard input can come from the local'keyboard driver or from calls to the'keybd_event function. If the input comes'from a call to keybd_event, the input'was "injected".Static kbdllhs As KBDLLHOOKSTRUCT'If nCode is less than zero, the hook'procedure must return the value returned'by CallNextHookEx.''If nCode is greater than or equal to zero,'and the hook procedure did not process the'message, it is highly recommended that you'call CallNextHookEx and return the value it'returns; otherwise, other applications that'have installed WH_KEYBOARD_LL hooks will not'receive hook notifications and may behave'incorrectly as a result.''If the hook procedure processed the message,'it may return a nonzero value to prevent the'system from passing the message to the rest'of the hook chain or the target window procedure.If nCode = HC_ACTION Then'nCode specifies a code the hook'procedure uses to determine how'to process the message. HC_ACTION'is the only valid code.'On receipt of the HC_ACTION code,'wParam and lParam contain information'about a keyboard message, and lParam'holds the pointer to a KBDLLHOOKSTRUCT'structure.Call CopyMemory(kbdllhs, ByVal lParam, Len(kbdllhs))'Ctrl+Esc --------------If (kbdllhs.vkCode = VK_ESCAPE) And _CBool(GetAsyncKeyState(VK_CONTROL) _And &H8000) ThenDebug.Print "Ctrl+Esc blocked"LowLevelKeyboardProc = 1Exit FunctionEnd If 'kbdllhs.vkCode = VK_ESCAPE'Alt+Tab --------------If (kbdllhs.vkCode = VK_TAB) And _CBool(kbdllhs.flags And _LLKHF_ALTDOWN) ThenDebug.Print "Alt+Tab blocked"LowLevelKeyboardProc = 1Exit FunctionEnd If 'kbdllhs.vkCode = VK_TAB'Alt+Esc --------------If (kbdllhs.vkCode = VK_ESCAPE) And _CBool(kbdllhs.flags And _LLKHF_ALTDOWN) ThenDebug.Print "Alt+Esc blocked"LowLevelKeyboardProc = 1Exit FunctionEnd If 'kbdllhs.vkCode = VK_ESCAPEEnd If 'nCode = HC_ACTIONLowLevelKeyboardProc = CallNextHookEx(m_hDllKbdHook, _nCode, _wParam, _lParam)End Function``` Link to comment Share on other sites More sharing options...
abhi2011 Posted March 24, 2013 Share Posted March 24, 2013 It would be better to do what Mathew told. The server should not unload the player when the player requests a logout if the player is in combat. Let the player still be in a state of login for about 10 secs or till death. The server should automatically do the rest like attacking by the opponent. Link to comment Share on other sites More sharing options...
Matt Posted March 24, 2013 Share Posted March 24, 2013 > Some little snippet what will disable Alt ESC and Ctrl ESC (it can disable Alt F4 also). It is usefull for this thing. I found it here: [http://www.vbforums….LT-F4-(Globally](http://www.vbforums.com/showthread.php?506097-Resolved-Disable-ALT-F4-(Globally))> > ```> > -snip-> > ```Or you could just open up a simple```Sub Form_Unload()End Sub```which would do the trick as well.The only problem is that it can still be closed through Task Manager. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now