Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetPlayerClass(MyIndex) in a label.
#1
How to have the player class in a label ?

I have tested :
Code:
frmMirage.labelclass.caption = GetPlayerClass(MyIndex)
But I have : 0, don't work.

Can I help me please ?

Thanks you in advance ^^
Reply
#2
You need to convert the number to text, for example (not complete at all, just an example):

Code:
.caption = ConvertToText(GetPlayerClass(Index), CTT_CLASS)

Function ConvertToText(value, type) As String
   If type = CTT_CLASS Then
         select case value
                case 0
                       ConvertToText =  "warrior"
                case 1
                       ConvertToText = "mage"
                ...
          end select
    ElseIf type = CTT_PLROPTION Then
          ...
    Else
         ...
    EndIf
End Function
Reply
#3
I make things general XD
Reply
#4
Thanks you, but don't work.

Look my sub :
Code:
Sub BltPlayerName(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
    
Select Case GetPlayerClass(Index)
Case 0
Color = QBColor(Cyan)
Case 1
Color = QBColor(Green)
Case 2
Color = QBColor(Yellow)
Case 3
Color = QBColor(Black)
End Select
    
    ' Draw name
    TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + Int(PIC_X / 2) - ((Len(GetPlayerName(Index)) / 2) * 8)
    TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - Int(PIC_Y / 2) - 4
    Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index), Color)
End Sub

The color of the playername is a color class.

Can I help me ? please

Thanks you.
Reply
#5
Add a break in there and check what value the GetPlayerClass is returning.
Reply
#6
It looks fine to me, just indent...
Reply
#7
I don't understand GIAKEN and Stomach Pulser, what is the code please ?

Thanks you in advance, El_Dindonnier
Reply
#8
It isn't complicated...
Reply
#9
Click to the very left of the line with the GetPlayerClass in it with VB6 and when the code gets to that line it will stop. Then you hover over the function with your mouse and it will tell you what number it is returning.
Reply
#10
I have fixed ! thanks you !
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)