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

[EO 2.0]Hospital System


-R.o.x-
 Share

Recommended Posts

Hey Guys,
this is my first post in this forum :).
Short description :
This system shows a GUI if you died, where you have to stay for "x" seconds.
While you are in the hospital you can't move. It's just usefull if you want to make your game more realistic.
![](http://fessifi.de/~nikeee/holzshare/images/zhn2ur.png)

Scripting :
Serverside
modEnumerations
_In Serverpackets over SMSG_Count insert:_
```
hospitalEnter
```
modCombat
_Search for :_
```
If Damage >= GetPlayerVital(victim, Vitals.HP) Then
```_After this insert :_
```
Dim Buffer2 As clsBuffer
            Set Buffer2 = New clsBuffer
            Buffer2.WriteLong hospitalEnter
            Buffer2.WriteString "isinhospital"
            SendDataTo victim, Buffer2.ToArray
          Set Buffer = Nothing
```**Notice that you'll get TWO results. Paste the code under BOTH.**

Clientside
modConstants
_Insert this at the bottom :_
```
Public isInHospital As Boolean
```
modHandleData
_Insert this below Initmessages_
```
HandleDataSub(hospitalEnter) = GetAddress(AddressOf HandleHospital)
```
_Insert this at the bottom :_
```
Private Sub HandleHospital(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim Msg As String
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    Msg = Buffer.ReadString
    frmHospital.Show

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "HandleHospital", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
modInput
_In checkInputKeys insert after_```
If GetKeyState(vbKeyUp) < 0 Then
```_this_
```
If isInHospital = False Then
```_And before the last "End If"_
```
    End If
```Form-work:

* Create a new form called 'frmHospital'
* Create a timer called Timer1
* Create a label called lblTimer

**Now you have to _view the code_ of frmHospital.**
_Just insert this :_
```
Dim TimeH As Integer

Private Sub Form_Activate()
TimeH = 30 'Here you can set the duration
Timer1.Enabled = True
lblTimer.Caption = "You are in the Hospital for : 30s"
End Sub

Private Sub Timer1_Timer()
If TimeH > 0 Then
TimeH = TimeH - 1
lblTimer.Caption = "You are in the Hospital for : " & TimeH & "s"
isInHospital = True
Else
isInHospital = False
Me.Hide
End If

End Sub

```

Credits :

* Robin - Should be clear why
* Me - For creating the script + posting

I hope you can use it
Link to comment
Share on other sites

More complicated than it needs to be.

Look at how spells handle stunning and it's stun timer, create your own form of that (Or even use it), and then not only is it server side, and can't be edited client-side, it also doesn't need a timer. Find a way to adapt that with sending the packet to open the GUI, and then you've got something more efficient.

Another little tip, is that whenever you're using a timer, try to figure out a way to use GetTickCount instead. Generally, it'd be

If GetTickCount > Timer Then
    FunctionHere
    Timer = GetTickCount + Time in milliseconds here
End If
Link to comment
Share on other sites

  • 1 year later...

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...