Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Display stats on screen
#1
I'm going to give you two ways of setting this up so that you don't need the stat labels. The first way is going to have your stats under your character just like your character's name is above The second way will put your stats in the lower left corner.

1st Way
[Image: firstwayar4.png]
Difficulty: 1/5

::Client Side::

Find:
Code:
For i = 1 To MAX_PLAYERS
                    If IsPlaying(i) Then
                        If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                            'If CurX = GetPlayerX(i) Then
                                'If CurY = GetPlayerY(i) Then
                                    Call DrawPlayerName(i)
                                'End If
                            'End If
                        End If
                    End If
                Next i
Replace with:
Code:
For i = 1 To MAX_PLAYERS
                    If IsPlaying(i) Then
                        If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                            'If CurX = GetPlayerX(i) Then
                                'If CurY = GetPlayerY(i) Then
                                    Call DrawPlayerName(i)
                                    Call DrawPlayerHP(i)
                                    Call DrawPlayerMP(i)
                                    Call DrawPlayerSP(i)
                                'End If
                            'End If
                        End If
                    End If
                Next i
At the bottom of modText, add:
Code:
Sub DrawPlayerHP(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
Dim HP As String

HP = "HP: " & (GetPlayerVital(MyIndex, Vitals.HP) / GetPlayerMaxVital(MyIndex, Vitals.HP) * 100) & "%"

    ' Check access level to determine color
    If GetPlayerPK(Index) = NO Then
        Select Case GetPlayerAccess(Index)
            Case 0
                Color = QBColor(Brown)
            Case 1
                Color = QBColor(DarkGrey)
            Case 2
                Color = QBColor(Cyan)
            Case 3
                Color = QBColor(Blue)
            Case 4
                Color = QBColor(Pink)
        End Select
    Else
        Color = QBColor(BrightRed)
    End If

    ' Determine location for text
    TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + (PIC_X \ 2) - 30
    TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (PIC_Y \ 2) + 44
    
    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, HP, Color)
End Sub

Sub DrawPlayerMP(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
Dim MP As String

MP = "MP: " & (GetPlayerVital(MyIndex, Vitals.MP) / GetPlayerMaxVital(MyIndex, Vitals.MP) * 100) & "%"

    ' Check access level to determine color
    If GetPlayerPK(Index) = NO Then
        Select Case GetPlayerAccess(Index)
            Case 0
                Color = QBColor(Brown)
            Case 1
                Color = QBColor(DarkGrey)
            Case 2
                Color = QBColor(Cyan)
            Case 3
                Color = QBColor(Blue)
            Case 4
                Color = QBColor(Pink)
        End Select
    Else
        Color = QBColor(BrightRed)
    End If

    ' Determine location for text
    TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + (PIC_X \ 2) - 30
    TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (PIC_Y \ 2) + 54
    
    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, MP, Color)
End Sub

Sub DrawPlayerSP(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
Dim SP As String

SP = "SP: " & (GetPlayerVital(MyIndex, Vitals.SP) / GetPlayerMaxVital(MyIndex, Vitals.SP) * 100) & "%"

    ' Check access level to determine color
    If GetPlayerPK(Index) = NO Then
        Select Case GetPlayerAccess(Index)
            Case 0
                Color = QBColor(Brown)
            Case 1
                Color = QBColor(DarkGrey)
            Case 2
                Color = QBColor(Cyan)
            Case 3
                Color = QBColor(Blue)
            Case 4
                Color = QBColor(Pink)
        End Select
    Else
        Color = QBColor(BrightRed)
    End If

    ' Determine location for text
    TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + (PIC_X \ 2) - 30
    TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (PIC_Y \ 2) + 64
    
    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, SP, Color)
End Sub
Done


2nd Way

[Image: secondwayuc4.png]
Difficulty: 1/5

::Client Side::

Search for:
Code:
' Checking fps
Under:
Code:
' Checking fps
        If Mid$(MyText, 1, 4) = "/fps" Then
        
            BFPS = Not BFPS
            MyText = vbNullString
            frmMirage.txtMyChat.Text = vbNullString
            Exit Sub
        End If
Add:
Code:
' Show stats
        If Mid$(MyText, 1, 5) = "/Show" Then
        
            Show = Not Show
            MyText = vbNullString
            frmMirage.txtMyChat.Text = vbNullString
            Exit Sub
        End If
Search for:
Code:
Public BFPS As Boolean
Under:
Code:
Public BFPS As Boolean
Public BLoc As Boolean
Add:
Code:
' Puts your stats on screen
Public Show As Boolean
Search for:
Code:
Dim rec_pos As DXVBLib.RECT
Under add:
Code:
Dim HP As String, MP As String, SP As String
Search for:
Code:
' draw FPS
Under add:
Code:
' draw FPS
                If BFPS Then
                    Call DrawText(TexthDC, (MAX_MAPX - 1) * PIC_X, 1, Trim$("FPS: " & GameFPS), QBColor(Yellow))
                End If
Add:
Code:
' draw Stats
                If Show Then
                    HP = (GetPlayerVital(MyIndex, Vitals.HP) / GetPlayerMaxVital(MyIndex, Vitals.HP) * 100) & "%"
                    MP = (GetPlayerVital(MyIndex, Vitals.MP) / GetPlayerMaxVital(MyIndex, Vitals.MP) * 100) & "%"
                    SP = (GetPlayerVital(MyIndex, Vitals.SP) / GetPlayerMaxVital(MyIndex, Vitals.SP) * 100) & "%"
                    Call DrawText(TexthDC, (MAX_MAPY - 11) * PIC_Y, 350, Trim$("HP: " & HP), QBColor(Yellow))
                    Call DrawText(TexthDC, (MAX_MAPY - 11) * PIC_Y, 360, Trim$("MP: " & MP), QBColor(Yellow))
                    Call DrawText(TexthDC, (MAX_MAPY - 11) * PIC_Y, 370, Trim$("SP: " & SP), QBColor(Yellow))
                End If
Done
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)