Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Player Stats problem.
#1
Okay i am making a thing on the server side and there is a list on the server that shows when someone logs on. Im trying to make it so if i double click the name a new form will pop up and there stats will be there. Heres some codes i got.
This is what i got on the first screenie down there. It wont work because of the i= equation. Im not sure how to make it work so that the online player you double click on will equal i.
Code:
Private Sub Form_Load()
Dim i As Long

i = frmServer.lstOnline.Selected

frmStats.lstStats.AddItem "Account Login: " & Trim(Player(i).Login)
frmStats.lstStats.AddItem "Account Password: " & Trim(Player(i).Password)
frmStats.lstStats.AddItem "---------" & GetPlayerName(i) & "'s Stats---------"
frmStats.lstStats.AddItem "Name: " & GetPlayerName(i)
frmStats.lstStats.AddItem "Level: " & GetPlayerLevel(i)
frmStats.lstStats.AddItem "Experience: " & GetPlayerExp(i) & "/" & GetPlayerNextLevel(i)
frmStats.lstStats.AddItem "HP: " & GetPlayerHP(i) & "/" & GetPlayerMaxHP(i)
frmStats.lstStats.AddItem "MP: " & GetPlayerMP(i) & "/" & GetPlayerMaxMP(i)
frmStats.lstStats.AddItem "SP: " & GetPlayerSP(i) & "/" & GetPlayerMaxSP(i)
frmStats.lstStats.AddItem "Strength: " & GetPlayerSTR(i)
frmStats.lstStats.AddItem "Defense: " & GetPlayerDEF(i)
frmStats.lstStats.AddItem "Magic: " & GetPlayerMAGI(i)
frmStats.lstStats.AddItem "Speed: " & GetPlayerSPEED(i)
End Sub
[Image: server2zq0.th.jpg]


Okay this is the main server and at the bottom is the list that will show the online players. I got it if you double click on it itll pop up with the screenie up top.
[Image: server1xj4.th.jpg]
Reply
#2
I am not anywhere near certain on this, but wouldn't it be "I = 1 to max_Playersonline" or something like that.
And do
Code:
sub dblClick_frmServer.lstOnline
picstats.visible = true
Call send(whatever stats you have)
end sub
something like that, maybe. Can't remember the actual code for double click off the top of my head.
Reply
#3
Im not exactly sure what your saying. So on the frmServer part id make it
I think by Send(here) you mean
Code:
sub dblClick_frmServer.lstOnline
picstats.visible = true
Call SendData(whatever stats you have)
end sub
Since im pretty new at the programming i dont know that much about it. I dont get about the SendData part.
All i know is theres got to be like some script or word that like can tell you which part is selected in a list.
Reply
#4
Try changing:

Code:
i = frmServer.lstOnline.Selected

To:

Code:
i = frmServer.lstOnline.ListIndex

If the listindex now is the real index for the player this will work. But if its not; you need to take the list text from the line you doubled click on and use:
FindPlayer() to find the index.
Reply
#5
Okay william thanks. I put that in and that problem went away but what happens now is that the
Function highlights up.
Code:
Function GetPlayerLogin(ByVal Index As Long) As String
    GetPlayerLogin = Trim(Player(Index).Login)
End Function
I think the problem is that it doesnt know what i is still. So should i just get rid of I and maybe just find a different way or what?

I dont get by what you mean either with the FindPlayer()
Reply
#6
FindPlayer() will give you the player's index.
Reply
#7
Okay thanks i got it working.
Thanks everyone for the help.
Reply
#8
Np.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)