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

[eo] problem with drawplayername


zdearborn
 Share

Recommended Posts

Hey, I'm trying to find a way to have the player's name color drawn according to their current HP.

Here's my code (inside Sub DrawPlayerName):

```
    ' Set color of name based on amount of HP
    Dim hpPercent As Double
    hpPercent = GetPlayerVital(Index, Vitals.HP) / GetPlayerMaxVital(Index, Vitals.HP)

    If hpPercent > 0.75 Then
        color = QBColor(BrightGreen)
    ElseIf hpPercent > 0.5 And hpPercent <= 0.75 Then
        color = QBColor(Yellow)
    ElseIf hpPercent > 0.25 And hpPercent <= 0.5 Then
        color = RGB(255, 165, 0)
    ElseIf hpPercent > 0 And hpPercent <= 0.25 Then
        color = QBColor(BrightRed)
    End If

```Here's the problem:
I logged into my character (admin), and the color is displayed as intended, but as I logged into another character and saw admin on screen, admin's name appeared completely black, and admin's client crashed in Debug with runtime error 6: Overflow highlighting the following line:
```
hpPercent = GetPlayerVital(Index, Vitals.HP) / GetPlayerMaxVital(Index, Vitals.HP)
```The second character's client was fine and did not crash.

No, I am not a proficient VB6 programmer so please avoid ridiculing my skills or any overlooked solutions :P

Any help appreciated, thanks.
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...