Guest User

Clan Management Script

a guest
Dec 10th, 2020
50
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Script("Name")          = "Clan Moderation"
  2. Script("Abbreviation"= "clan moderation"
  3. Script("Author")        = "Fpa-rF- and PsYChiC-rF-"
  4. Script("Category")      = "Clan Management Script"
  5. Script("Major")         = 1
  6. Script("Minor")         = 0
  7. Script("Revision")      = 1
  8. Script("Description")   = "Clan Channel Moderation"
  9.  
  10.  
  11. '
  12. ' SCRIPT COMMANDS
  13. ' ===============
  14. ' about     -   Bot version information
  15. ' list      -   Lists all bot commands
  16. ' add       -   Add clan member
  17. ' rem       -   Remove clan member
  18. ' promote   -   Promote clan member
  19. ' demote    -   Demote clan member
  20. ' whois     -   User information
  21. ' whoami    -   User information
  22. ' safeadd   -   Sadeadd a username
  23. ' safedel   -   Safedel a username
  24. ' members   -   List all clan members
  25. ' info      -   Display clan information
  26. ' ranks     -   Lists all clan ranks -> clanranks (see below)
  27. ' open      -   Open clan recruiting position
  28. ' close     -   Close clan recruiting position
  29. ' dice      -   Rolls x dice
  30. '
  31. ' Not Implmented (Removed)
  32. ' shitlist shitadd shitdel shitcheck
  33. ' tagadd tagbans tagcheck tagdel
  34. ' motd mmail
  35. '
  36. '
  37.  
  38. ' AUXILIARY SCRIPT COMMANDS
  39. ' =========================
  40. ' kick      -   Kicks a user from channel
  41. ' ban       -   Bans a user from channel
  42. ' unban     -   Unbans a user from channel
  43.  
  44. ' SCRIPT SETTINGS
  45. ' ===============
  46. 'ENTER YOUR REQUIRED ACCESS LEVEL FOR COMMANDS (USE AT OWN RISK, MAY BREAK SCRIPT, USE 1)
  47. Public reqaccess : reqaccess = 1
  48.  
  49. 'RANKS/ROSTER FILE (KEEP OUT OF SCRIPTS FOLDER SCRIPTS ARE .TXT)
  50. Public cmds_list : cmds_list = BotPath() & "scripts\commands.xml"
  51. Public users_list : users_list = BotPath() & "scripts\..\users.txt"
  52. Public members_list : members_list = BotPath() & "scripts\..\members.txt"
  53.  
  54. 'ENTER YOUR CLAN TAG BELOW (ONE WILDCARD * ALLOWED, * IS MEMBER NAME)
  55. 'EXAMPLE RIGHT SIDED: clantag = "*-TaG-"
  56. 'EXAMPLE LEFT SIDED:  clantag = "~TaG~*"
  57. 'EXAMPLE DUAL SIDED:  clantag = "TaG]*[TaG"
  58. Public clantag : clantag = "*-rF-"
  59.  
  60. 'ENTER YOUR RANKS BELOW - ADD AS MANY AS YOU NEED (TOP TO BOTTOM KEEPING VBS SYNTAX)
  61. Public clanranks : clanranks = Array( _
  62. "Founder", _
  63. "Leader", _
  64. "Chief", _
  65. "General", _
  66. "Colonel" , _
  67. "Major" , _
  68. "Captain" , _
  69. "Lieutenant" , _
  70. "Officer" , _
  71. "Commander" , _
  72. "Sergeant" , _
  73. "Corporal" , _
  74. "Specialist" , _
  75. "Private" , _
  76. "Recruit")
  77.  
  78. Public lenAPIKEY : lenAPIKEY = 56
  79. Public intOpenPos : intOpenPos = 0
  80. Public strOpenPos : strOpenPos = ""
  81. Public oldCRC
  82. Public newCRC
  83. Public blnAfterJoin : blnAfterJoin = False
  84. Public strChannelBotName
  85.  
  86. Sub dbTimer_Timer()
  87.  
  88.     'dbTimer.Enabled = False
  89.     newCRC = GetFileCRC32(users_list)
  90.     'AddChat &H99CC00, crc
  91.     If oldCRC <> newCRC Then updateMembersList()
  92.    
  93. End Sub
  94.  
  95. Public Sub Event_Load()
  96.  
  97.     oldCRC = GetFileCRC32(users_list)
  98.     newCRC = oldCRC
  99.    
  100.     CreateObj "LongTimer", "dbTimer"
  101.     dbTimer.Interval = 10
  102.     dbTimer.Enabled = True
  103.    
  104.     ResetCommands()
  105.  
  106.     FormatTag()
  107.  
  108.     Dim objWriteFile
  109.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  110.     If objFSO.FileExists(members_list) Then
  111.    
  112.     Else
  113.    
  114.         dbTimer.Enabled = False
  115.    
  116.         strTempFounder = Replace(clantag, "*", "Username") 'Adds Temporary 1st Clan Member
  117.        
  118.         AddChat &H99CC00, "[ERROR] No clan members found!"
  119.        
  120.         Set objWriteFile= objFSO.OpenTextFile(members_list, 8, True, 0)
  121.         objWriteFile.WriteLine(clanranks(0) & ": " & strTempFounder)
  122.         objWriteFile.Close
  123.        
  124.         AddChat &H99CC00, "[INFO] Welcome to .: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  125.  
  126.         AddChat &H99CC00, "[INFO] If you encounter any problems, delete these files:"
  127.         AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "users.txt"
  128.         AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "members.txt"
  129.         AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "commands.xml"
  130.         AddChat &H99CC00, "[INFO] And then reload the bot or script to continue."
  131.        
  132.         AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "members.txt file created."
  133.         AddChat &H99CC00, "[INFO] Please edit this file to contain the clan founder name with a valid clan tag! Clan tag currently set to: ", vbYellow, clantag
  134.         AddChat &H99CC00, "[INFO] ", vbYellow, "DO NOT ADD OTHER RANKS/MEMBERS DIRECTLY TO THIS FILE! PLEASE USE THE BOT COMMANDS."
  135.         AddChat &H99CC00, "[INFO] Please save and close this members.txt file before you continue."
  136.        
  137.         Set wShell = CreateObject("WScript.Shell")
  138.         statusCode = wShell.Run(members_list, 1, True)
  139.            
  140.         If objFSO.FileExists(users_list) Then
  141.             objFSO.DeleteFile users_list
  142.             Set objWriteFile= objFSO.OpenTextFile(users_list, 8, True, 0)
  143.             objWriteFile.WriteLine("")
  144.             objWriteFile.Close
  145.         Else
  146.             Set objWriteFile= objFSO.OpenTextFile(users_list, 8, True, 0)
  147.             objWriteFile.WriteLine("")
  148.             objWriteFile.Close
  149.         End If
  150.        
  151.         AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "users.txt file created."
  152.        
  153.         strTopRankUser = GetTopRankUser()
  154.         Call SafeAddUser(strTopRankUser,"1","S",False
  155.         strInfo = InfoUser(strTopRankUser, True)
  156.        
  157.         oldCRC = GetFileCRC32(users_list)
  158.         newCRC = oldCRC
  159.        
  160.         dbTimer.Enabled = True
  161.        
  162.         AddChat &H99CC00, "[INFO] Your bot is now setup, enjoy using ", vbYellow ,"StealthBot Beta v2.7 - Build 493 - Clan Management Script"
  163.        
  164.     End If
  165.  
  166.     If OpenCommand("about") Is Nothing Then
  167.         With CreateCommand("about")
  168.             .Description = "States the bot's version information."
  169.             .RequiredRank = reqaccess
  170.             .Save
  171.         End With
  172.     End If
  173.  
  174.     If OpenCommand("add") Is Nothing Then
  175.         With CreateCommand("add")
  176.             .Description = "Add a clan member by rank."
  177.             .RequiredRank = reqaccess
  178.             .Save
  179.         End With
  180.     End If
  181.  
  182.     If OpenCommand("rem") Is Nothing Then
  183.         With CreateCommand("rem")
  184.             .Description = "Remove users and clan members."
  185.             .RequiredRank = reqaccess
  186.             .Save
  187.         End With
  188.     End If
  189.  
  190.     If OpenCommand("whois") Is Nothing Then
  191.         With CreateCommand("whois")
  192.             .Description = "Returns the specified user's rank and flags."
  193.             .RequiredRank = reqaccess
  194.             .Save
  195.         End With
  196.     End If
  197.    
  198.     If OpenCommand("whoami") Is Nothing Then
  199.         With CreateCommand("whoami")
  200.             .Description = "Returns the requesting user's rank and flags."
  201.             .RequiredRank = reqaccess
  202.             .Save
  203.         End With
  204.     End If
  205.    
  206.     If OpenCommand("safeadd") Is Nothing Then
  207.         With CreateCommand("safeadd")
  208.             .Description = "Adds a safelist entry for a specifed user."
  209.             .RequiredRank = reqaccess
  210.             .Save
  211.         End With
  212.     End If
  213.    
  214.     If OpenCommand("safedel") Is Nothing Then
  215.         With CreateCommand("safedel")
  216.             .Description = "Removes a safelist entry for a specifed user."
  217.             .RequiredRank = reqaccess
  218.             .Save
  219.         End With
  220.     End If
  221.  
  222.     If OpenCommand("dice") Is Nothing Then
  223.         With CreateCommand("dice")
  224.             .Description = "Rolls the dice x times."
  225.             .RequiredRank = reqaccess
  226.             .Save
  227.         End With
  228.     End If
  229.  
  230.     If OpenCommand("members") Is Nothing Then
  231.         With CreateCommand("members")
  232.             .Description = "List all clan members by rank."
  233.             .RequiredRank = reqaccess
  234.             .Save
  235.         End With
  236.     End If
  237.  
  238.     If OpenCommand("info") Is Nothing Then
  239.         With CreateCommand("info")
  240.             .Description = "Lists the number of clan members and clan info."  
  241.             .RequiredRank = reqaccess
  242.             .Save
  243.         End With
  244.     End If
  245.    
  246.     If OpenCommand("ranks") Is Nothing Then
  247.         With CreateCommand("ranks")
  248.             .Description = "List all clan ranks."
  249.             .RequiredRank = reqaccess
  250.             .Save
  251.         End With
  252.     End If
  253.  
  254.     If OpenCommand("promote") Is Nothing Then
  255.         With CreateCommand("promote")
  256.             .Description = "Promote a clan member by one rank."
  257.             .RequiredRank = reqaccess
  258.             .Save
  259.         End With
  260.     End If
  261.    
  262.     If OpenCommand("demote") Is Nothing Then
  263.         With CreateCommand("demote")
  264.             .Description = "Demote a clan member by one rank."
  265.             .RequiredRank = reqaccess
  266.             .Save
  267.         End With
  268.     End If
  269.  
  270.     If OpenCommand("open") Is Nothing Then
  271.         With CreateCommand("open")
  272.             .Description = "Open a clan rank recruting position."
  273.             .RequiredRank = reqaccess
  274.             .Save
  275.         End With
  276.     End If
  277.  
  278.     If OpenCommand("close") Is Nothing Then
  279.         With CreateCommand("close")
  280.             .Description = "Close a clan rank recruting position."
  281.             .RequiredRank = reqaccess
  282.             .Save
  283.         End With
  284.     End If
  285.    
  286. End Sub
  287.  
  288. Public Sub Event_ChannelJoin(ChannelName, Flags)
  289.  
  290.     If Len(BotVars.Username) = lenAPIKEY And blnAfterJoin = False Then
  291.         strChannelBotName = LCase(ChannelName)
  292.         strChannelBotName = Replace(strChannelBotName,"op ","")
  293.         strChannelBotName = Replace(strChannelBotName,"clan ","")
  294.         blnAfterJoin = True
  295.     End If
  296.    
  297. End Sub
  298.  
  299.  
  300. Public Sub Event_UserTalk(Username, Flags, Message, Ping)
  301.  
  302.     strUser = Username
  303.     strCommand = Right(Message, Len(Message)-1)
  304.        
  305.     If InStr(1, strCommand, " ", vbTextCompare) = 0 Then '0 or 1 arg
  306.         strKick = strCommand
  307.         strInfo = InfoUser(strUser, True)
  308.         strAccess = GetCmdAccess(LCase(strCommand))
  309.     Else
  310.         strSplit = Split(strCommand, " ") '2 or more args
  311.         strCommand = strSplit(0)
  312.         strKick = strSplit(1)
  313.         strArg = strSplit(1)
  314.         strInfo = InfoUser(strUser, True)
  315.         strAccess = GetCmdAccess(LCase(strCommand))
  316.     End If
  317.  
  318.     If LCase(strCommand) = "list" Then
  319.            
  320.             If strUser <> "" And strInfo <> "" Then
  321.                 strSplit = Split(strInfo, " ") '2 or more args
  322.                 strUserAccess = strSplit(1)
  323.                 strReqAccess = strAccess
  324.                
  325.                 If Int(strUserAccess) >= Int(strAccess) And strArg = "" Then
  326.                     AddChat &H99CC00, "[ERROR] You must supply a numerical bot access level to view all of the available commands."
  327.                     AddQ "[ERROR] You must supply a numerical bot access level to view all of the available commands."
  328.                     Exit Sub
  329.                 End If
  330.                
  331.             End If
  332.    
  333.     End If
  334.    
  335.     If LCase(strCommand) = "kick" Then
  336.    
  337.     isMember = GetRank(Username) : If isMember = "" Then Exit Sub
  338.    
  339.         If strUser <> "" And strInfo <> "" Then
  340.        
  341.             strSplit = Split(strInfo, " ") '2 or more args
  342.             strUserAccess = strSplit(1)
  343.            
  344.             strInfo = InfoUser(strKick, True)
  345.             If strInfo <> "" Then
  346.            
  347.                 strSplit = Split(strInfo, " ") '2 or more args
  348.                 strKickUser = strSplit(0)
  349.                 strKickSafe = strSplit(2)
  350.                
  351.                 intRank = GetRankIndex(strUser)
  352.                 intSupRank = GetRankIndex(strKickUser)
  353.                
  354.                 If Int(strUserAccess) >= Int(strAccess) And intRank < intSupRank And strKickSafe <> "S" Then
  355.                     KickUser(strKickUser)
  356.                     Exit Sub
  357.                 ElseIf Int(strUserAccess) > 0 And strKickSafe = "S" Then
  358.                     AddChat &H99CC00,"[ERROR] That user is safelisted."
  359.                     AddQ "[ERROR] That user is safelisted."
  360.                     Exit Sub
  361.                 ElseIf Int(strUserAccess) < Int(strAccess) Then
  362.                     AddChat &H99CC00,"[ERROR] You do not have sufficient access to do that."
  363.                     AddQ "[ERROR] You do not have sufficient access to do that."
  364.                     Exit Sub
  365.                 ElseIf intRank >= intSupRank Then
  366.                     AddChat &H99CC00,"[ERROR] Cannot kick " & strKickUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
  367.                     AddQ "[ERROR] Cannot kick " & strKickUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
  368.                     Exit Sub
  369.                 End If
  370.            
  371.             ElseIf Int(strUserAccess) >= Int(strAccess) And strInfo = "" Then
  372.                 KickUser(strKick)
  373.                 Exit Sub
  374.             End If
  375.            
  376.         End If
  377.        
  378.     End If
  379.  
  380.     If LCase(strCommand) = "ban" Then
  381.    
  382.     isMember = GetRank(Username) : If isMember = "" Then Exit Sub
  383.    
  384.         If strUser <> "" And strInfo <> "" Then
  385.        
  386.             strSplit = Split(strInfo, " ") '2 or more args
  387.             strUserAccess = strSplit(1)
  388.            
  389.             strInfo = InfoUser(strKick, True)
  390.             If strInfo <> "" Then
  391.            
  392.                 strSplit = Split(strInfo, " ") '2 or more args
  393.                 strBanUser = strSplit(0)
  394.                 strBanSafe = strSplit(2)
  395.                
  396.                 intRank = GetRankIndex(strUser)
  397.                 intSupRank = GetRankIndex(strBanUser)
  398.                
  399.                 If Int(strUserAccess) >= Int(strAccess) And intRank < intSupRank And strBanSafe <> "S" Then
  400.                     BanUser(strBanUser)
  401.                     Exit Sub
  402.                 ElseIf Int(strUserAccess) > 0 And strBanSafe = "S" Then
  403.                     AddChat &H99CC00,"[ERROR] That user is safelisted."
  404.                     AddQ "[ERROR] That user is safelisted."
  405.                     Exit Sub
  406.                 ElseIf Int(strUserAccess) < Int(strAccess) Then
  407.                     AddChat &H99CC00,"[ERROR] You do not have sufficient access to do that."
  408.                     AddQ "[ERROR] You do not have sufficient access to do that."
  409.                     Exit Sub
  410.                 ElseIf intRank >= intSupRank Then
  411.                     AddChat &H99CC00,"[ERROR] Cannot ban " & strBanUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
  412.                     AddQ "[ERROR] Cannot ban " & strBanUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
  413.                     Exit Sub
  414.                 End If
  415.            
  416.             ElseIf Int(strUserAccess) >= Int(strAccess) And strInfo = "" Then
  417.            
  418.                 BanUser(strKick)
  419.                 Exit Sub
  420.            
  421.             End If
  422.            
  423.         End If
  424.        
  425.     End If
  426.        
  427.     If LCase(strCommand) = "unban" Then
  428.        
  429.         isMember = GetRank(Username) : If isMember = "" Then Exit Sub
  430.        
  431.         strInfo = InfoUser(strUser, True)
  432.         If strUser <> "" And strInfo <> "" Then
  433.        
  434.             strSplit = Split(strInfo, " ") '2 or more args
  435.             strUserAccess = strSplit(1)
  436.  
  437.             If Int(strUserAccess) >= Int(strAccess) Then
  438.                 UnBanUser(strKick)
  439.                 Exit Sub
  440.             ElseIf Int(strUserAccess) < Int(strAccess) Then
  441.                 AddChat &H99CC00,"[ERROR] You do not have sufficient access to do that."
  442.                 AddQ "[ERROR] You do not have sufficient access to do that."
  443.                 Exit Sub
  444.             End If 
  445.            
  446.         End If
  447.        
  448.     End If 
  449.    
  450. End Sub
  451.  
  452. Public Sub Event_MessageQueued(MessageID, Message, Tag)
  453.  
  454.     strUser = BotVars.Username
  455.     strCommand = Right(Message, Len(Message)-1)
  456.  
  457.     If Left(strCommand,5) = "unban" Then
  458.    
  459.         If InStr(1, strCommand, " ", vbTextCompare) = 0 Then '0 or 1 arg
  460.             strUser = strCommand
  461.         Else
  462.             strSplit = Split(strCommand, " ") '2 or more args
  463.             strUser = strSplit(1)
  464.         End If
  465.            
  466.         If strUser <> "" Then
  467.             AddChat &H99CC00, "[UNBANNED] "" " & strUser & " "", feel free to invite them to rejoin the channel."
  468.             Command.Respond "[UNBANNED] "" " & strUser & " "", feel free to invite them to rejoin the channel."
  469.             Exit Sub
  470.         End If
  471.            
  472.     End If
  473.    
  474. End Sub
  475.  
  476. Public Sub Event_Command(Command)
  477.  
  478.     FormatTag()
  479.    
  480.     If LCase(Command.Username) = LCase("[b]" & strChannelBotName) Then strCommandUsername = Command.Username
  481.    
  482.     If LCase(Command.Name) = "about" Then
  483.    
  484.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  485.             'AddChat &H99CC00,".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  486.             Command.Respond ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  487.             'AddQ ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  488.             Exit Sub
  489.         Else
  490.             'AddChat &H99CC00,".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  491.             Command.Respond ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  492.             'AddQ ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  493.             Exit Sub
  494.         End If
  495.  
  496.     End If
  497.    
  498.     If LCase(Command.Name) = "whoami" Then
  499.  
  500.         strInfo = InfoUser(Command.Username, True)
  501.        
  502.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  503.             'AddChat &H99CC00, ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  504.             Command.Respond ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  505.             Exit Sub
  506.         ElseIf strInfo = "" Then
  507.             'AddChat &H99CC00, "[ERROR] No such user(s) found."
  508.             Command.Respond "[ERROR] No such user(s) found."
  509.             Exit Sub
  510.         Else
  511.             strSplit = Split(strInfo, " ") '2 or more args
  512.             If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  513.             If strSplit(2) = "S" Then : strSafe = "safelisted" : Else : strSafe = "not safelisted" : End If
  514.             'AddChat &H99CC00, "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
  515.             Command.Respond "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
  516.             Exit Sub
  517.         End If
  518.        
  519.     End If
  520.  
  521.     If LCase(Command.Name) = "whois" Then
  522.    
  523.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  524.             strUser = Command.Args
  525.         Else
  526.             strSplit = Split(Command.Args, " ") '2 or more args
  527.             strUser = strSplit(0)
  528.         End If
  529.        
  530.         If strUser <> "" Then
  531.        
  532.             strInfo = InfoUser(strUser, True)
  533.             If strInfo = "" Then
  534.                 'AddChat &H99CC00, "[ERROR] No such user(s) found."
  535.                 Command.Respond "[ERROR] No such user(s) found."
  536.                 Exit Sub
  537.             Else
  538.                 strSplit = Split(strInfo, " ") '2 or more args
  539.                 If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  540.                 If strSplit(2) = "S" Then : strSafe = "safelisted" : Else : strSafe = "not safelisted" : End If
  541.                 'AddChat &H99CC00, "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
  542.                 Command.Respond "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
  543.                 Exit Sub
  544.             End If
  545.            
  546.         End If
  547.        
  548.     End If
  549.  
  550.     If LCase(Command.Name) = "safeadd" Then
  551.  
  552.         dbTimer.Enabled = False
  553.        
  554.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  555.             strUser = Command.Username
  556.             strUsername = Command.Args
  557.             strInfo = InfoUser(strUsername, True)
  558.         Else
  559.             strUser = Command.Username
  560.             strSplit = Split(Command.Args, " ") '2 or more args
  561.             strUsername = strSplit(0)
  562.             strInfo = InfoUser(strUsername, True)
  563.         End If
  564.  
  565.         strSplit = Split(strInfo, " ") '2 or more args
  566.         If UBound(strSplit) > 2 Then
  567.             If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  568.         Else
  569.             strRank = "Username"
  570.         End If
  571.        
  572.         If strInfo <> "" And strUsername <> "" Then
  573.             If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  574.                 Call SafeAddUser(strUsername,strSplit(1),"S",False)
  575.                 'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  576.                 Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  577.                 oldCRC = GetFileCRC32(users_list)
  578.                 newCRC = oldCRC
  579.                 dbTimer.Enabled = True
  580.                 ReloadSettings 1
  581.                 Exit Sub
  582.             End If
  583.         ElseIf strInfo = "" And strUsername <> "" Then
  584.             If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  585.                 Call SafeAddUser(strUsername,"0","S",False)
  586.                 'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  587.                 Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  588.                 oldCRC = GetFileCRC32(users_list)
  589.                 newCRC = oldCRC
  590.                 dbTimer.Enabled = True
  591.                 ReloadSettings 1
  592.                 Exit Sub
  593.             End If
  594.         End If
  595.        
  596.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  597.    
  598.         If strInfo <> "" And strUsername <> "" Then
  599.             Call SafeAddUser(strUsername,strSplit(1),"S",False)
  600.             'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  601.             Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  602.             oldCRC = GetFileCRC32(users_list)
  603.             newCRC = oldCRC
  604.             dbTimer.Enabled = True
  605.             ReloadSettings 1
  606.             Exit Sub
  607.         ElseIf strInfo = "" And strUsername <> "" Then
  608.             Call SafeAddUser(strUsername,"0","S",False)
  609.             'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  610.             Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  611.             oldCRC = GetFileCRC32(users_list)
  612.             newCRC = oldCRC
  613.             dbTimer.Enabled = True
  614.             ReloadSettings 1
  615.             Exit Sub
  616.         End If
  617.        
  618.     End If
  619.  
  620.     If LCase(Command.Name) = "safedel" Then
  621.    
  622.         dbTimer.Enabled = False
  623.  
  624.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  625.             strUser = Command.Username
  626.             strUsername = Command.Args
  627.             strInfo = InfoUser(strUsername, True)
  628.         Else
  629.             strUser = Command.Username
  630.             strSplit = Split(Command.Args, " ") '2 or more args
  631.             strUsername = strSplit(0)
  632.             strInfo = InfoUser(strUsername, True)
  633.         End If
  634.  
  635.         strSplit = Split(strInfo, " ") '2 or more args
  636.         If UBound(strSplit) > 2 Then
  637.             If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  638.         Else
  639.             strRank = "Username"
  640.         End If
  641.        
  642.         If strInfo <> "" And strUsername <> "" Then
  643.             If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY           
  644.                 Call SafeAddUser(strUsername,strSplit(1),"%",False)
  645.                 'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  646.                 Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  647.                 oldCRC = GetFileCRC32(users_list)
  648.                 newCRC = oldCRC
  649.                 dbTimer.Enabled = True
  650.                 ReloadSettings 1
  651.                 Exit Sub
  652.             End If
  653.         ElseIf strInfo = "" And strUsername <> "" Then
  654.             If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  655.                 Call SafeAddUser(strUsername,"0","%",False)
  656.                 'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  657.                 Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  658.                 oldCRC = GetFileCRC32(users_list)
  659.                 newCRC = oldCRC
  660.                 dbTimer.Enabled = True
  661.                 ReloadSettings 1
  662.                 Exit Sub
  663.             End If
  664.         End If
  665.  
  666.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  667.        
  668.         intRank = GetRankIndex(Command.Username)
  669.         intSupRank = GetRankIndex(strUsername)
  670.        
  671.         If intSupRank = "" Then intSupRank = intRank + 1
  672.        
  673.         If intRank < intSupRank And strInfo = "" And strUsername <> "" Then
  674.             Call SafeAddUser(strUsername,"0","%",False)
  675.             'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  676.             Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  677.             oldCRC = GetFileCRC32(users_list)
  678.             newCRC = oldCRC
  679.             dbTimer.Enabled = True
  680.             ReloadSettings 1
  681.             Exit Sub
  682.         ElseIf intRank < intSupRank And strInfo <> "" And strUsername <> "" Then       
  683.             Call SafeAddUser(strUsername,strSplit(1),"%",False)
  684.             'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  685.             Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  686.             oldCRC = GetFileCRC32(users_list)
  687.             newCRC = oldCRC
  688.             dbTimer.Enabled = True
  689.             ReloadSettings 1
  690.             Exit Sub
  691.         ElseIf intRank >= intSupRank Then
  692.             'AddChat &H99CC00, "[ERROR] Cannot safedel " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist. " & strUser & " has a higher rank."
  693.             Command.Respond "[ERROR] Cannot safedel " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist. " & strUser & " has a higher rank."
  694.             Exit Sub
  695.         End If
  696.        
  697.     End If
  698.  
  699.    
  700.     If LCase(Command.Name) = "members" Then
  701.    
  702.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  703.            
  704.             intNumMembers = NumLines(members_list)
  705.             strMembers = Split(ListMembers(), vbcrlf)
  706.  
  707.             For x = 0 To intNumMembers - 1
  708.                 'AddChat &H99CC00, strMembers(x)
  709.                 Command.Respond strMembers(x)
  710.             Next
  711.            
  712.             Exit Sub
  713.            
  714.         End If
  715.        
  716.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  717.    
  718.         intNumMembers = NumLines(members_list)
  719.         strMembers = Split(ListMembers(), vbcrlf)
  720.  
  721.         For x = 0 To intNumMembers - 1
  722.             'AddQ &H99CC00, strMembers(x)
  723.             Command.Respond strMembers(x)
  724.         Next
  725.        
  726.     End If
  727.    
  728.     If LCase(Command.Name) = "info" Then
  729.    
  730.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  731.        
  732.             intNumMembers = NumMembers()
  733.             If intOpenPos > 0 Then
  734.                 strOpenPos = Left(strOpenPos,Len(strOpenPos)-2) & "."
  735.                 'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " open recruiting positions: " & strOpenPos
  736.                 Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " open recruiting positions: " & strOpenPos
  737.                 Exit Sub
  738.             Else
  739.                 'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
  740.                 Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
  741.                 Exit Sub
  742.             End If
  743.        
  744.         End If
  745.        
  746.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  747.    
  748.         intNumMembers = NumMembers()
  749.         If intOpenPos > 0 Then
  750.             strOpenPos = Left(strOpenPos,Len(strOpenPos)-2) & "."
  751.             'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " recruiting positions: " & strOpenPos
  752.             Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " recruiting positions: " & strOpenPos
  753.             Exit Sub
  754.         Else
  755.             'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
  756.             Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
  757.             Exit Sub
  758.         End If
  759.        
  760.     End If
  761.    
  762.     If LCase(Command.Name) = "ranks" Then
  763.    
  764.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  765.        
  766.             For x = LBound(clanranks) To UBound(clanranks)
  767.                 strMessage = strMessage & clanranks(x) & ", "
  768.             Next
  769.             strMessage = Left(strMessage,Len(strMessage)-2) & "."
  770.             'AddChat &H99CC00, "[" & UBound(clanranks) + 1 &"] " & strMessage
  771.             Command.Respond "[" & UBound(clanranks) + 1 &"] " & strMessage
  772.             Exit Sub
  773.        
  774.         End If
  775.  
  776.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  777.    
  778.         For x = LBound(clanranks) To UBound(clanranks)
  779.             strMessage = strMessage & clanranks(x) & ", "
  780.         Next
  781.         strMessage = Left(strMessage,Len(strMessage)-2) & "."
  782.         'AddChat &H99CC00, "[" & UBound(clanranks) + 1 &"] " & strMessage
  783.         Command.Respond "[" & UBound(clanranks) + 1 &"] " & strMessage
  784.        
  785.     End If
  786.    
  787.     If LCase(Command.Name) = "add" Then
  788.  
  789.         dbTimer.Enabled = False
  790.    
  791.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  792.    
  793.             If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  794.                 'AddChat &H99CC00, "[ERROR] You must specify a username and clanrank."
  795.                 Command.Respond "[ERROR] You must specify a username and clanrank."
  796.             Else
  797.            
  798.                 strSplit = Split(Command.Args, " ") '2 or more args
  799.                 strUsername = strSplit(0)
  800.                 strSetRank = strSplit(1)
  801.        
  802.                 If CheckTag(strUsername) = 1 And FindRank(strSetRank) <> "" Then
  803.                     If DelCMember(strUsername) = True Then
  804.                         Call AddCMember(strUsername, strSetRank)
  805.                         'AddChat &H99CC00, "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
  806.                         Command.Respond "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
  807.                         Call SafeAddUser(strUsername,"1","S",False)
  808.                         oldCRC = GetFileCRC32(users_list)
  809.                         newCRC = oldCRC
  810.                         dbTimer.Enabled = True
  811.                         ReloadSettings 1
  812.                     End If
  813.                 ElseIf FindRank(strSetRank) = "" Then
  814.                     'AddChat &H99CC00, "[ERROR] The clanrank you specified is not valid."  
  815.                     Command.Respond "[ERROR] The clanrank you specified is not valid." 
  816.                 ElseIf CheckTag(strUsername) = 0 Then
  817.                     'AddChat &H99CC00, "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
  818.                     Command.Respond "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
  819.                 End If
  820.                
  821.             End If
  822.            
  823.             Exit Sub
  824.        
  825.         End If
  826.  
  827.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  828.    
  829.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  830.                 'AddChat &H99CC00, "[ERROR] You must specify a username and clanrank."
  831.                 Command.Respond "[ERROR] You must specify a username and clanrank."
  832.         Else
  833.            
  834.             strUser = Command.Username
  835.             strSplit = Split(Command.Args, " ") '2 or more args
  836.             strUsername = strSplit(0)
  837.             strSetRank = strSplit(1)
  838.            
  839.             If CheckTag(strUser) = 1 And FindRank(strSetRank) <> "" Then
  840.            
  841.                 strRankIndex = GetIndexOfRank(strSetRank)              
  842.                 strSupRank = GetRankIndex(strUser)
  843.                
  844.                 If strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  845.                    
  846.                     If strUserAccess >= strAccess And DelCMember(strUsername) = True Then
  847.                         Call AddCMember(strUsername, strSetRank)
  848.                         'AddChat &H99CC00, "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
  849.                         Command.Respond "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
  850.                         Call SafeAddUser(strUsername,"1","S",False)
  851.                         ReloadSettings 1
  852.                     End If
  853.                    
  854.                 ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  855.                     'AddChat &H99CC00, "[ERROR] You cannot add a clan member to your same rank or higher."
  856.                     Command.Respond "[ERROR] You cannot add a clan member to your same rank or higher."
  857.                 End If
  858.  
  859.             ElseIf CheckTag(strUser) = 2 Then
  860.                 'AddChat &H99CC00, "[ERROR] Cannot add member to Clan " & clantag & " members list. The username "" " & strUsername & " "" is restricted. i.e Invalid special characters."
  861.                 Command.Respond "[ERROR] Cannot add member to Clan " & clantag & " members list. The username "" " & strUsername & " "" is restricted. i.e Invalid special characters."
  862.             ElseIf FindRank(strSetRank) = "" Then
  863.                 'AddChat &H99CC00, "[ERROR] The clanrank you specified is not valid."  
  864.                 Command.Respond "[ERROR] The clanrank you specified is not valid." 
  865.             ElseIf CheckTag(strUsername) = 0 Then
  866.                 'AddChat &H99CC00, "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
  867.                 Command.Respond "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
  868.             End If
  869.                        
  870.         End If
  871.        
  872.     End If
  873.    
  874.     If LCase(Command.Name) = "rem" Then
  875.    
  876.         dbTimer.Enabled = False
  877.    
  878.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  879.             strUser = Command.Username
  880.             strUsername = Command.Args
  881.             strInfo = InfoUser(strUsername, True)
  882.         Else
  883.             strUser = Command.Username
  884.             strSplit = Split(Command.Args, " ") '2 or more args
  885.             strUsername = strSplit(0)
  886.             strInfo = InfoUser(strUsername, True)
  887.         End If
  888.        
  889.         If strInfo <> "" Then
  890.             strSplit = Split(strInfo, " ") '2 or more args
  891.             strSafe = strSplit(2)
  892.         Else
  893.             'AddChat &H99CC00, "[ERROR] That user does not exist."
  894.             Command.Respond "[ERROR] That user does not exist."
  895.             Exit Sub
  896.         End If
  897.  
  898.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  899.             If strSafe <> "S" Then
  900.                 strRank = GetRank(strUsername)     
  901.                 If DelCMember(strUsername) = True Then             
  902.                         strSplit = Split(strInfo, " ") '2 or more args
  903.                         If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  904.                         Call RemUser(strUsername)          
  905.                         'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
  906.                         Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
  907.                         oldCRC = GetFileCRC32(users_list)
  908.                         newCRC = oldCRC
  909.                         dbTimer.Enabled = True
  910.                         ReloadSettings 1               
  911.                         Exit Sub   
  912.                     End If
  913.                 ElseIf strSafe = "S" Then
  914.                     'AddChat &H99CC00, "[ERROR] That user is safelisted."
  915.                     Command.Respond "[ERROR] That user is safelisted."
  916.                     Exit Sub
  917.                 End If
  918.         End If
  919.  
  920.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  921.        
  922.         strRank = GetRankIndex(strUser)
  923.         strGetRank = GetRankIndex(strUsername)
  924.         If strGetRank = "" Then strGetRank = strRank + 1
  925.                    
  926.         If CheckTag(strUser) = 1 And strRank < strGetRank And strSafe <> "S" Then
  927.             strRank = GetRank(strUsername) 
  928.             If DelCMember(strUsername) = True Then     
  929.                 strSplit = Split(strInfo, " ") '2 or more args
  930.                 If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  931.                 Call RemUser(strUsername)          
  932.                 'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
  933.                 Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
  934.                 oldCRC = GetFileCRC32(users_list)
  935.                 newCRC = oldCRC
  936.                 dbTimer.Enabled = True
  937.                 ReloadSettings 1               
  938.                 Exit Sub   
  939.             End If
  940.         ElseIf CheckTag(strUser) = 1 And strRank < strGetRank And strSafe = "S" Then
  941.             'AddChat &H99CC00, "[ERROR] That user is safelisted."
  942.             Command.Respond "[ERROR] That user is safelisted."
  943.             Exit Sub
  944.         ElseIf CheckTag(strUser) = 2 Or strRank > strGetRank Then
  945.             'AddChat &H99CC00, "[ERROR] You do not have sufficient access to do that."
  946.             Command.Respond "[ERROR] You do not have sufficient access to do that."
  947.             Exit Sub
  948.         End If
  949.        
  950.     End If
  951.        
  952.     If LCase(Command.Name) = "promote" Then
  953.  
  954.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  955.             strUsername = Command.Args
  956.             strRankIndex = GetRankIndex(strUsername)
  957.             strSupRank = GetRankIndex(Command.Username)    
  958.         Else
  959.             strSplit = Split(Command.Args, " ") '2 or more args
  960.             strUsername = strSplit(0)
  961.             strRankIndex = GetRankIndex(strUsername)
  962.             strSupRank = GetRankIndex(Command.Username)
  963.         End If
  964.    
  965.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  966.             strRank = GetRank(strUsername)
  967.             PromoteCMember(strUsername)
  968.             strNewRank = GetRank(strUsername)
  969.             'AddChat &H99CC00, "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  970.             Command.Respond "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  971.             Exit Sub   
  972.         End If
  973.    
  974.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  975.    
  976.         If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  977.             strRank = GetRank(strUsername)
  978.             PromoteCMember(strUsername)
  979.             strNewRank = GetRank(strUsername)
  980.             'AddChat &H99CC00, "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  981.             Command.Respond "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  982.             Exit Sub
  983.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < (strRankIndex - 1) Then
  984.             strRank = GetRank(strUsername)
  985.             PromoteCMember(strUsername)
  986.             strNewRank = GetRank(strUsername)
  987.             'AddChat &H99CC00, "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  988.             Command.Respond "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  989.             Exit Sub
  990.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  991.             'AddChat &H99CC00, "[ERROR] You cannot promote a clan member of same rank or higher."
  992.             Command.Respond "[ERROR] You cannot promote a clan member of same rank or higher."
  993.             Exit Sub
  994.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= (strRankIndex - 1) Then
  995.             'AddChat &H99CC00, "[ERROR] You cannot promote a clan member to the same rank or higher."
  996.             Command.Respond "[ERROR] You cannot promote a clan member to the same rank or higher."
  997.             Exit Sub
  998.         ElseIf Command.Args = "" Then
  999.             'AddChat &H99CC00, "[ERROR] You must specify a clan member to promote."
  1000.             Command.Respond "[ERROR] You must specify a clan member to promote."
  1001.             Exit Sub
  1002.         Else
  1003.             'AddChat &H99CC00, "[ERROR] The member you are trying to promote is not in Clan " & clantag & " members list."
  1004.             Command.Respond "[ERROR] The member you are trying to promote is not in Clan " & clantag & " members list."
  1005.         End If 
  1006.        
  1007.     End If 
  1008.    
  1009.     If LCase(Command.Name) = "demote" Then
  1010.    
  1011.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  1012.             strUsername = Command.Args
  1013.             strRankIndex = GetRankIndex(strUsername)
  1014.             strSupRank = GetRankIndex(Command.Username)
  1015.         Else
  1016.             strSplit = Split(strArgs, " ") '2 or more args
  1017.             strUsername = strSplit(0)
  1018.             strRankIndex = GetRankIndex(strUsername)
  1019.             strSupRank = GetRankIndex(Username)
  1020.         End If
  1021.                
  1022.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  1023.             strRank = GetRank(strUsername)
  1024.             DemoteCMember(strUsername)
  1025.             strNewRank = GetRank(strUsername)
  1026.             'AddChat &H99CC00, "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1027.             Command.Respond "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1028.             Exit Sub   
  1029.         End If
  1030.            
  1031.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  1032.            
  1033.         If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  1034.             strRank = GetRank(strUsername)
  1035.             DemoteCMember(strUsername)
  1036.             strNewRank = GetRank(strUsername)
  1037.             'AddChat &H99CC00, "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1038.             Command.Respond "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1039.             Exit Sub
  1040.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  1041.             strRank = GetRank(strUsername)
  1042.             DemoteCMember(strUsername)
  1043.             strNewRank = GetRank(strUsername)
  1044.             'AddChat &H99CC00, "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1045.             Command.Respond "[DEMOTE] " & strRank & ": " & strUsername & " has been demoted to rank " & strNewRank
  1046.             Exit Sub
  1047.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  1048.             'AddChat &H99CC00, "[ERROR] You cannot demote a clan member of same rank or higher."
  1049.             Command.Respond "[ERROR] You cannot demote a clan member of same rank or higher."
  1050.             Exit Sub
  1051.         ElseIf Command.Args = "" Then
  1052.             'AddChat &H99CC00, "[ERROR] You must specify a clan member to demote."
  1053.             Command.Respond "[ERROR] You must specify a clan member to demote."
  1054.             Exit Sub
  1055.         Else
  1056.             'AddChat &H99CC00, "[ERROR] The member you are trying to demote is not in Clan " & clantag & " members list."
  1057.             Command.Respond "[ERROR] The member you are trying to demote is not in Clan " & clantag & " members list."
  1058.         End If
  1059.        
  1060.     End If
  1061.  
  1062.     If LCase(Command.Name) = "open" Then
  1063.  
  1064.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  1065.             strUser = Command.Username
  1066.             strSetRank = FindRank(Command.Args)
  1067.             strRankIndex = GetIndexOfRank(strSetRank)
  1068.             strSupRank = GetRankIndex(Command.Username)
  1069.         Else
  1070.             strUser = Command.Username
  1071.             strSplit = Split(strArgs, " ") '2 or more args
  1072.             strSetRank = FindRank(strSplit(0))
  1073.             strRankIndex = GetIndexOfRank(strSetRank)
  1074.             strSupRank = GetRankIndex(Username)
  1075.         End If
  1076.        
  1077.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  1078.             Call AddCMember("(OPEN)", strSetRank)
  1079.             'AddChat &H99CC00, "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1080.             Command.Respond "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1081.             Exit Sub
  1082.         End If
  1083.    
  1084.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  1085.                    
  1086.         If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  1087.             Call AddCMember("(OPEN)", strSetRank)
  1088.             'AddChat &H99CC00, "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1089.             Command.Respond "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1090.             Exit Sub
  1091.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  1092.             Call AddCMember("(OPEN)", strSetRank)
  1093.             'AddChat &H99CC00, "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1094.             Command.Respond "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1095.             Exit Sub
  1096.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  1097.             'AddChat &H99CC00, "[ERROR] You cannot open this recruiting position for Clan " & clantag & " you are not of a high enough rank."
  1098.             Command.Respond "[ERROR] You cannot open this recruiting position for Clan " & clantag & " you are not of a high enough rank."
  1099.             Exit Sub
  1100.         ElseIf Command.Args = "" Then
  1101.             'AddChat &H99CC00, "[ERROR] You must specify a clanrank recruiting position to open."
  1102.             Command.Respond "[ERROR] You must specify a clanrank recruiting position to open."
  1103.             Exit Sub
  1104.         Else
  1105.             'AddChat &H99CC00, "[ERROR] You specified an invalid clanrank recruiting position to open."
  1106.             Command.Respond "[ERROR] You specified an invalid clanrank recruiting position to open."
  1107.         End If 
  1108.        
  1109.     End If
  1110.  
  1111.     If LCase(Command.Name) = "close" Then
  1112.    
  1113.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  1114.             strUser = Command.Username
  1115.             strSetRank = FindRank(Command.Args)
  1116.             strRankIndex = GetIndexOfRank(strSetRank)
  1117.             strSupRank = GetRankIndex(Command.Username)
  1118.         Else
  1119.             strUser = Command.Username
  1120.             strSplit = Split(strArgs, " ") '2 or more args
  1121.             strSetRank = FindRank(strSplit(0))
  1122.             strRankIndex = GetIndexOfRank(strSetRank)
  1123.             strSupRank = GetRankIndex(Username)
  1124.         End If
  1125.        
  1126.         If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
  1127.             If RemRankPos(strSetRank) = True Then
  1128.                 'AddChat &H99CC00, "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1129.                 Command.Respond "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1130.                 Exit Sub
  1131.             End If
  1132.         End If
  1133.  
  1134.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  1135.        
  1136.         If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  1137.             If RemRankPos(strSetRank) = True Then
  1138.                 'AddChat &H99CC00, "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1139.                 Command.Respond "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1140.                 Exit Sub
  1141.             End If
  1142.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  1143.             If RemRankPos(strSetRank) = True Then
  1144.                 'AddChat &H99CC00, "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1145.                 Command.Respond "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1146.                 Exit Sub
  1147.             End If
  1148.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  1149.             'AddChat &H99CC00, "[ERROR] You cannot close this recruiting position for Clan " & clantag & " you are not of a high enough rank."
  1150.             Command.Respond "[ERROR] You cannot close this recruiting position for Clan " & clantag & " you are not of a high enough rank."
  1151.             Exit Sub
  1152.         ElseIf Command.Args = "" Then
  1153.             'AddChat &H99CC00, "[ERROR] You must specify a clanrank recruiting position to close."
  1154.             Command.Respond "[ERROR] You must specify a clanrank recruiting position to close."
  1155.             Exit Sub
  1156.         Else
  1157.             'AddChat &H99CC00, "[ERROR] You specified an invalid clanrank recruiting position to close."
  1158.             Command.Respond "[ERROR] You specified an invalid clanrank recruiting position to close."
  1159.         End If 
  1160.        
  1161.     End If
  1162.    
  1163.     If LCase(Command.Name) = "dice" Then
  1164.    
  1165.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  1166.             intDice = Command.Args
  1167.         Else
  1168.             strSplit = Split(Command.Args, " ") '2 or more args
  1169.             intDice = Int(strSplit(0))
  1170.         End If
  1171.            
  1172.         If intDice <> "" Then
  1173.             If IsNumeric(intDice) = True And Int(intDice) > 0 And Int(intDice) < 6 Then
  1174.                 Randomize()
  1175.                 strRolled = "Rolls dice: "
  1176.                 For x = 1 To intDice
  1177.                     theDice = Int((6 * Rnd) + 1)
  1178.                     strRolled = strRolled & theDice & " "
  1179.                 Next
  1180.                 'AddChat &H99CC00, strRolled
  1181.                 Command.Respond strRolled
  1182.             Else
  1183.                 'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1184.                 Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1185.             End If
  1186.         Else
  1187.             'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1188.             Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1189.         End If
  1190.                
  1191.     End If
  1192.    
  1193. End Sub
  1194.  
  1195. Function NumLines(strFile) 'Count words in a specific dictionary
  1196.  
  1197.     Dim objFile, strLine
  1198.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1199.     Set objFile= objFSO.OpenTextFile(strFile, 1)
  1200.    
  1201.     Do While Not objFile.AtEndOfStream
  1202.         strLine = objFile.readline 'Read line
  1203.         If strLine <> "" Then
  1204.             intNumLines = intNumLines + 1 'Count lines
  1205.         End If
  1206.     Loop
  1207.    
  1208.     objFile.Close 'Close file
  1209.     NumLines = intNumLines 'Exit function with number of lines in file
  1210.  
  1211. End Function
  1212.  
  1213. Public Sub SafeAddUser(strUsername, strAccess, strSafe, blnSendChat)
  1214.  
  1215.     dbTimer.Enabled = False
  1216.  
  1217.     Dim objReadFile, objWriteFile, strLine
  1218.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1219.     Set objReadFile= objFSO.OpenTextFile(users_list, 1)
  1220.  
  1221.     Do While Not objReadFile.AtEndOfStream
  1222.    
  1223.         intFilePos = Int(intFilePos) + 1
  1224.         intNumLines = NumLines(users_list)
  1225.         strLine = objReadFile.readline 'Read line
  1226.        
  1227.         If strLine <> "" Then
  1228.             strFile = strFile & strLine
  1229.             If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1230.         End If
  1231.            
  1232.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1233.             strSplit = Split(strLine, " ")
  1234.             strUser = strSplit(0)
  1235.            
  1236.             If LCase(strUser) = LCase(strUsername) Then
  1237.                 intSetFilePos = Int(intFilePos)
  1238.                 Exit Do
  1239.             End If
  1240.            
  1241.         End If
  1242.        
  1243.     Loop
  1244.  
  1245.     If intSetFilePos = "" Then
  1246.         intSetFilePos = NumLines(users_list) + 1
  1247.     End If
  1248.        
  1249.     objReadFile.Close 'Close file
  1250.  
  1251.     Set objWriteFile= objFSO.OpenTextFile(users_list, 2)
  1252.     strSplit = Split(strFile, vbcrlf)
  1253.  
  1254.     blnFound = False
  1255.    
  1256.     For x = LBound(strSplit) To UBound(strSplit)
  1257.         intCount = x + 1
  1258.         If intCount = intSetFilePos Then
  1259.            
  1260.             blnFound = True
  1261.             strNow = Now
  1262.             strDay = Day(strNow) : If Len(strDay) = 1 Then : strDay = "0" & strDay : End If
  1263.             strMonth = Month(strNow) : If Len(strMonth) = 1 Then : strMonth = "0" & strMonth : End If
  1264.             strYear = Year(strNow)
  1265.             strHour = Hour(strNow) : If Len(strHour) = 1 Then : strHour = "0" & strHour : End If
  1266.             strMinute = Minute(strNow) : If Len(strMinute) = 1 Then : strMinute = "0" & strMinute : End If
  1267.             strSecond = Second(strNow) : If Len(strSecond) = 1 Then : strSecond = "0" & strSecond : End If
  1268.            
  1269.             strTimeStamp = strMonth & "-" & strDay & "-" & strYear & "_" & strHour & ":" & strMinute & ":" & strSecond
  1270.                    
  1271.             strWrite = strUsername & " " & strAccess & " " & strSafe & " <console> " & strTimeStamp & " <console> "  & strTimeStamp & " USER % %"
  1272.             objWriteFile.WriteLine(strWrite)
  1273.  
  1274.             'Username 1 S <console> mm-dd-yyyy_hh:mm:ss <console> mm-dd-yyyy_hh:mm:ss USER % %
  1275.            
  1276.         Else
  1277.             objWriteFile.WriteLine(strSplit(x))
  1278.         End If
  1279.     Next
  1280.    
  1281.     If blnFound = False Then
  1282.  
  1283.         strNow = Now
  1284.         strDay = Day(strNow) : If Len(strDay) = 1 Then : strDay = "0" & strDay : End If
  1285.         strMonth = Month(strNow) : If Len(strMonth) = 1 Then : strMonth = "0" & strMonth : End If
  1286.         strYear = Year(strNow)
  1287.         strHour = Hour(strNow) : If Len(strHour) = 1 Then : strHour = "0" & strHour : End If
  1288.         strMinute = Minute(strNow) : If Len(strMinute) = 1 Then : strMinute = "0" & strMinute : End If
  1289.         strSecond = Second(strNow) : If Len(strSecond) = 1 Then : strSecond = "0" & strSecond : End If
  1290.        
  1291.         strTimeStamp = strMonth & "-" & strDay & "-" & strYear & "_" & strHour & ":" & strMinute & ":" & strSecond
  1292.                
  1293.         strWrite = strUsername & " " & strAccess & " " & strSafe & " <console> " & strTimeStamp & " <console> "  & strTimeStamp & " USER % %"
  1294.         objWriteFile.WriteLine(strWrite)
  1295.     End If
  1296.  
  1297.     objWriteFile.Close 'Close file
  1298.     oldCRC = GetFileCRC32(users_list)
  1299.     newCRC = oldCRC
  1300.     ReloadSettings 1
  1301.     dbTimer.Enabled = True
  1302.    
  1303. End Sub
  1304.  
  1305. Public Sub RemUser(strUsername)
  1306.  
  1307.     dbTimer.Enabled = False
  1308.  
  1309.     Dim objReadFile, objWriteFile, strLine
  1310.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1311.     Set objReadFile= objFSO.OpenTextFile(users_list, 1)
  1312.  
  1313.     Do While Not objReadFile.AtEndOfStream
  1314.    
  1315.         intFilePos = intFilePos + 1
  1316.         intNumLines = NumLines(users_list)
  1317.         strLine = objReadFile.readline 'Read line
  1318.                
  1319.         If strLine <> "" Then
  1320.             strFile = strFile & strLine
  1321.             If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1322.         End If
  1323.        
  1324.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1325.             strSplit = Split(strLine, " ")
  1326.             strUser = strSplit(0)
  1327.  
  1328.             If LCase(strUser) = LCase(strUsername) Then
  1329.                 blnNextRank = True
  1330.             ElseIf LCase(strUser) <> LCase(strUsername) And blnNextRank = True Then
  1331.                 intSetFilePos = intFilePos - 1
  1332.                 blnNextRank = False
  1333.             End If
  1334.            
  1335.         End If
  1336.        
  1337.     Loop
  1338.  
  1339.     objReadFile.Close 'Close file
  1340.    
  1341.     If intSetFilePos = "" Then
  1342.         intSetFilePos = NumLines(users_list)
  1343.     End If
  1344.        
  1345.     Set objWriteFile= objFSO.OpenTextFile(users_list, 2)
  1346.     strSplit = Split(strFile, vbcrlf)
  1347.  
  1348.     blnFound = False
  1349.    
  1350.     For x = LBound(strSplit) To UBound(strSplit)
  1351.         intCount = x + 1
  1352.  
  1353.         If intCount = intSetFilePos Then   
  1354.    
  1355.         Else
  1356.             objWriteFile.WriteLine(strSplit(x))
  1357.         End If
  1358.     Next
  1359.  
  1360.     objWriteFile.Close 'Close file
  1361.    
  1362. End Sub
  1363.  
  1364. Public Function InfoUser(strUsername, blnReturnVal)
  1365.  
  1366.     Dim objReadFile, objWriteFile, strLine
  1367.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1368.     Set objReadFile= objFSO.OpenTextFile(users_list, 1)
  1369.  
  1370.     intNumLines = NumLines(users_list)
  1371.     blnFoundUser = False
  1372.    
  1373.     Do While Not objReadFile.AtEndOfStream
  1374.    
  1375.         intFilePos = intFilePos + 1
  1376.         strLine = objReadFile.readline 'Read line
  1377.                
  1378.         If strLine <> "" Then
  1379.             strFile = strFile & strLine
  1380.             If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1381.         End If
  1382.            
  1383.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1384.        
  1385.             strSplit = Split(strLine, " ")
  1386.             strUser = strSplit(0)
  1387.             strAccess = strSplit(1)
  1388.             strSafe = strSplit(2)
  1389.  
  1390.             If LCase(strUser) = LCase(strUsername) Then
  1391.                            
  1392.                 blnFoundUser = True
  1393.                
  1394.                 strRank = GetRank(strUser)
  1395.                            
  1396.                 If blnReturnVal = True Then
  1397.                     InfoUser = strUser & " " & strAccess & " " & strSafe & " " & strRank
  1398.                     Exit Do
  1399.                 End If 
  1400.            
  1401.             End If
  1402.            
  1403.         End If
  1404.        
  1405.     Loop
  1406.                
  1407.     objReadFile.Close 'Close file
  1408.                
  1409. End Function
  1410.  
  1411. Public Function GetCmdAccess(strCommand)
  1412.  
  1413.     Dim objReadFile, strLine
  1414.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1415.     Set objReadFile= objFSO.OpenTextFile(BotPath() & "commands.xml", 1)
  1416.  
  1417.     Do While Not objReadFile.AtEndOfStream
  1418.    
  1419.         strLine = objReadFile.readline 'Read line
  1420.                
  1421.         If strLine <> "" Then
  1422.             strLine = Replace(strLine, " ", "")
  1423.            
  1424.             blnNotGot = True
  1425.            
  1426.             If(Left(strLine,14+Len(strCommand)) = "<commandname=""" & strCommand) Then
  1427.                    
  1428.                 Do Until Left(strLine,6) = "<rank>" And blnNotGot = True
  1429.                     strLine = objReadFile.readline 'Read line
  1430.                     strLine = Replace(strLine, " ", "")
  1431.                 Loop
  1432.                        
  1433.                 strLine = Replace(strLine, "</rank>", "")
  1434.                 strLine = Replace(strLine, "<rank>", "")
  1435.                 strRank = strLine
  1436.                
  1437.                 Do Until Left(strLine,6) = "<rank>" Or Left(strLine,10) = "</command>"
  1438.                     strLine = objReadFile.readline 'Read line
  1439.                     strLine = Replace(strLine, " ", "")
  1440.                 Loop
  1441.                
  1442.                 If Left(strLine,10) = "</command>" Then blnNotGot = False : Exit Do
  1443.                 If Left(strLine,6) = "<rank>" Then
  1444.  
  1445.                     strLine = Replace(strLine, "</rank>", "")
  1446.                     strLine = Replace(strLine, "<rank>", "")
  1447.                     strRank = strLine
  1448.                
  1449.                 End If
  1450.                
  1451.             End If
  1452.            
  1453.         End If
  1454.    
  1455.     Loop
  1456.    
  1457.     objReadFile.Close 'Close file
  1458.     GetCmdAccess = strRank
  1459.    
  1460. End Function
  1461.  
  1462. Public Sub ResetCommands()
  1463.  
  1464.     Dim objReadFile, objWriteFile, strLine
  1465.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1466.    
  1467.     If objFSO.FileExists(cmds_list) Then
  1468.    
  1469.         Set objReadFile= objFSO.OpenTextFile(cmds_list, 1)
  1470.  
  1471.         Do While Not objReadFile.AtEndOfStream
  1472.  
  1473.             intFilePos = intFilePos + 1
  1474.             intNumLines = NumLines(cmds_list)
  1475.             strLine = objReadFile.readline 'Read line
  1476.                    
  1477.             If strLine <> "" Then
  1478.                 strFile = strFile & strLine
  1479.                 If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1480.             End If
  1481.            
  1482.         Loop
  1483.        
  1484.         objReadFile.Close
  1485.        
  1486.         Set objWriteFile= objFSO.OpenTextFile(BotPath & "commands.xml", 2)
  1487.         strSplit = Split(strFile, vbcrlf)
  1488.        
  1489.         For x = LBound(strSplit) To UBound(strSplit)
  1490.             objWriteFile.WriteLine(strSplit(x))
  1491.         Next
  1492.        
  1493.         objWriteFile.Close
  1494.        
  1495.         ReloadSettings 1
  1496.         AddChat &H99CC00, "[INFO] All bot commands reset - Clan Management Script"
  1497.         AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "commands.xml file created."
  1498.         AddChat vbRed, "[INFO] If you are using CAPIDAPTOR and an APIKEY, you MUST reconnect this bot to Battle.net or local commands WILL NOT WORK! Try using my other StealthBot script called CAPIDAPTOR.", vbWhite, " Usage( /autobot ) if installed."
  1499.  
  1500.     End If
  1501.  
  1502. End Sub
  1503.  
  1504. Public Sub KickUser(strUsername)
  1505.     Call Command(BotVars.Username,"/kick " & strUsername,True)
  1506. End Sub
  1507.  
  1508. Public Sub BanUser(strUsername)
  1509.     Call Command(BotVars.Username,"/ban " & strUsername,True)
  1510. End Sub
  1511.  
  1512. Public Sub UnBanUser(strUsername)
  1513.     Call Command(BotVars.Username,"/unban " & strUsername,True)
  1514. End Sub
  1515.  
  1516. Function PromoteCMember(strMember)
  1517.    
  1518.     strRankIndex = GetRankIndex(strMember)
  1519.     For x = LBound(clanranks) To UBound(clanranks)
  1520.         If x = strRankIndex - 1 Then
  1521.             If x <> LBound(clanranks) Then
  1522.                 DelCMember(strMember)
  1523.                 Call AddCMember(strMember, clanranks(x-1))
  1524.                 Exit For
  1525.             End If
  1526.         End If
  1527.     Next
  1528.    
  1529. End Function
  1530.  
  1531. Function DemoteCMember(strMember)
  1532.  
  1533.     strRankIndex = GetRankIndex(strMember)
  1534.     For x = LBound(clanranks) To UBound(clanranks)
  1535.         If x = strRankIndex - 1 Then
  1536.             If x <> UBound(clanranks) Then
  1537.                 DelCMember(strMember)
  1538.                 Call AddCMember(strMember, clanranks(x+1))
  1539.                 Exit For
  1540.             End If
  1541.         End If
  1542.     Next
  1543.  
  1544. End Function
  1545.  
  1546. Function AddCMember(strUser, strSetRank)
  1547.  
  1548.     Dim objReadFile, objWriteFile, strLine
  1549.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1550.  
  1551.     For x = LBound(clanranks) To UBound(clanranks)
  1552.         If LCase(strSetRank) = LCase(clanranks(x)) Then
  1553.             strSetRank = clanranks(x)
  1554.             Exit For
  1555.         End If
  1556.     Next
  1557.  
  1558.     blnFoundPos = False
  1559.    
  1560.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  1561.     Do While Not objReadFile.AtEndOfStream
  1562.        
  1563.         intFilePos = intFilePos + 1
  1564.         intNumLines = NumLines(members_list)
  1565.         strLine = objReadFile.readline 'Read line
  1566.                
  1567.         If strLine <> "" Then
  1568.             strFile = strFile & strLine
  1569.             If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1570.         End If
  1571.  
  1572.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1573.             strSplit = Split(strLine, " ")
  1574.             strRank = Replace(strSplit(0),":","")
  1575.             strMember = strSplit(1) 'infile
  1576.            
  1577.             intRank = GetRankIndex(strMember) 'infile
  1578.             intSetRank = GetIndexOfRank(strSetRank) 'toset
  1579.            
  1580.             If intSetRank > intRank Then
  1581.                 intSetFilePos = intFilePos
  1582.             End If
  1583.            
  1584.         End If
  1585.        
  1586.     Loop
  1587.    
  1588.     objReadFile.Close 'Close file
  1589.  
  1590.     If intSetFilePos = "" Then
  1591.         intSetFilePos = NumLines(members_list) + 1
  1592.     End If
  1593.  
  1594.     strSplit = Split(strFile, vbcrlf)
  1595.  
  1596.     blnFound = False
  1597.    
  1598.     Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  1599.     For x = LBound(strSplit) To UBound(strSplit)
  1600.        
  1601.         intCount = x + 1
  1602.         If intCount = intSetFilePos Then
  1603.             blnFound = True 'new
  1604.             objWriteFile.WriteLine(strSplit(x))
  1605.             objWriteFile.WriteLine(strSetRank & ": " & strUser)
  1606.         Else
  1607.             objWriteFile.WriteLine(strSplit(x))
  1608.         End If 
  1609.     Next
  1610.  
  1611.     If blnFound = False Then
  1612.  
  1613.         objWriteFile.WriteLine(strSetRank & ": " & strUser)
  1614.    
  1615.     End If
  1616.    
  1617.    
  1618.     objWriteFile.Close 'Close file     
  1619.    
  1620. End Function
  1621.  
  1622. Function DelCMember(strMember)
  1623.    
  1624.     Dim objReadFile, objWriteFile, strLine
  1625.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1626.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  1627.    
  1628.     blnWriteFile = False
  1629.     Do While Not objReadFile.AtEndOfStream
  1630.         strLine = objReadFile.readline 'Read line
  1631.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1632.             strSplit = Split(strLine, " ")
  1633.             If LCase(strSplit(1)) <> LCase(strMember) Then
  1634.                 strFile = strFile & strLine & vbcrlf
  1635.             End If
  1636.             blnWriteFile = True
  1637.         End If
  1638.     Loop
  1639.    
  1640.     If blnWriteFile = True Then
  1641.         objReadFile.Close 'Close file
  1642.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  1643.         strSplit = Split(strFile, vbcrlf)
  1644.         For x = LBound(strSplit) To UBound(strSplit)
  1645.             If strSplit(x) <> "" Then
  1646.                 objWriteFile.WriteLine(strSplit(x))
  1647.             End If
  1648.         Next
  1649.         DelCMember = True
  1650.     End If
  1651.    
  1652. End Function
  1653.  
  1654. Function RemRankPos(strRank)
  1655.  
  1656.     Dim objReadFile, objWriteFile, strLine
  1657.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1658.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  1659.    
  1660.     blnWriteFile = False
  1661.     Do While Not objReadFile.AtEndOfStream
  1662.         strLine = objReadFile.readline 'Read line
  1663.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1664.             strSplit = Split(strLine, " ")
  1665.             strRankFind = Left(strSplit(0),Len(strSplit(0))-1)
  1666.             strUser = strSplit(1)
  1667.             If LCase(strRankFind) = LCase(strRank) And LCase(strUser) = LCase("(OPEN)") And blnWriteFile = False Then
  1668.                 'Do Nothing
  1669.                 blnWriteFile = True
  1670.             Else
  1671.                 strFile = strFile & strLine & vbcrlf
  1672.             End If
  1673.         End If
  1674.     Loop
  1675.    
  1676.     If blnWriteFile = True Then
  1677.         objReadFile.Close 'Close file
  1678.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  1679.         strSplit = Split(strFile, vbcrlf)
  1680.         For x = LBound(strSplit) To UBound(strSplit)
  1681.             If strSplit(x) <> "" Then
  1682.                 objWriteFile.WriteLine(strSplit(x))
  1683.             End If
  1684.         Next
  1685.         RemRankPos = True
  1686.     End If
  1687.  
  1688. End Function
  1689.  
  1690. Function FindRank(strRank)
  1691.  
  1692.     For x = LBound(clanranks) To UBound(clanranks)
  1693.         If LCase(strRank) = LCase(clanranks(x)) Then
  1694.             FindRank = clanranks(x)
  1695.             Exit For
  1696.         End If
  1697.     Next
  1698.    
  1699. End Function
  1700.  
  1701. Function GetTopRankUser()
  1702.  
  1703.     Dim objFile, strLine
  1704.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1705.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1706.  
  1707.     Do While Not objFile.AtEndOfStream
  1708.         strLine = objFile.readline 'Read line
  1709.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1710.             strSplit = Split(strLine," ")
  1711.             strRank = Left(strSplit(0),Len(strSplit(0))-1)
  1712.             If Lcase(strRank) = Lcase(clanranks(0)) Then
  1713.                 GetTopRankUser = strSplit(1)
  1714.                 Exit Function
  1715.             End If
  1716.         End If
  1717.     Loop
  1718.    
  1719. End Function
  1720.  
  1721. Function GetIndexOfRank(strRank)
  1722.  
  1723.     For x = LBound(clanranks) To UBound(clanranks)
  1724.         If LCase(strRank) = LCase(clanranks(x)) Then
  1725.             GetIndexOfRank = x + 1
  1726.             Exit For
  1727.         End If
  1728.     Next
  1729.  
  1730. End Function
  1731.  
  1732. Function GetRankIndex(strMember)
  1733.  
  1734.     Dim objFile, strLine
  1735.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1736.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1737.  
  1738.     Do While Not objFile.AtEndOfStream
  1739.         strLine = objFile.readline 'Read line
  1740.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1741.             strSplit = Split(strLine," ")
  1742.             If Lcase(strSplit(1)) = Lcase(strMember) Then
  1743.                 strRankName = Left(strSplit(0),Len(strSplit(0))-1)
  1744.                 Exit Do
  1745.             End If
  1746.         End If
  1747.     Loop   
  1748.     objFile.Close 'Close file
  1749.    
  1750.     For x = LBound(clanranks) To UBound(clanranks)
  1751.         If LCase(strRankName) = LCase(clanranks(x)) Then
  1752.             If strRankName = clanranks(x) Then
  1753.                 GetRankIndex = x + 1
  1754.                 Exit For
  1755.             End If
  1756.         End If
  1757.     Next   
  1758.    
  1759. End Function
  1760.    
  1761. Function GetRank(strMember)
  1762.  
  1763.     Dim objFile, strLine
  1764.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1765.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1766.    
  1767.     Do While Not objFile.AtEndOfStream
  1768.         strLine = objFile.readline 'Read line
  1769.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1770.             strSplit = Split(strLine," ")
  1771.             If Lcase(strSplit(1)) = Lcase(strMember) Then
  1772.                 GetRank = Left(strSplit(0),Len(strSplit(0))-1)
  1773.                 Exit Do
  1774.             End If
  1775.         End If
  1776.     Loop
  1777.    
  1778.     objFile.Close 'Close file
  1779.    
  1780. End Function
  1781.  
  1782. Function GetRankNum()
  1783.  
  1784.     For x = LBound(clanranks) To UBound(clanranks)
  1785.         strMessage = strMessage & clanranks(x) & ", "
  1786.     Next
  1787.  
  1788. End Function
  1789.  
  1790. Function NumMembers() 'Count words in a specific dictionary
  1791.  
  1792.     Dim objFile, strLine
  1793.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1794.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1795.    
  1796.     strOpenPos = ""
  1797.     intOpenPos = 0
  1798.     intNumLines = 0
  1799.    
  1800.     Do While Not objFile.AtEndOfStream
  1801.         strLine = objFile.readline 'Read line
  1802.         If strLine <> "" Then
  1803.             If LCase(Right(strLine, 6)) <> LCase("(OPEN)") Then
  1804.                 intNumLines = intNumLines + 1 'Count lines
  1805.             Else
  1806.                 intOpenPos = intOpenPos + 1
  1807.                 strSplit = Split(strLine," ")
  1808.                 strOpenPos = strOpenPos & Left(strSplit(0),Len(strSplit(0))-1) & ", "
  1809.             End If
  1810.         End If
  1811.     Loop
  1812.    
  1813.     objFile.Close 'Close file
  1814.     NumMembers = intNumLines 'Exit function with number of lines in file
  1815.  
  1816. End Function
  1817.  
  1818. Function ListMembers() 'Fetch a word from a specific dictionary
  1819.  
  1820.     Dim objFile, strLine
  1821.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1822.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1823.    
  1824.     intNumLines = 0
  1825.     Do While Not objFile.AtEndOfStream
  1826.         strLine = objFile.readline 'Read line
  1827.         If strLine <> "" Then
  1828.             intNumLines = intNumLines + 1
  1829.             strMembers = strMembers & "[" & intNumLines & "] " & strLine & vbcrlf
  1830.         End If
  1831.     Loop
  1832.    
  1833.     objFile.Close 'Close file
  1834.     ListMembers = strMembers 'Exit function with Members
  1835.    
  1836. End Function
  1837.  
  1838. Function FormatTag()
  1839.     intWilds = 0
  1840.     For x = 1 To Len(clantag)
  1841.         If Mid(clantag,x,1) = "*" Then
  1842.             intWilds = intWilds + 1
  1843.             If intWilds > 1 Then
  1844.             Else
  1845.                 strTag = strTag & Mid(clantag,x,1)
  1846.             End If
  1847.         Else
  1848.             strTag = strTag & Mid(clantag,x,1)
  1849.         End If
  1850.     Next
  1851.     clantag = strTag
  1852. End Function
  1853.  
  1854. Function CheckTag(strUser)
  1855.    
  1856.     CheckTag = 0
  1857.     If InStr(1, clantag, "*") > 0 Then
  1858.  
  1859.         strSplitTag = Split(clantag,"*")
  1860.         intLeft = Len(strSplitTag(0))
  1861.         intRight = Len(strSplitTag(1))
  1862.         blnLeft = False : blnRight = False
  1863.         For x = 1 To Len(strUser)
  1864.             strFind = Mid(strUser,x,intLeft)
  1865.             If LCase(strFind) = LCase(strSplitTag(0)) Then blnLeft = True
  1866.             strFind = Mid(strUser,x,intRight)
  1867.             If LCase(strFind) = LCase(strSplitTag(1)) Then blnRight = True
  1868.         Next
  1869.        
  1870.         strLeftTag = Left(strUser,Len(strSplitTag(0)))
  1871.         lenLeftTag = Len(strLeftTag)
  1872.         strRightTag = Right(strUser,Len(strSplitTag(1)))
  1873.         lenRightTag = Len(strRightTag)
  1874.         strMember = Right(strUser, Len(strUser) - lenLeftTag)
  1875.         strMember = Left(strMember, Len(strMember) - lenRightTag)
  1876.        
  1877.         If Left(clantag,1)  = "*" Then
  1878.             strRestricted = Mid(clantag,2,1)
  1879.             If Right(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
  1880.         ElseIf Right(clantag,1)  = "*" Then
  1881.             strRestricted = Mid(clantag,Len(clantag)-1,1)
  1882.             If Left(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
  1883.         Else
  1884.             strRestricted1 = Right(strLeftTag,1)
  1885.             strRestricted2 = Left(strRightTag,1)
  1886.             If Left(strMember,1) = strRestricted1 Then CheckTag = 2 : Exit Function
  1887.             If Right(strMember,1) = strRestricted2 Then CheckTag = 2 : Exit Function
  1888.         End If
  1889.                
  1890.         If strMember <> Replace(clantag, "*", "") Then
  1891.             strMember = strSplitTag(0) & strMember & strSplitTag(1)
  1892.         Else
  1893.             CheckTag = 2 : Exit Function
  1894.         End If
  1895.        
  1896.         If LCase(strUser) = LCase(strMember) And blnLeft = True And blnRight = True Then CheckTag = 1
  1897.  
  1898.     End If
  1899.    
  1900. End Function
  1901.  
  1902. Public Function GetFileCRC32(FilePath)
  1903.  
  1904.     On Error Resume Next
  1905.  
  1906.     Dim oFSO: Set oFSO = CreateObject("Scripting.FileSystemObject")
  1907.     Dim oFile: Set oFile = oFSO.GetFile(FilePath)
  1908.    
  1909.     With oFile.OpenAsTextStream()
  1910.         Data = .Read(oFile.Size)
  1911.         .Close
  1912.     End With
  1913.  
  1914.     GetFileCRC32 = CRC32(Data)
  1915.    
  1916. End Function
  1917.  
  1918. Public Sub updateMembersList()
  1919.  
  1920.     dbTimer.Enabled = False
  1921.  
  1922.     Dim objFile, strLine
  1923.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1924.    
  1925.     Set objFile= objFSO.OpenTextFile(users_list, 1)
  1926.     Do While Not objFile.AtEndOfStream
  1927.         strLine = objFile.readline 'Read line
  1928.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1929.             strSplit = Split(strLine," ")
  1930.             strUserFile = strUserFile & " " & strSplit(0)
  1931.         End If
  1932.     Loop
  1933.     objFile.Close 'Close file
  1934.  
  1935.     strSplit = Split(strUserFile, " ")
  1936.    
  1937.     For x = LBound(strSplit) To UBound(strSplit)
  1938.         strUser = strSplit(x)
  1939.         strRankOfUser = GetRank(strUser)
  1940.         If strUser <> "" And strRankOfUser = "" Then
  1941.             AddChat &H99CC00, "[INFO] A user appears to be added to bot using - User Database Manager - removing user."
  1942.             AddChat &H99CC00, "[INFO] Please use bot commands to add / remove users. i.e add, del, safeadd, safedel"
  1943.             AddQ "[INFO] A user appears to be added to bot using - User Database Manager - removing user."
  1944.             AddQ "[INFO] Please use bot commands to add / remove users. i.e add, del, safeadd, safedel"
  1945.             Call RemUser(strUser)
  1946.             Call DelCMember(strUser)
  1947.         End If
  1948.     Next
  1949.  
  1950.     oldCRC = GetFileCRC32(users_list)
  1951.     newCRC = oldCRC
  1952.     ReloadSettings 1
  1953.     dbTimer.Enabled = True
  1954.        
  1955. End Sub
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×