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

[EO] Tag & Level Script


lexkymbeth
 Share

Recommended Posts

in client modtext look for sub drawplayername

replace the hole sub with

```
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 = QBColor(7)
            Case 1
                color = QBColor(1)
            Case 2
                color = QBColor(2)
            Case 3
                color = QBColor(4)
            Case 4
                color = QBColor(6)
        End Select

    Else
        color = QBColor(BrightRed)
    End If

    If GetPlayerAccess(Index) = 0 Then
    Name = Trim$(Player(Index).Name) & " - Lvl: " & GetPlayerLevel(Index)
    ElseIf GetPlayerAccess(Index) = 1 Then
    Name = "[Player Relations] " & Trim$(Player(Index).Name) & " - LvL: " & GetPlayerLevel(Index)
    ElseIf GetPlayerAccess(Index) = 2 Then
    Name = "[Builder] " & Trim$(Player(Index).Name) & " - LvL: " & GetPlayerLevel(Index)
    ElseIf GetPlayerAccess(Index) = 3 Then
    Name = "[Admin] " & Trim$(Player(Index).Name) & " - LvL: " & GetPlayerLevel(Index)
    ElseIf GetPlayerAccess(Index) = 4 Then
    Name = "[Dev] " & Trim$(Player(Index).Name) & " - LvL: " & GetPlayerLevel(Index)
    End If

    ' 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
```
name should come out to be, say.. Dev wold be [dev] Name - Level: 64 (Color would be Gold)

Feel free to edit and thank me for doing this :p

Coverted:
```
Public Sub DrawPlayerName(ByVal index As Long)
Dim textX As Long, textY As Long, Text As String, textSize As Long, colour As Long

        If GetPlayerAccess(index) = 0 Then
    Text = Trim$(Player(index).Name) & " - Lvl: " & Player(index).Level
    ElseIf GetPlayerAccess(index) = 1 Then
    Text = "[TESTER] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
    ElseIf GetPlayerAccess(index) = 2 Then
    Text = "[DEVELOPER] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
    ElseIf GetPlayerAccess(index) = 3 Then
    Text = "[ADMIN] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
    ElseIf GetPlayerAccess(index) = 4 Then
    Text = "[OWNER] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
    End If

    textSize = EngineGetTextWidth(Font_Default, Text)

    ' get the colour
    If GetPlayerAccess(index) = 0 Then
    colour = White
    ElseIf GetPlayerAccess(index) = 1 Then
    colour = Blue
    ElseIf GetPlayerAccess(index) = 2 Then
    colour = Green
    ElseIf GetPlayerAccess(index) = 3 Then
    colour = Red
    ElseIf GetPlayerAccess(index) = 4 Then
    colour = Yellow
    End If

    textX = Player(index).x * PIC_X + Player(index).xOffset + (PIC_X \ 2) - (textSize \ 2)
    textY = Player(index).y * PIC_Y + Player(index).yOffset - 32

    If GetPlayerSprite(index) >= 1 And GetPlayerSprite(index) <= Count_Char Then
        textY = GetPlayerY(index) * PIC_Y + Player(index).yOffset - (D3DT_TEXTURE(Tex_Char(GetPlayerSprite(index))).height / 4) + 12
    End If

    Call RenderText(Font_Default, Text, ConvertMapX(textX), ConvertMapY(textY), colour)
End Sub
```
Link to comment
Share on other sites

  • 2 weeks later...
@Ryoku:

> No, Erwin.
>
> the problem is
> ```
> GetPlayer(Index).level
>
> ```
> there is no GetPlayer(index).level, change it to just
>
> ```
> Player(index).level
> ```
> That's the only thing that needs to be fixed to make this work

In client side must be GetPlayer(MyIndex).level or Player(MyIndex).level
Link to comment
Share on other sites

If you use "MyIndex" EVERY player will have YOUR level above their head on your screen. That's why its called MyIndex, its for whoever is logged into the client.

Test it with 2 accounts one level 5 and one level 10 in the same place at the same time.

Besides there is no GetPlayer().level, why would there be? it would be GetPlayerLevel(), but i don't know if the client has that one, I'd have to check.
Link to comment
Share on other sites

Oh.. i see .. Ryoku is right it works

this is my DrawPlayerName
i also removed the End If in this part
textSize = EngineGetTextWidth(Font_Default, Text)

SO THIS IS THE REAL CODE WORKING FOR CS:DE

