-R.o.x- Posted November 14, 2011 Author Share Posted November 14, 2011 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 :ServersidemodEnumerations_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.**ClientsidemodConstants_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 clsBufferDim 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 Suberrorhandler: HandleError "HandleHospital", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd 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 IntegerPrivate Sub Form_Activate()TimeH = 30 'Here you can set the durationTimer1.Enabled = TruelblTimer.Caption = "You are in the Hospital for : 30s"End SubPrivate Sub Timer1_Timer()If TimeH > 0 ThenTimeH = TimeH - 1lblTimer.Caption = "You are in the Hospital for : " & TimeH & "s"isInHospital = TrueElseisInHospital = FalseMe.HideEnd IfEnd Sub```Credits :* Robin - Should be clear why* Me - For creating the script + postingI hope you can use it Link to comment Share on other sites More sharing options...
PD Posted November 14, 2011 Share Posted November 14, 2011 Very simple to do something like this yourself but hey good first post :P Link to comment Share on other sites More sharing options...
Carim123 Posted November 14, 2011 Share Posted November 14, 2011 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 beIf GetTickCount > Timer Then FunctionHere Timer = GetTickCount + Time in milliseconds hereEnd If Link to comment Share on other sites More sharing options...
-R.o.x- Posted November 14, 2011 Author Share Posted November 14, 2011 Alright thanks.I'm pretty new to VB6, before that I always used VB.NET/LUA and C++(#) in MySQL/XML/DirectX and XNA uses.I never really had something with connections between client/server. Link to comment Share on other sites More sharing options...
kibbelz Posted November 15, 2011 Share Posted November 15, 2011 I think it would be nicer if instead of creating a new form you just added a picture box on frmMain. Anyway nice job, its always nice to see people are making more unique tutorials than making about 30 odd different types of quest systems etc.~Kibbelz Link to comment Share on other sites More sharing options...
Zetasis Posted November 15, 2011 Share Posted November 15, 2011 I like the idea. One thing though you should really remove the words script and scripting. It may confuse some poeple since this is a source code edit and not a script. Link to comment Share on other sites More sharing options...
-R.o.x- Posted November 15, 2011 Author Share Posted November 15, 2011 @all Thanks for the feedback.I'll remove them/replace them later. Link to comment Share on other sites More sharing options...
PVJsquad Posted November 17, 2011 Share Posted November 17, 2011 Set The timer interval to 1000U forgot it ?**Timer****Interval** = 1000* * * Link to comment Share on other sites More sharing options...
Zopto Posted April 14, 2013 Share Posted April 14, 2013 ok so just in Client sidefind```PublicEnum ServerPackets```below add```hospitalEnter```it works for mealso Dont forget timer interval 1000sry for bumping this Link to comment Share on other sites More sharing options...
santa-clause Posted April 15, 2013 Share Posted April 15, 2013 Fixed it 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