Advertisement
Guest User

Untitled

a guest
Apr 17th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub SendPlayerChars(ByVal index As Long)
  2.     Dim Buffer As clsBuffer, tmpName As String, i As Long, tmpSprite As Long, tmpAccess As Long, tmpClass As Long, tmpUsergroup As Long
  3.     Dim SqlClass As String
  4.  
  5.  
  6.     If UsingMYSQL Then
  7.         Set MySQLReader = New ADODB.Recordset
  8.         Set Buffer = New clsBuffer
  9.         Buffer.WriteLong SPlayerChars
  10.        
  11.         SqlClass = "Select * from accounts where account='" & Trim$(GetPlayerLogin(index)) & "'"
  12.            
  13.         MySQLReader.CursorLocation = adUseServer
  14.         MySQLReader.CursorType = adOpenDynamic
  15.         MySQLReader.LockType = adLockOptimistic
  16.         MySQLReader.Open SqlClass, MySQLConnection
  17.         tmpUsergroup = MySQLReader!Usergroup
  18.         MySQLReader.Close
  19.        
  20.         Buffer.WriteLong tmpUsergroup
  21.        
  22.         For i = 1 To MAX_CHARS
  23.             Set MySQLReader = New ADODB.Recordset
  24.             SqlClass = "Select * from characters where account='" & Trim$(GetPlayerLogin(index)) & "' and charID='" & i & "'"
  25.            
  26.             MySQLReader.CursorLocation = adUseServer
  27.             MySQLReader.CursorType = adOpenDynamic
  28.             MySQLReader.LockType = adLockOptimistic
  29.             MySQLReader.Open SqlClass, MySQLConnection
  30.  
  31.            
  32.             If MySQLReader.EOF Then
  33.                 tmpName = vbNullString
  34.                 tmpSprite = 0
  35.                 tmpAccess = 0
  36.                 tmpClass = 0
  37.             Else
  38.                 tmpName = MySQLReader!Name
  39.                 tmpSprite = MySQLReader!Sprite
  40.                 tmpAccess = MySQLReader!Access
  41.                 tmpClass = MySQLReader!Class
  42.             End If
  43.            
  44.             Buffer.WriteString tmpName
  45.             Buffer.WriteLong tmpSprite
  46.             Buffer.WriteLong tmpAccess
  47.             Buffer.WriteLong tmpClass
  48.             MySQLReader.Close
  49.         Next
  50.         SendDataTo index, Buffer.ToArray()
  51.         Set Buffer = Nothing
  52.        Exit Sub
  53.     End If
  54.  
  55.     Set Buffer = New clsBuffer
  56.     Buffer.WriteLong SPlayerChars
  57.  
  58.     tmpUsergroup = GetVar(App.Path & "\data\accounts\" & SanitiseString(Trim$(Player(index).Login)) & ".ini", "ACCOUNT", "Usergroup")
  59.     Buffer.WriteLong tmpUsergroup
  60.  
  61.     ' loop through each character. clear, load, add. repeat.
  62.    For i = 1 To MAX_CHARS
  63.         tmpName = GetVar(App.Path & "\data\accounts\" & SanitiseString(Trim$(Player(index).Login)) & ".ini", "CHAR" & i, "Name")
  64.         tmpSprite = Val(GetVar(App.Path & "\data\accounts\" & SanitiseString(Trim$(Player(index).Login)) & ".ini", "CHAR" & i, "Sprite"))
  65.         tmpAccess = Val(GetVar(App.Path & "\data\accounts\" & SanitiseString(Trim$(Player(index).Login)) & ".ini", "CHAR" & i, "Access"))
  66.         tmpClass = Val(GetVar(App.Path & "\data\accounts\" & SanitiseString(Trim$(Player(index).Login)) & ".ini", "CHAR" & i, "Class"))
  67.         Buffer.WriteString tmpName
  68.         Buffer.WriteLong tmpSprite
  69.         Buffer.WriteLong tmpAccess
  70.         Buffer.WriteLong tmpClass
  71.     Next
  72.  
  73.     SendDataTo index, Buffer.ToArray()
  74.     Set Buffer = Nothing
  75. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement