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

Name changing colours


Rainbow Dash
 Share

Recommended Posts

I'm trying to add a Knighthood system to EO, where you right click the player's name in the server and go to Knight Player or Remove Knight and if you are a Knight, then it makes your name green.

When you add or remove the Knighthood, it sends messages as it should,  but I can't get the names to change colour - here's the code:

```
' 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

        If GetPlayerAccess(Index) = 0 Then

        Select Case GetPlayerKnight(Index)
            Case 0
                color = RGB(255, 96, 0)
            Case 1
                color = RGB(0, 255, 100)
        End Select

    Else
        color = QBColor(BrightRed)
    End If

    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)))

```
Anyone know what I've done wrong? Thanks for any help.
Link to comment
Share on other sites

Assuming that GetPlayerKnight(index) is a real and working function:
```
' 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

        If GetPlayerAccess(Index) = 0 Then

            Select Case GetPlayerKnight(Index)
                Case 0
                    color = RGB(255, 96, 0)
                Case 1
                    color = RGB(0, 255, 100)
            End Select
        End If

    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)))

```
Also: make sure you're not an admin when you do this. Your code specifically states it won't work if they have admin access.
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...