Makers Brasil
Bem Vindos a Maker´s Brasil (um forum para criação de servidores 2D e 3D)Nos desejamos boa sorte no seu projeto!

Colocando Tag ADM/GM

Ver o tópico anterior Ver o tópico seguinte Ir em baixo

Colocando Tag ADM/GM

Mensagem por thales12 em Qua Out 12, 2011 9:06 am

PREVIEW:



- Serve~Side -

Em modPlayer va ate o final e adicionar:

Código:
Public Function GetPlayerTag(ByVal index As Long) As String
Select Case GetPlayerAccess(index)
Case ADMIN_MONITOR, ADMIN_MAPPER
      GetPlayerTag = "[GM] "
Case ADMIN_DEVELOPER, ADMIN_CREATOR
        GetPlayerTag = "[ADM] "
Case Else
GetPlayerTag = " "
End Select
End Function

Va em modHandleData e substitua a seguinde sub:
Código:
Private Sub HandleEmoteMsg(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Por essa sub:
Código:
Private Sub HandleEmoteMsg(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Msg As String
    Dim I As Long
    Dim Buffer As clsBuffer
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    Msg = Buffer.ReadString

    ' Prevent hacking
    For I = 1 To Len(Msg)

        If AscW(Mid$(Msg, I, 1)) < 32 Or AscW(Mid$(Msg, I, 1)) > 126 Then
            Exit Sub
        End If

    Next
    Call AddLog("Map #" & GetPlayerMap(index) & ": " & GetPlayerName(index) & " " & Msg, PLAYER_LOG)
    Call MapMsg(GetPlayerMap(index), GetPlayerTag(index) &
GetPlayerName(index) & " " & Right$(Msg, Len(Msg) - 1),
EmoteColor)
    Set Buffer = Nothing
End Sub

Em modServeTCP subistitua a sub:
Código:
Sub SayMsg_Map(ByVal MapNum As Long, ByVal Index As Long, ByVal message As String, ByVal saycolour As Long)

Por:
Código:
Sub SayMsg_Map(ByVal MapNum As Long, ByVal index As Long, ByVal message As String, ByVal saycolour As Long)
    Dim Buffer As clsBuffer
   
    Set Buffer = New clsBuffer
    Buffer.WriteLong SSayMsg
    Buffer.WriteString GetPlayerName(index)
    Buffer.WriteLong GetPlayerAccess(index)
    Buffer.WriteLong GetPlayerPK(index)
    Buffer.WriteString message
    Buffer.WriteString "[Map] " & GetPlayerTag(index)
    Buffer.WriteLong saycolour
   
    SendDataToMap MapNum, Buffer.ToArray()
   
    Set Buffer = Nothing
End Sub

Substitua tabem abaixo dessa sub a sub:
Código:
Sub SayMsg_Global(ByVal Index As Long, ByVal message As String, ByVal saycolour As Long)

Por:
Código:
Sub SayMsg_Global(ByVal index As Long, ByVal message As String, ByVal saycolour As Long)
    Dim Buffer As clsBuffer
   
    Set Buffer = New clsBuffer
    Buffer.WriteLong SSayMsg
    Buffer.WriteString GetPlayerName(index)
    Buffer.WriteLong GetPlayerAccess(index)
    Buffer.WriteLong GetPlayerPK(index)
    Buffer.WriteString message
    Buffer.WriteString "[Global]" & GetPlayerTag(index)
    Buffer.WriteLong saycolour
   
    SendDataToAll Buffer.ToArray()
   
    Set Buffer = Nothing
End Sub



Parte do Client:

~~~Client~~~

Em modText substitua a sub:
Código:
Public Sub DrawPlayerName(ByVal Index As Long)

Ate:
Código:
'Ate :
 ' Draw name
    Call DrawText(TexthDC, TextX, TextY, Name, color)

Por:
Código:
Public Sub DrawPlayerName(ByVal Index As Long)
    Dim TextX As Long
    Dim TextY As Long
    Dim color As Long
    Dim sTag As String

    ' Check access level
    If GetPlayerPK(Index) = NO Then

        Select Case GetPlayerAccess(Index)
            Case 0
                color = RGB(255, 96, 0)
                sTag = vbNullString
            Case 1
                color = QBColor(DarkGrey)
                sTag = "[GM] "
            Case 2
                color = QBColor(Cyan)
                sTag = "[GM] "
            Case 3
                color = QBColor(BrightGreen)
                sTag = "[ADM] "
            Case 4
                color = QBColor(Yellow)
                sTag = "[ADM] "
        End Select

    Else
        color = QBColor(BrightRed)
    End If

    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) +
Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(sTag
& GetPlayerName(Index))))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
    Else
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) +
Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(sTag
& GetPlayerName(Index))))
        TextY =
ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset -
(DDSD_Character(GetPlayerSprite(Index)).lHeight) + 16
    End If

    Call DrawText(TexthDC, TextX, TextY, sTag & GetPlayerName(Index), color)
End Sub
Créditos: Desconhecido
Créditos: A mim por postar

thales12
Moderador
Moderador

Mensagens : 184
Estrelas Makers : 406
Creditos : 55
Data de inscrição : 22/03/2011
Idade : 22
Localização : Rio de Janeiro

http://www.rdmgames.tk

Voltar ao Topo Ir em baixo

Ver o tópico anterior Ver o tópico seguinte Voltar ao Topo

- Tópicos similares

 
Permissão deste fórum:
Você não pode responder aos tópicos neste fórum