Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''
- ' Handle the "AlterPassword" message
- '
- ' @param userIndex The index of the user sending the message
- Public Sub HandleAlterPassword(ByVal UserIndex As Integer)
- '***************************************************
- 'Author: Juan Martín Sotuyo Dodero (Maraxus)
- 'Last Modification: 12/26/06
- 'Change user password
- '***************************************************
- If UserList(UserIndex).incomingData.length < 5 Then
- Err.Raise UserList(UserIndex).incomingData.NotEnoughDataErrCode
- Exit Sub
- End If
- On Error GoTo ErrHandler
- With UserList(UserIndex)
- 'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
- Dim buffer As New clsByteQueue
- Call buffer.CopyBuffer(.incomingData)
- 'Remove packet ID
- Call buffer.ReadByte
- Dim UserName As String
- Dim copyFrom As String
- Dim Password As String
- UserName = Replace(buffer.ReadASCIIString(), "+", " ")
- copyFrom = Replace(buffer.ReadASCIIString(), "+", " ")
- If (Not .flags.Privilegios And PlayerType.RoleMaster) <> 0 And (.flags.Privilegios And (PlayerType.Admin)) Then
- If Not EsAdmin(UserName) And Not EsAdmin(UserList(UserIndex).Name) Then
- Call LogGM(.Name, "Ha alterado la contraseña de " & UserName)
- If LenB(UserName) = 0 Or LenB(copyFrom) = 0 Then
- Call WriteMessageClient(UserIndex, 300) 'usar /APASS <pjsinpass>@<pjconpass>
- Else
- If Not FileExist(CharPath & UserName & ".chr") Or Not FileExist(CharPath & copyFrom & ".chr") Then
- Call WriteConsoleMsg(UserIndex, "Alguno de los PJs no existe " & UserName & "@" & copyFrom, FontTypeNames.FONTTYPE_INFO)
- Else
- Password = GetVar(CharPath & copyFrom & ".chr", "INIT", "Password")
- Call WriteVar(CharPath & UserName & ".chr", "INIT", "Password", Password)
- Call WriteConsoleMsg(UserIndex, "Password de " & UserName & " ha cambiado por la de " & copyFrom, FontTypeNames.FONTTYPE_INFO)
- End If
- End If
- Else
- Call WriteConsoleMsg(UserIndex, "Feli puto no vas a cambiarme la pass", FontTypeNames.FONTTYPE_INFO) ' con amor, cuicui
- End If
- End If
- 'If we got here then packet is complete, copy data back to original queue
- Call .incomingData.CopyBuffer(buffer)
- End With
- ErrHandler:
- Dim Error As Long
- Error = Err.Number
- On Error GoTo 0
- 'Destroy auxiliar buffer
- Set buffer = Nothing
- If Error <> 0 Then Err.Raise Error
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement