Advertisement
Guest User

Untitled

a guest
Nov 29th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ''
  2. ' Handle the "AlterPassword" message
  3. '
  4. ' @param userIndex The index of the user sending the message
  5.  
  6. Public Sub HandleAlterPassword(ByVal UserIndex As Integer)
  7. '***************************************************
  8. 'Author: Juan Martín Sotuyo Dodero (Maraxus)
  9. 'Last Modification: 12/26/06
  10. 'Change user password
  11. '***************************************************
  12.    If UserList(UserIndex).incomingData.length < 5 Then
  13.         Err.Raise UserList(UserIndex).incomingData.NotEnoughDataErrCode
  14.         Exit Sub
  15.     End If
  16.  
  17.     On Error GoTo ErrHandler
  18.     With UserList(UserIndex)
  19.         'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  20.        Dim buffer As New clsByteQueue
  21.         Call buffer.CopyBuffer(.incomingData)
  22.  
  23.         'Remove packet ID
  24.        Call buffer.ReadByte
  25.  
  26.         Dim UserName As String
  27.         Dim copyFrom As String
  28.         Dim Password As String
  29.  
  30.         UserName = Replace(buffer.ReadASCIIString(), "+", " ")
  31.         copyFrom = Replace(buffer.ReadASCIIString(), "+", " ")
  32.  
  33.         If (Not .flags.Privilegios And PlayerType.RoleMaster) <> 0 And (.flags.Privilegios And (PlayerType.Admin)) Then
  34.  
  35.             If Not EsAdmin(UserName) And Not EsAdmin(UserList(UserIndex).Name) Then
  36.  
  37.                 Call LogGM(.Name, "Ha alterado la contraseña de " & UserName)
  38.  
  39.                 If LenB(UserName) = 0 Or LenB(copyFrom) = 0 Then
  40.                     Call WriteMessageClient(UserIndex, 300)    'usar /APASS <pjsinpass>@<pjconpass>
  41.                Else
  42.                     If Not FileExist(CharPath & UserName & ".chr") Or Not FileExist(CharPath & copyFrom & ".chr") Then
  43.                         Call WriteConsoleMsg(UserIndex, "Alguno de los PJs no existe " & UserName & "@" & copyFrom, FontTypeNames.FONTTYPE_INFO)
  44.                     Else
  45.                         Password = GetVar(CharPath & copyFrom & ".chr", "INIT", "Password")
  46.                         Call WriteVar(CharPath & UserName & ".chr", "INIT", "Password", Password)
  47.  
  48.                         Call WriteConsoleMsg(UserIndex, "Password de " & UserName & " ha cambiado por la de " & copyFrom, FontTypeNames.FONTTYPE_INFO)
  49.                     End If
  50.                 End If
  51.             Else
  52.                 Call WriteConsoleMsg(UserIndex, "Feli puto no vas a cambiarme la pass", FontTypeNames.FONTTYPE_INFO)    ' con amor, cuicui
  53.            End If
  54.  
  55.  
  56.         End If
  57.  
  58.         'If we got here then packet is complete, copy data back to original queue
  59.        Call .incomingData.CopyBuffer(buffer)
  60.     End With
  61.  
  62. ErrHandler:
  63.  
  64.     Dim Error As Long
  65.  
  66.     Error = Err.Number
  67.  
  68.     On Error GoTo 0
  69.  
  70.     'Destroy auxiliar buffer
  71.    Set buffer = Nothing
  72.  
  73.     If Error <> 0 Then Err.Raise Error
  74.  
  75. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement