Print Page | Close Window

Muting a Player

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=169
Printed Date: 20 December 2006 at 5:52pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Muting a Player
Posted By: Sync
Subject: Muting a Player
Date Posted: 11 February 2006 at 3:14pm
okay, this is my first tutorial, and i don't know if its all the stuff... so becareful, and make a backup before you attempt this copy paste tutorial:

also note that i did NOT program this myself, i had help from a friend of mine, and if this was originally posted, please let me know... i am NOT taking credit for this... also, thanks to Dave for finding some bugs, and adding some pieces of code  :)

=======
Client Side
=======

modClientTCP, under Sub SendKick

Sub SendMute(ByVal Name As String)
Dim Packet As String
 
Packet = "MUTE" & SEP_CHAR & Name & SEP_CHAR & END_CHAR
Call SendData(Packet)
End Sub


modGameLogic, find:

' // Moniter Admin Commands //


and, add this after Kicking a Player

' Muting a player
                 If LCase(Mid(MyText, 1, 5)) = "/mute" Then
        If Len(MyText) > 6 Then
             MyText = Mid(MyText, 7, Len(MyText) - 6)
             Call SendMute(MyText)
        End If
        MyText = ""
        Exit Sub
    End If





========
Server Side
========

In the PlayerRec, add:

Muted As Boolean


Add:

Player(index).Char(i).Muted = False


in NewChar and ClearChar and ClearPlayer

in modServerTCP, find:

' Prevent hacking
        For i = 1 To Len(Msg)
             If Asc(Mid(Msg, i, 1)) < 32 Or Asc(Mid(Msg, i, 1)) > 126 Then
                 Call HackingAttempt(Index, "Broadcast Text Modification")
                 Exit Sub
             End If
        Next i


and add after it:

If Player(Index).Muted = True Then
             Exit Sub
    End If


in modServerTCP, add under Kick Player Packet:

' ::::::::::::::::::::::::
    ' :: Mute player packet ::
    ' ::::::::::::::::::::::::
    If LCase(Parse(0)) = "mute" Then
        ' Prevent hacking
        If GetPlayerAccess(Index) <= 0 Then
             Call HackingAttempt(Index, "Admin Cloning")
             Exit Sub
        End If
       
        ' The player index
        n = FindPlayer(Parse(1))
       
        If n <> Index Then
             If n > 0 Then
                 If GetPlayerAccess(n) <= GetPlayerAccess(Index) Then
                    If (Player(n).Char(i).Muted = True) Then
                          Call GlobalMsg(GetPlayerName(n) & " has been unmuted by " & GetPlayerName(Index) & "!", White)
                          Call AddLog(GetPlayerName(Index) & " has unmuted " & GetPlayerName(n) & ".", ADMIN_LOG)
                          Call PlayerMsg(n, "You have been unmuted by " & GetPlayerName(Index) & "!", White)
                          Player(n).Char(i).Muted = False
                      Else
                           = True
                          Call GlobalMsg(GetPlayerName(n) & " has been muted by " & GetPlayerName(Index) & "!", White)
                          Call AddLog(GetPlayerName(Index) & " has muted " & GetPlayerName(n) & ".", ADMIN_LOG)
                          Call PlayerMsg(n, "You have been muted by " & GetPlayerName(Index) & "!", White)
                     End If
                 Else
                     Call PlayerMsg(Index, "That is a higher access admin then you!", White)
                 End If
             Else
                 Call PlayerMsg(Index, "Player is not online.", White)
             End If
        ElsePlayer(n).Char(i).Muted
             Call PlayerMsg(Index, "You cannot Mute yourself!", White)
        End If
                
        Exit Sub
    End If


find the SavePlayer Sub, and add:

'Other 
        Call PutVar(FileName, "CHAR" & i, "MUTE", STR(Player(index).Char(i).Muted))


Find the LoadPlayer Sub, and add:

'Other 
        Player(index).Char(i).Muted = Val(GetVar(FileName, "CHAR" & i, "Muted"))





that should be it! so, /mute to mute a player, and /mute again to unmute them! good luck! tell me how i did everyone!



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info