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

[EO]2.0 Show level


McCull96
 Share

Recommended Posts

Well I decided to redo my tutorial for (EO) 1.3.1 and center it
Also it should work with (EO)2.0
After you finish it should look like this:
![](http://i640.photobucket.com/albums/uu129/McCull96/Example-1.png)

Open your client and open modText and find
```
Public Sub DrawPlayerName(ByVal Index As Long)
```
Below that add:
```
Dim TextA As Long
Dim TextB As Long
```
Now find
```
Call DrawText(TexthDC, TextX, TextY, Name, color)
```
Below that add:
```
' calc pos
    TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$("Level " & GetPlayerLevel(Index))))
    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 5
    Else
        ' Determine location for text
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 5
    End If

    'Draw level
    Call DrawText(TexthDC, TextA, TextB, "Level " & GetPlayerLevel(Index), color)

```
Vola, now your done

Old Post

>! This tutorial is an edit of Crest's Player Level
It shows your character's level like this
![](http://i640.photobucket.com/albums/uu129/McCull96/Example-1.png)
>! This all takes place in the client
open modtext and find Sub DrawPlayerName under that should be:
>! >! Dim TextX As Long
Dim TextY As Long
Dim color As Long
>! Replace with:
>! >! Dim TextA As Long
    Dim TextB As Long
    Dim TextX As Long
    Dim TextY As Long
    Dim color As Long
>! Now go down until you find:
>! >! If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
    Else
        ' Determine location for text
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight) + 16
    End If
>!     ' Draw name
    Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index), color)
End Sub
>! Replace that with:
>! >! If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 5
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
    Else
        ' Determine location for text
        TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight) + 5
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight) + 16
    End If
>!     ' Draw name
    Call DrawText(TexthDC, TextA, TextB, "Level " & GetPlayerLevel(Index), color)
    Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index), color)
End Sub
>! That should be about it tell me if there's anything wrong.
Link to comment
Share on other sites

You may need to edit the text centring code for the level displaying.

Replace this:

```
Trim$(GetPlayerName(Index))
```
with this:

```
Trim$("Level " & GetPlayerLevel(Index))
```
in TextA when determining the location of the text's X coordinate.
Link to comment
Share on other sites

@The:

> Im using the new Eclipse origins. I doubt it will make any difference but its moved my name along with the level very high above the player. How can I fix this?

```
        ' Determine location for text
        TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight) + 5
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight) + 16
```
Just to increase the number 5 and 16.
150 and 160 worked for me.
Link to comment
Share on other sites

For thoes who haves some problems puting it in the new EO it should look like this:

```
Public Sub DrawPlayerName(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim color As Long
Dim Name As String

    ' Check access level
    If GetPlayerPK(Index) = NO Then

        Select Case GetPlayerAccess(Index)
            Case 0
                color = RGB(255, 96, 0)
            Case 1
                color = QBColor(DarkGrey)
            Case 2
                color = QBColor(Cyan)
            Case 3
                color = QBColor(BrightGreen)
            Case 4
                color = QBColor(Yellow)
        End Select

    Else
        color = QBColor(BrightRed)
    End If

    Name = Trim$(Player(Index).Name)
    ' calc pos
    TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
    Else
        ' Determine location for text
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16
    End If

    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, Name, color)
End Sub
```
Link to comment
Share on other sites

@Raiko:

> For thoes who haves some problems puting it in the new EO it should look like this:
>
> ```
> Public Sub DrawPlayerName(ByVal Index As Long)
> Dim TextX As Long
> Dim TextY As Long
> Dim color As Long
> Dim Name As String
>
>     ' Check access level
>     If GetPlayerPK(Index) = NO Then
>
>         Select Case GetPlayerAccess(Index)
>             Case 0
>                 color = RGB(255, 96, 0)
>             Case 1
>                 color = QBColor(DarkGrey)
>             Case 2
>                 color = QBColor(Cyan)
>             Case 3
>                 color = QBColor(BrightGreen)
>             Case 4
>                 color = QBColor(Yellow)
>         End Select
>
>     Else
>         color = QBColor(BrightRed)
>     End If
>
>     Name = Trim$(Player(Index).Name)
>     ' calc pos
>     TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
>     If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
>         TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
>     Else
>         ' Determine location for text
>         TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16
>     End If
>
>     ' Draw name
>     Call DrawText(TexthDC, TextX, TextY, Name, color)
> End Sub
> ```

