Name:NexSteve
Credit:No
Feature:Rank Add on
Difficulty:Easy
Edits:Server
Details:If the previous rank is already taken the next is assigned. If Admin was created first and his level is 5 and he has 500 xp he is rank 1, then Admin2 is created he has a level of 5 and 500xp but his rank is 2 because 1 is already take by the character created first.
First use this tutorial:
http://www.vbgore.com/RankingThen:
Find:
Code:
Private Sub Server_Update_Ranking()
Dim i As Long
Dim EXP As Long
Dim PrevEXP As Long
Dim Level As Long
Dim PrevLevel As Long
'We need to open the database so we can update it. We will open the database in desceding order.
DB_RS.Open "SELECT * FROM users ORDER BY stat_elv DESC,stat_exp DESC"
'We will go through all the users so loop until End of File
Do While Not DB_RS.EOF
'Record the current user's level and exp to compare previous user's level and exp.
EXP = DB_RS!stat_exp
Level = DB_RS!stat_elv
'So the current user's level is the same as the previous's user's lets compare their exp.
If Level = PrevLevel Then
'The current user's exp is less than the previous user's so he is under his rank.
If EXP < PrevEXP Then i = i + 1
Else
'So the current user's level is the not equal to the previous's user's. Rank him down.
i = i + 1
End If
'Record user's level and exp to compare next user's.
PrevEXP = DB_RS!stat_exp
PrevLevel = DB_RS!stat_elv
'Set the user's rank
DB_RS!rank = i
'Update Database
DB_RS.Update
'NEXT USER!!!!
DB_RS.MoveNext
Loop
DB_RS.Close
End Sub
Replace:
Code:
Private Sub Server_Update_Ranking()
Dim i As Long
Dim Rank As Long
Dim PrevRank As Long
Dim EXP As Long
Dim PrevEXP As Long
Dim Level As Long
Dim PrevLevel As Long
'We need to open the database so we can update it. We will open the database in desceding order.
DB_RS.Open "SELECT * FROM users ORDER BY stat_elv DESC,stat_exp DESC"
'We will go through all the users so loop until End of File
Do While Not DB_RS.EOF
'Record the current user's level and exp to compare previous user's level and exp.
EXP = DB_RS!stat_exp
Level = DB_RS!stat_elv
'So the current user's level is the same as the previous's user's lets compare their exp.
If Level = PrevLevel Then
'The current user's exp is less than the previous user's so he is under his rank.
If EXP < PrevEXP Then i = i + 1
Else
'So the current user's level is the not equal to the previous's user's. Rank him down.
i = i + 1
End If
If i = PrevRank Then
i = i + 1
End If
'Record user's level and exp to compare next user's.
PrevEXP = DB_RS!stat_exp
PrevLevel = DB_RS!stat_elv
'Set the user's rank
DB_RS!Rank = i
'PrevRank
PrevRank = DB_RS!Rank
'Update Database
DB_RS.Update
'NEXT USER!!!!
DB_RS.MoveNext
Loop
DB_RS.Close
End Sub
Let me know if any problems come up.