>! Public Sub DrawPlayerName(ByVal index As Long)
Dim textX As Long, textY As Long, Text As String, textSize As Long, colour As Long
>!         If GetPlayerAccess(index) = 0 Then
    Text = Trim$(Player(index).Name) & " - Lvl: " & Player(index).Level
    ElseIf GetPlayerAccess(index) = 1 Then
    Text = "[TESTER] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
    ElseIf GetPlayerAccess(index) = 2 Then
    Text = "[DEVELOPER] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
    ElseIf GetPlayerAccess(index) = 3 Then
    Text = "[ADMIN] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
    ElseIf GetPlayerAccess(index) = 4 Then
    Text = "[OWNER] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
    End If
>!     textSize = EngineGetTextWidth(Font_Default, Text)

    ' get the colour
    If GetPlayerAccess(index) = 0 Then
    colour = White
    ElseIf GetPlayerAccess(index) = 1 Then
    colour = Blue
    ElseIf GetPlayerAccess(index) = 2 Then
    colour = Green
    ElseIf GetPlayerAccess(index) = 3 Then
    colour = Red
    ElseIf GetPlayerAccess(index) = 4 Then
    colour = Yellow
    End If

    textX = Player(index).x * PIC_X + Player(index).xOffset + (PIC_X \ 2) - (textSize \ 2)
    textY = Player(index).y * PIC_Y + Player(index).yOffset - 32

    If GetPlayerSprite(index) >= 1 And GetPlayerSprite(index) <= Count_Char Then
        textY = GetPlayerY(index) * PIC_Y + Player(index).yOffset - (D3DT_TEXTURE(Tex_Char(GetPlayerSprite(index))).height / 4) + 12
    End If

    Call RenderText(Font_Default, Text, ConvertMapX(textX), ConvertMapY(textY), colour)
End Sub
Link to comment
Share on other sites

@Ryoku:

> No, Erwin.
>
> the problem is
> ```
> GetPlayer(Index).level
>
> ```
> there is no GetPlayer(index).level, change it to just
>
> ```
> Player(index).level
> ```
> That's the only thing that needs to be fixed to make this work

Ow yeah, didn't see that :P
Link to comment
Share on other sites

@HeartHunt3r:

> Oh.. i see .. Ryoku is right it works
>
> this is my DrawPlayerName
> i also removed the End If in this part
> textSize = EngineGetTextWidth(Font_Default, Text)
>
> SO THIS IS THE REAL CODE WORKING FOR CS:DE
>
> >! Public Sub DrawPlayerName(ByVal index As Long)
> Dim textX As Long, textY As Long, Text As String, textSize As Long, colour As Long
> >!         If GetPlayerAccess(index) = 0 Then
>     Text = Trim$(Player(index).Name) & " - Lvl: " & Player(index).Level
>     ElseIf GetPlayerAccess(index) = 1 Then
>     Text = "[TESTER] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
>     ElseIf GetPlayerAccess(index) = 2 Then
>     Text = "[DEVELOPER] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
>     ElseIf GetPlayerAccess(index) = 3 Then
>     Text = "[ADMIN] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
>     ElseIf GetPlayerAccess(index) = 4 Then
>     Text = "[OWNER] " & Trim$(Player(index).Name) & " - LvL: " & Player(index).Level
>     End If
> >!     textSize = EngineGetTextWidth(Font_Default, Text)
>    
>     ' get the colour
>     If GetPlayerAccess(index) = 0 Then
>     colour = White
>     ElseIf GetPlayerAccess(index) = 1 Then
>     colour = Blue
>     ElseIf GetPlayerAccess(index) = 2 Then
>     colour = Green
>     ElseIf GetPlayerAccess(index) = 3 Then
>     colour = Red
>     ElseIf GetPlayerAccess(index) = 4 Then
>     colour = Yellow
>     End If
>    
>     textX = Player(index).x * PIC_X + Player(index).xOffset + (PIC_X \ 2) - (textSize \ 2)
>     textY = Player(index).y * PIC_Y + Player(index).yOffset - 32
>    
>     If GetPlayerSprite(index) >= 1 And GetPlayerSprite(index) <= Count_Char Then
>         textY = GetPlayerY(index) * PIC_Y + Player(index).yOffset - (D3DT_TEXTURE(Tex_Char(GetPlayerSprite(index))).height / 4) + 12
>     End If
>    
>     Call RenderText(Font_Default, Text, ConvertMapX(textX), ConvertMapY(textY), colour)
> End Sub

thanks! i didn't test it
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...