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

Programmer help


Kazako
 Share

Recommended Posts

Hey guys, I need some help with two systems in my game that aren't quite working as they should.

First up is my guild system, after a guild is created and a player logs in, the server crashes.

Secondly, I need help with my hunger/thirst system- where would I put the code to make a player die when vitals.Hunger =< 0 ?

Let me know if you need screenshots and of what, etc.
Link to comment
Share on other sites

I can't replicate the server crashing right now- I will make a note of it next time it happens/if it happens.

Now I just have two problems with the grey area on my client and the hunger/thirst not killing the player at 0.

* * *

```
Private Sub HandlePlayerHp(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer

' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
Player(MyIndex).MaxVital(Vitals.HP) = Buffer.ReadLong
Call SetPlayerVital(MyIndex, Vitals.HP, Buffer.ReadLong)

If GetPlayerMaxVital(MyIndex, Vitals.HP) > 0 Then
'frmMain.lblHP.Caption = Int(GetPlayerVital(MyIndex, Vitals.HP) / GetPlayerMaxVital(MyIndex, Vitals.HP) * 100) & "%"
frmMain.lblHP.Caption = GetPlayerVital(MyIndex, Vitals.HP) & "/" & GetPlayerMaxVital(MyIndex, Vitals.HP)
' hp bar
frmMain.imgHPBar.width = ((GetPlayerVital(MyIndex, Vitals.HP) / HPBar_Width) / (GetPlayerMaxVital(MyIndex, Vitals.HP) / HPBar_Width)) * HPBar_Width
End If

' Error handler
Exit Sub
errorhandler:
HandleError "HandlePlayerHP", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
```
Can someone highlight the code that kills the player when HP reaches 0?
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...