Poll: Is this useful?
You do not have permission to vote in this poll.
Yes very.
85.00%
17 85.00%
Ehh.
5.00%
1 5.00%
No
5.00%
1 5.00%
Why'd you bother posting this?
5.00%
1 5.00%
Total 20 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Live Stats+
#1
Ok this is my 4th tutorial; I am not going to take all the credit;
Programmers; DarkX; Leighland; Sonire
difficulty: 1 out 5

This tutorial is going to show you how to do multiple things, here's a list:
displaying your str, def, speed, magi, exp, and level.

Extra's(not needed but looks spiffy)
Displaying your Critical Hit Chance, Blocking Chance, and next level.

This part is by Leighland
Ok let's start off with the easiest part; server side...

make a timer anywhere on frmServer name it w/e you want
then double click it and add this into it
Code:
Dim i As Byte

    For i = 1 To MAX_PLAYERS
        If IsPlaying(i) And IsConnected(i) Then
            Call SendStats(i)
        End If
    Next i
now set the interval atleast 1000 and enabled = true
Ok what this does is it makes the stats update every 1 minute or second( I can't remember(And there are other; better ways to do this part))

In modServerTCP find SendStats make it look like this
Code:
Sub SendStats(ByVal Index As Long)
Dim Packet As String
    
    Packet = "PLAYERSTATS" & SEP_CHAR & GetPlayerSTR(Index) & SEP_CHAR & GetPlayerDEF(Index) & SEP_CHAR & GetPlayerSPEED(Index) & SEP_CHAR & GetPlayerMAGI(Index) & SEP_CHAR & GetPlayerLevel(Index) & SEP_CHAR & GetPlayerExp(Index) & SEP_CHAR & END_CHAR
    Call SendDataTo(Index, Packet)
End Sub

Ok now to Client side in modHandleData find "Player Stats Packet"
This is something almost anyone can figure out now that everythings done server side(let you know some features don't need to be put into Sub SendStats)
make the Player Stats Packet look like this.
Code:
Call SetPlayerSTR(MyIndex, Val(Parse(1)))
        Call SetPlayerDEF(MyIndex, Val(Parse(2)))
        Call SetPlayerSPEED(MyIndex, Val(Parse(3)))
        Call SetPlayerMAGI(MyIndex, Val(Parse(4)))
        Call SetPlayerLevel(MyIndex, Val(Parse(5)))
        Call SetPlayerExp(MyIndex, Val(Parse(6)))

        frmMirage.lblSTR = GetPlayerSTR(MyIndex)
        frmMirage.lblDEF = GetPlayerDEF(MyIndex)
        frmMirage.lblSPEED = GetPlayerSPEED(MyIndex)
        frmMirage.lblMAGI = GetPlayerMAGI(MyIndex)
        frmMirage.lblLevel = GetPlayerLevel(MyIndex)
        frmMirage.lblExp = GetPlayerExp(MyIndex)
I think the above is self explanitory, but if not; those are the packets in order there received on both server and client, then the rest of that little code is what makes the labels on frmMirage receive the info to display.
FrmMirage
ok Now make each of those labels on frmMirage somewhere; and name them lblstr, lbldef, lblspeed, lbllevel, lblmagi, and lblexp and that's all for the short end of the tutorial;

Now for the extra's Big Grin This is Sonire and I's code
In the PlayerStatsPacket, just below
Code:
frmMirage.lblExp = GetplayerExp(MyIndex)
add this
Code:
frmMirage.lblBLOCK = Int(GetPlayerDEF(MyIndex) / 2) + Int(GetPlayerLevel(MyIndex) / 2)
        frmMirage.lblHIT = Int(GetPlayerSTR(MyIndex) / 2) + Int(GetPlayerLevel(MyIndex) / 2)
        frmMirage.lblNextLvl = (GetPlayerLevel(MyIndex) + 1)
Ok explaining what this does, the first one getst the player block chance and displays it, the second one is the same just for Critical Hit Chance, and you probably don't want it but Next level displays the number of the level above yours aka level 37 it will display level 38

Now to finish the extra's. On frmMirage add 3 more labels name them lblblock, lblHit, and lblNextLvl and your done. Hope this helps someone. Tongue
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)