Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Member of the Month (MOTM) Compatible with new version.
#1
Okay, so this is just a rip of MOTD, because I was bored, and wanted to see what I could do with my spare time. Member Of The Month is this creation.

[spoiler]Server
Find:
Code:
CSetMotd

Above it add:
Code:
CSetMotm

Then find:
Code:
' set MOTD
    MOTD = GetVar(App.Path & "\data\motd.ini", "MOTD", "Msg")

Above it add:
Code:
' set MOTM
    MOTM = GetVar(App.Path & "\data\motm.ini", "MOTM", "Msg")

Then find:
Code:
' Used for MOTD
Public MOTD As String

Above it add:
Code:
' Used for MOTM
Public MOTM As String

Then find:
Code:
Case CSetMotd
            HandleSetMotd Index, Parse

Above it add:
Code:
Case CSetMotm
            HandleSetMotm Index, Parse

Then find:
Code:
' Send them MOTD
    If LenB(MOTD) > 0 Then
        Call PlayerMsg(Index, "MOTD: " & MOTD, BrightCyan)
    End If

Above it add:
Code:
' Send them MOTM
    If LenB(MOTM) > 0 Then
        Call PlayerMsg(Index, "MOTM: " & MOTM, BrightCyan)
    End If

Then find:
Code:
' :::::::::::::::::::::
' :: Set MOTD packet ::
' :::::::::::::::::::::
Sub HandleSetMotd(ByVal Index As Long, ByRef Parse() As String)
Dim MOTD As String

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_MAPPER Then
        Call HackingAttempt(Index, "Admin Cloning")
        Exit Sub
    End If
    
    MOTM = Trim$(Parse(1))
    Call PutVar(App.Path & "\data\motd.ini", "MOTD", "Msg", MOTD)
    Call GlobalMsg("MOTD changed to: " & MOTD, BrightCyan)
    Call AddLog(GetPlayerName(Index) & " changed MOTD to: " & MOTD, ADMIN_LOG)
End Sub

Above it add:
Code:
' :::::::::::::::::::::
' :: Set MOTM packet ::
' :::::::::::::::::::::
Sub HandleSetMotm(ByVal Index As Long, ByRef Parse() As String)
Dim MOTM As String

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_MAPPER Then
        Call HackingAttempt(Index, "Admin Cloning")
        Exit Sub
    End If
    
    MOTD = Trim$(Parse(1))
    Call PutVar(App.Path & "\data\motm.ini", "MOTM", "Msg", MOTM)
    Call GlobalMsg("MOTM changed to: " & MOTM, BrightCyan)
    Call AddLog(GetPlayerName(Index) & " changed MOTM to: " & MOTM, ADMIN_LOG)
End Sub

Client

Find:
Code:
' MOTD change
                Case "/motd"
                    If GetPlayerAccess(MyIndex) >= ADMIN_MAPPER Then
                        If UBound(Command) >= 1 Then
                            'If Len(MyText) > 0 Then
                                SendMOTDChange Command(1)
                            'End If
                        End If
                    End If

Above it add:
Code:
' MOTM change
                Case "/motm"
                    If GetPlayerAccess(MyIndex) >= ADMIN_MAPPER Then
                        If UBound(Command) >= 1 Then
                            'If Len(MyText) > 0 Then
                                SendMOTMChange Command(1)
                            'End If
                        End If
                    End If

Now find:
Code:
Sub SendMOTDChange(ByVal MOTD As String)
Dim Packet As String

    Packet = CSetMotd & SEP_CHAR & MOTD & END_CHAR
    Call SendData(Packet)
End Sub

Above it add:
Code:
Sub SendMOTMChange(ByVal MOTM As String)
Dim Packet As String

    Packet = CSetMotm & SEP_CHAR & MOTM & END_CHAR
    Call SendData(Packet)
End Sub

Now find:
Code:
CSetMotd

Above it add:
Code:
CSetMotm
[/spoiler]
Thats it! I know this was a really shitty tutorial, but it gets the idea across, right? So now, just type /motm "Char name", without the quotation marks... Yup. Shitty code, shitty tut, but it works.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)