Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Staff Online Feature
#1
So, once again, I was bored. To test myself, I made this. How it works, is when you type /staff, it displays all the people that have > 0 access, that are online. Once more, this is just a rip and edit, of an already existing feature (Whos Online). Yeah, I know. I'm a n00b. When this is done, just type /staff, and it displays what staff members are online! GASP. Amazing rite? :roll:
[spoiler]Server Side:
Find:
Code:
Sub SendWhosOnline(ByVal Index As Long)
Dim s As String
Dim n As Long, i As Long

    For i = 1 To MAX_PLAYERS
        If IsPlaying(i) Then
            If i  Index Then
                s = s & GetPlayerName(i) & ", "
                n = n + 1
            End If
        End If
    Next i
            
    If n = 0 Then
        s = "There are no other players online."
    Else
        s = Mid$(s, 1, Len(s) - 2)
        s = "There are " & n & " other players online: " & s & "."
    End If
        
    Call PlayerMsg(Index, s, WhoColor)
End Sub

Now above that add:
Code:
Sub SendWhosStaff(ByVal Index As Long)
Dim s As String
Dim n As Long, i As Long

    For i = 1 To MAX_PLAYERS
        If IsPlaying(i) Then
           If GetPlayerAccess(i) > 0 Then
                s = s & GetPlayerName(i) & ", "
                n = n + 1
            End If
        End If
    Next i
            
    If n = 0 Then
        s = "There are no staff members online."
    Else
        s = Mid$(s, 1, Len(s) - 2)
        s = "There is " & n & " staff members online: " & s & "."
    End If
        
    Call PlayerMsg(Index, s, WhoColor)
End Sub

Now find:
Code:
CWhosOnline

Above it add:
Code:
CWhosStaff

Now find:
Code:
' :::::::::::::::::::::::
        ' :: Who online packet ::
        ' :::::::::::::::::::::::
        Case CWhosOnline
            Call SendWhosOnline(Index)
            Exit Sub

Above it add:
Code:
' :::::::::::::::::::::::
        ' :: Whos staff packet ::
        ' :::::::::::::::::::::::
        Case CWhosStaff
            Call SendWhosStaff(Index)
            Exit Sub

Client Side:

Find:
Code:
Sub SendWhosOnline()
Dim Packet As String

    Packet = CWhosOnline & END_CHAR
    Call SendData(Packet)
End Sub

Above it add:
Code:
Sub SendWhosStaff()
Dim Packet As String

    Packet = CWhosStaff & END_CHAR
    Call SendData(Packet)
End Sub

Now Find:
Code:
CWhosOnline

Above it add:
Code:
CWhosStaff

Now find:
Code:
' Whos Online
                Case "/who"
                    SendWhosOnline

Above it add:
Code:
' Staff Online
                Case "/staff"
                    SendWhosStaff

And thats it. I hope you enjoyed it.... Yeah.[/spoiler]
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)