Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Disallow log out while fighting


Hattivatti
 Share

Recommended Posts

Update: Now it checks, have you used melee/ranged/magic OR got damage in last 10 seconds. Hope you like it  :)

(Only tested with EE 2.7)
I think many of you have thought, how to disable logout when you are fighting. Because when you are going to die, it is too
easy to keep your stuff and exp by just klicking Quit Game..

So here is a code that prevents you from logging out, if you have used melee/ranged/magic in last 10 seconds.

First, you should disable control box so you just can't press "red X" to quit.
-Open frmMirage and from properties, set ControlBox to false.

Now, open frmMirage and double-click Exit Game button.
-Replace :
```
Private Sub lblMenuQuit_Click()
    InGame = False
End Sub
```

With this one
```
Private Sub lblMenuQuit_Click()
    If GetTickCount > NPCDmgTime + 10000 And GetTickCount > DmgTime + 10000 And GetTickCount > Player(MyIndex).AttackTimer + 10000 Then
        InGame = False
    Else
        Call AddText("You need to wait 10 seconds after last fight to log out", BRIGHTRED)
    End If
End Sub
```
And thats it  :)
Link to comment
Share on other sites

@Hattivatti:

> First, you should disable control box so you just can't press "red X" to quit.
> -Open frmMirage and from properties, set ControlBox to false.

If you want them same when you click the red cross just paste the same script in:
private sub form_unload(cancel as integer)
Link to comment
Share on other sites

@Tyr:

> EDIT: this wouldn't stop you from logging out when you are under attack…

Yes that's the only problem, but usually you try to hit opponent few times and then see (if) you are too weak..
Perhaps I can contrive something to fix this..

And Zombie0hour, if this makes your game similar to Runescape, then don't use this..
Link to comment
Share on other sites

@Hattivatti:

> Yes that's the only problem, but usually you try to hit opponent few times and then see (if) you are too weak..
> Perhaps I can contrive something to fix this..
>
> And Zombie0hour, if this makes your game similar to Runescape, then don't use this..

well actually i got a very simple idea, just add a timer: everytime you hit reset he timer to 10 secs, and everytime you GOT hit also reset it…

then on the lvlQuit add a if statement :) should work, i guess...

- Tyr
Link to comment
Share on other sites

@Tyr:

> well actually i got a very simple idea, just add a timer: everytime you hit reset he timer to 10 secs, and everytime you GOT hit also reset it…
>
> then on the lvlQuit add a if statement :) should work, i guess...
>
> - Tyr

Ok now it is fixed, watch the first post.
Link to comment
Share on other sites

  • 7 months later...
Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

dont know if this section is exempted in necroposting.

but i cant make this work.  :cry:
Link to comment
Share on other sites

i know now the error because i install this.
http://www.touchofdeathforums.com/smf/index.php/topic,46462.0.html

its about the "NPCDmgTime"

how to fixed this please?

Warning - while you were reading a new reply has been posted. You may wish to review your post.

@Prof.:

> You've been great help thanks.

nice try

FIXED.
Link to comment
Share on other sites

```
Private Sub lblMenuQuit_Click()
For I = 0 To 9
    If GetTickCount > NPCDmgTime(I) + 10000 And GetTickCount > DmgTime(I) + 10000 And GetTickCount > Player(MyIndex).AttackTimer + 10000 Then
        InGame = False
    Else
        Call AddText("You need to wait 10 seconds after last fight to log out", BRIGHTRED)
    End If
End Sub

```
Try like that
Link to comment
Share on other sites

  • 2 weeks later...
Thanks for the code!
Although, I think it would be nicer to only see the warning once per click.

```
Private Sub lblMenuQuit_Click()
Dim i
For i = 0 To 9
    If GetTickCount > NPCDmgTime(0) + 10000 And GetTickCount > DmgTime(0) + 10000 And GetTickCount > Player(MyIndex).AttackTimer + 10000 Then
        InGame = False
    End If
Next
If InGame = True Then
    Call AddText("You need to wait 10 seconds after last fight to log out", BRIGHTRED)
End If
End Sub

```
Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...
@Keebler:

> Ya anasky i was just thinking. Ctrl Alt Delete. End Process Tree.

Of course ending the process is one way to log-out. I have no skill/time to start doing a fix for this, as it would require a lot bigger changes to the code. If someone wants to do a fix, you can start a new thread because I don't visit these forums very often.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...