lolol

~
Name = Trim$(Player(Index).Name & " - Level : " & getplayerlevel(index))

its just one line of change but this is in the same line
Link to comment
Share on other sites

This one will work with EO CE(1.2.0):

```
Public Sub DrawPlayerName(ByVal Index As Long)
Dim TextA As Long
Dim TextB As Long
Dim TextX As Long
Dim TextY As Long
Dim color As Long
Dim Name As String

    ' Check access level
    If GetPlayerPK(Index) = NO Then

        Select Case GetPlayerAccess(Index)
            Case 0
                color = RGB(255, 96, 0)
            Case 1
                color = QBColor(DarkGrey)
            Case 2
                color = QBColor(Cyan)
            Case 3
                color = QBColor(BrightGreen)
            Case 4
                color = QBColor(Yellow)
        End Select

    Else
        color = QBColor(BrightRed)
    End If

    Name = Trim$(Player(Index).Name)
    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 5
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
    Else
        ' Determine location for text
        TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 5
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16
    End If

    ' Draw name
    Call DrawText(TexthDC, TextA, TextB, "Level: " & GetPlayerLevel(Index), color)
    Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index), color)

End Sub
```
~Adr990
Link to comment
Share on other sites

@adr990:

> This one will work with EO CE(1.2.0):
>
> ```
> Public Sub DrawPlayerName(ByVal Index As Long)
> Dim TextA As Long
> Dim TextB As Long
> Dim TextX As Long
> Dim TextY As Long
> Dim color As Long
> Dim Name As String
>
>     ' Check access level
>     If GetPlayerPK(Index) = NO Then
>
>         Select Case GetPlayerAccess(Index)
>             Case 0
>                 color = RGB(255, 96, 0)
>             Case 1
>                 color = QBColor(DarkGrey)
>             Case 2
>                 color = QBColor(Cyan)
>             Case 3
>                 color = QBColor(BrightGreen)
>             Case 4
>                 color = QBColor(Yellow)
>         End Select
>
>     Else
>         color = QBColor(BrightRed)
>     End If
>    
>     Name = Trim$(Player(Index).Name)
>     If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
>         TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
>         TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 5
>         TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
>         TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
>     Else
>         ' Determine location for text
>         TextA = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
>         TextB = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 5
>         TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
>         TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16
>     End If
>
>     ' Draw name
>     Call DrawText(TexthDC, TextA, TextB, "Level: " & GetPlayerLevel(Index), color)
>     Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index), color)
>
> End Sub
> ```
> ~Adr990

is it possible to change the color? I assume it has to do this with the color cases? And it looks like the color is different based on player access level.

   ```
color = RGB(255, 96, 0)
            Case 1
                color = QBColor(DarkGrey)
            Case 2
                color = QBColor(Cyan)
            Case 3
                color = QBColor(BrightGreen)
            Case 4
                color = QBColor(Yellow)
```
Link to comment
Share on other sites

@Chuchoide:

> That colors are for the Color Access.
> Anyways, thanks for the edited code.

Yeah, but it appears that the text color of the "level: ##" appears to be the same as the color of the players access level. I was just wondering if it was possible to change the color that it displays as.
Link to comment
Share on other sites

To edit the color of the Level text do this:

```
Public Sub DrawPlayerName(ByVal Index As Long)
Dim TextA As Long
Dim TextB As Long
Dim TextX As Long
Dim TextY As Long
Dim color As Long
Dim colorlevel As Long
Dim Name As String

    ' Check access level
    If GetPlayerPK(Index) = NO Then

        Select Case GetPlayerAccess(Index)
            Case 0
                color = RGB(255, 96, 0)
                colorlevel = QBColor(Red)
            Case 1
                color = QBColor(DarkGrey)
                colorlevel = QBColor(Red)
            Case 2
                color = QBColor(Cyan)
                colorlevel = QBColor(Red)
            Case 3
                color = QBColor(BrightGreen)
                colorlevel = QBColor(Red)
            Case 4
                color = QBColor(Yellow)
                colorlevel = QBColor(Red)
        End Select

    Else
        color = QBColor(BrightRed)
    End If

```
And ofcourse below that add that other code necessary.

Replace 'Red' with Cyan or BrightGreen or RGB(160, 32, 240)
Or whatever color you want obviously.

~Adr990
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 4 weeks 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...