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

[EO] RS2 style name colour changes (Access tags included)


Sada
 Share

Recommended Posts

Hey guys this is my first tutorial so I hope you all enjoy! :)
I only starting using eclipse a few days ago so if there's anything in their that you believe is pointless or done wrong please show me the light!

What this peice of code actually does is simple, add access tags above players heads [Admin] , [Mod] / [GM] etc.
It also changes the colour of the players name according to their level.

Color code is as follows

>! <= 10 levels lower = green
< 5 levels lower = yellow
> 5 levels lower and < 5 levels higher = white
> 5 levels higher = blue
>= 10 levels higher = purple

If pk is on their colour is overrided and turns red.

Open ModText.bas on the client source.
Replace the sub DrawPlayerName with the following.

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

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

        Select Case GetPlayerAccess(Index)
            Case 0
            Title = "[Ac.0]"
            Case 1
            Title = "[Ac.1]"
            Case 2
            Title = "[Ac.2]"
            Case 3
            Title = "[Ac.3]"
            Case 4
            Title = "[Ac.4]"
            Case 5
            Title = "[Ac.5]"
        End Select

        If Player(Index).PK = False Then
        If Player(Index).Level <> Player(MyIndex).Level Then
            Dim LevelDiff As Long
            LevelDiff = CLng(Player(Index).Level) - CLng(Player(MyIndex).Level)

            If LevelDiff < 5 And LevelDiff > -5 Then
            'White
                color = RGB(255, 255, 255)
            ElseIf LevelDiff < 10 And LevelDiff >= 5 Then
            'Blue
                color = RGB(0, 160, 230)
            ElseIf LevelDiff >= 10 Then
            'Purple
                color = RGB(120, 50, 120)
            ElseIf LevelDiff > -10 Then
            'Yellow
                color = RGB(250, 240, 0)
            ElseIf LevelDiff <= -10 Then
            'Green
                color = RGB(60, 190, 50)
            End If
            Else
                color = RGB(255, 255, 255)
            End If
        Else
            color = RGB(255, 96, 0)
        End If

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

    ' Draw Access
    Call DrawText(TexthDC, TextX2, TextY2, Title, color)
        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)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "DrawPlayerName", "modText", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

```
To change the name of the tags above the users head change the string under each of the cases, or to remove the tag from above their head completely remove that specific case.

Lastly Screenshot!

>! ![](http://img59.imageshack.us/img59/6505/eclipseorigins.png)
Link to comment
Share on other sites

@Sada:

> You can easily change that, if you read in my post, it says to remove titles you just remove that case from the select case.

I know what to do lol, I was just giving you a suggestion. But if you are leaving it for others to change, fair enough. :]
Link to comment
Share on other sites

  • 2 weeks later...
xLightx: remove:

```
        If Player(Index).Level <> Player(MyIndex).Level Then
            Dim LevelDiff As Long
            LevelDiff = CLng(Player(Index).Level) - CLng(Player(MyIndex).Level)

            If LevelDiff < 5 And LevelDiff > -5 Then
            'White
                color = RGB(255, 255, 255)
            ElseIf LevelDiff < 10 And LevelDiff >= 5 Then
            'Blue
                color = RGB(0, 160, 230)
            ElseIf LevelDiff >= 10 Then
            'Purple
                color = RGB(120, 50, 120)
            ElseIf LevelDiff > -10 Then
            'Yellow
                color = RGB(250, 240, 0)
            ElseIf LevelDiff <= -10 Then
            'Green
                color = RGB(60, 190, 50)
            End If
            Else
                color = RGB(255, 255, 255)
            End If

```
That from Sub DrawPlayerName.
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...