Guest User

Clan Management Script

a guest
Dec 10th, 2020
31
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 LCase(Username) = LCase("[b]" & strChannelBotName) Then strCommandUsername = Username
  306.        
  307.     If InStr(1, strCommand, " ", vbTextCompare) = 0 Then '0 or 1 arg
  308.         strKick = strCommand
  309.         strInfo = InfoUser(strUser, True)
  310.         strAccess = GetCmdAccess(LCase(strCommand))
  311.     Else
  312.         strSplit = Split(strCommand, " ") '2 or more args
  313.         strCommand = strSplit(0)
  314.         strKick = strSplit(1)
  315.         strArg = strSplit(1)
  316.         strInfo = InfoUser(strUser, True)
  317.         strAccess = GetCmdAccess(LCase(strCommand))
  318.     End If
  319.  
  320.     If LCase(strCommand) = "list" Then
  321.  
  322.         If strUser <> "" And strInfo <> "" Then
  323.             strSplit = Split(strInfo, " ") '2 or more args
  324.             strUserAccess = strSplit(1)
  325.             strReqAccess = strAccess
  326.            
  327.             If Int(strUserAccess) >= Int(strAccess) And strArg = "" Then
  328.                 'AddChat &H99CC00, "[ERROR] You must supply a numerical bot access level to view all of the available commands."
  329.                 AddQ "[ERROR] You must supply a numerical bot access level to view all of the available commands."
  330.                 Exit Sub
  331.             End If
  332.            
  333.         End If
  334.    
  335.     End If
  336.    
  337.     If LCase(strCommand) = "kick" Then
  338.    
  339.         isMember = GetRank(Username) : If isMember = "" Then Exit Sub
  340.    
  341.         If strUser <> "" And strInfo <> "" Then
  342.        
  343.             strSplit = Split(strInfo, " ") '2 or more args
  344.             strUserAccess = strSplit(1)
  345.            
  346.             strInfo = InfoUser(strKick, True)
  347.             If strInfo <> "" Then
  348.            
  349.                 strSplit = Split(strInfo, " ") '2 or more args
  350.                 strKickUser = strSplit(0)
  351.                 strKickSafe = strSplit(2)
  352.                
  353.                 intRank = GetRankIndex(strUser)
  354.                 intSupRank = GetRankIndex(strKickUser)
  355.                
  356.                 If Int(strUserAccess) >= Int(strAccess) And intRank < intSupRank And strKickSafe <> "S" Then
  357.                     KickUser(strKickUser)
  358.                     Exit Sub
  359.                 ElseIf Int(strUserAccess) > 0 And strKickSafe = "S" Then
  360.                     'AddChat &H99CC00,"[ERROR] That user is safelisted."
  361.                     AddQ "[ERROR] That user is safelisted."
  362.                     Exit Sub
  363.                 ElseIf Int(strUserAccess) < Int(strAccess) Then
  364.                     'AddChat &H99CC00,"[ERROR] You do not have sufficient access to do that."
  365.                     AddQ "[ERROR] You do not have sufficient access to do that."
  366.                     Exit Sub
  367.                 ElseIf intRank >= intSupRank Then
  368.                     'AddChat &H99CC00,"[ERROR] Cannot kick " & strKickUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
  369.                     AddQ "[ERROR] Cannot kick " & strKickUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
  370.                     Exit Sub
  371.                 End If
  372.            
  373.             ElseIf Int(strUserAccess) >= Int(strAccess) And strInfo = "" Then
  374.                 KickUser(strKick)
  375.                 Exit Sub
  376.             End If
  377.            
  378.         End If
  379.        
  380.     End If
  381.  
  382.     If LCase(strCommand) = "ban" Then
  383.    
  384.         isMember = GetRank(Username) : If isMember = "" Then Exit Sub
  385.    
  386.         If strUser <> "" And strInfo <> "" Then
  387.        
  388.             strSplit = Split(strInfo, " ") '2 or more args
  389.             strUserAccess = strSplit(1)
  390.            
  391.             strInfo = InfoUser(strKick, True)
  392.             If strInfo <> "" Then
  393.            
  394.                 strSplit = Split(strInfo, " ") '2 or more args
  395.                 strBanUser = strSplit(0)
  396.                 strBanSafe = strSplit(2)
  397.                
  398.                 intRank = GetRankIndex(strUser)
  399.                 intSupRank = GetRankIndex(strBanUser)
  400.                
  401.                 If Int(strUserAccess) >= Int(strAccess) And intRank < intSupRank And strBanSafe <> "S" Then
  402.                     BanUser(strBanUser)
  403.                     Exit Sub
  404.                 ElseIf Int(strUserAccess) > 0 And strBanSafe = "S" Then
  405.                     'AddChat &H99CC00,"[ERROR] That user is safelisted."
  406.                     AddQ "[ERROR] That user is safelisted."
  407.                     Exit Sub
  408.                 ElseIf Int(strUserAccess) < Int(strAccess) Then
  409.                     'AddChat &H99CC00,"[ERROR] You do not have sufficient access to do that."
  410.                     AddQ "[ERROR] You do not have sufficient access to do that."
  411.                     Exit Sub
  412.                 ElseIf intRank >= intSupRank Then
  413.                     'AddChat &H99CC00,"[ERROR] Cannot ban " & strBanUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
  414.                     AddQ "[ERROR] Cannot ban " & strBanUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
  415.                     Exit Sub
  416.                 End If
  417.            
  418.             ElseIf Int(strUserAccess) >= Int(strAccess) And strInfo = "" Then
  419.            
  420.                 BanUser(strKick)
  421.                 Exit Sub
  422.            
  423.             End If
  424.            
  425.         End If
  426.        
  427.     End If
  428.        
  429.     If LCase(strCommand) = "unban" Then
  430.        
  431.         isMember = GetRank(Username) : If isMember = "" Then Exit Sub
  432.        
  433.         strInfo = InfoUser(strUser, True)
  434.         If strUser <> "" And strInfo <> "" Then
  435.        
  436.             strSplit = Split(strInfo, " ") '2 or more args
  437.             strUserAccess = strSplit(1)
  438.  
  439.             If Int(strUserAccess) >= Int(strAccess) Then
  440.                 UnBanUser(strKick)
  441.                 Exit Sub
  442.             ElseIf Int(strUserAccess) < Int(strAccess) Then
  443.                 'AddChat &H99CC00,"[ERROR] You do not have sufficient access to do that."
  444.                 AddQ "[ERROR] You do not have sufficient access to do that."
  445.                 Exit Sub
  446.             End If 
  447.            
  448.         End If
  449.        
  450.     End If 
  451.    
  452. End Sub
  453.  
  454. Public Sub Event_Command(Command)
  455.  
  456.     FormatTag()
  457.    
  458.     If LCase(Command.Username) = LCase("[b]" & strChannelBotName) Then strCommandUsername = Command.Username
  459.    
  460.     If LCase(Command.Name) = "about" Then
  461.    
  462.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  463.             'AddChat &H99CC00,".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  464.             Command.Respond ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  465.             'AddQ ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  466.             Exit Sub
  467.         Else
  468.             'AddChat &H99CC00,".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  469.             Command.Respond ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  470.             'AddQ ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  471.             Exit Sub
  472.         End If
  473.  
  474.     End If
  475.    
  476.     If LCase(Command.Name) = "whoami" Then
  477.  
  478.         strInfo = InfoUser(Command.Username, True)
  479.        
  480.         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
  481.             'AddChat &H99CC00, ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  482.             Command.Respond ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
  483.             Exit Sub
  484.         ElseIf strInfo = "" Then
  485.             'AddChat &H99CC00, "[ERROR] No such user(s) found."
  486.             Command.Respond "[ERROR] No such user(s) found."
  487.             Exit Sub
  488.         Else
  489.             strSplit = Split(strInfo, " ") '2 or more args
  490.             If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  491.             If strSplit(2) = "S" Then : strSafe = "safelisted" : Else : strSafe = "not safelisted" : End If
  492.             'AddChat &H99CC00, "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
  493.             Command.Respond "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
  494.             Exit Sub
  495.         End If
  496.        
  497.     End If
  498.  
  499.     If LCase(Command.Name) = "whois" Then
  500.    
  501.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  502.             strUser = Command.Args
  503.         Else
  504.             strSplit = Split(Command.Args, " ") '2 or more args
  505.             strUser = strSplit(0)
  506.         End If
  507.        
  508.         If strUser <> "" Then
  509.        
  510.             strInfo = InfoUser(strUser, True)
  511.             If strInfo = "" Then
  512.                 'AddChat &H99CC00, "[ERROR] No such user(s) found."
  513.                 Command.Respond "[ERROR] No such user(s) found."
  514.                 Exit Sub
  515.             Else
  516.                 strSplit = Split(strInfo, " ") '2 or more args
  517.                 If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  518.                 If strSplit(2) = "S" Then : strSafe = "safelisted" : Else : strSafe = "not safelisted" : End If
  519.                 'AddChat &H99CC00, "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
  520.                 Command.Respond "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
  521.                 Exit Sub
  522.             End If
  523.            
  524.         End If
  525.        
  526.     End If
  527.  
  528.     If LCase(Command.Name) = "safeadd" Then
  529.  
  530.         dbTimer.Enabled = False
  531.        
  532.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  533.             strUser = Command.Username
  534.             strUsername = Command.Args
  535.             strInfo = InfoUser(strUsername, True)
  536.         Else
  537.             strUser = Command.Username
  538.             strSplit = Split(Command.Args, " ") '2 or more args
  539.             strUsername = strSplit(0)
  540.             strInfo = InfoUser(strUsername, True)
  541.         End If
  542.  
  543.         strSplit = Split(strInfo, " ") '2 or more args
  544.         If UBound(strSplit) > 2 Then
  545.             If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  546.         Else
  547.             strRank = "Username"
  548.         End If
  549.        
  550.         If strInfo <> "" And strUsername <> "" Then
  551.             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
  552.                 Call SafeAddUser(strUsername,strSplit(1),"S",False)
  553.                 'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  554.                 Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  555.                 oldCRC = GetFileCRC32(users_list)
  556.                 newCRC = oldCRC
  557.                 dbTimer.Enabled = True
  558.                 ReloadSettings 1
  559.                 Exit Sub
  560.             End If
  561.         ElseIf strInfo = "" And strUsername <> "" Then
  562.             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
  563.                 Call SafeAddUser(strUsername,"0","S",False)
  564.                 'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  565.                 Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  566.                 oldCRC = GetFileCRC32(users_list)
  567.                 newCRC = oldCRC
  568.                 dbTimer.Enabled = True
  569.                 ReloadSettings 1
  570.                 Exit Sub
  571.             End If
  572.         End If
  573.        
  574.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  575.    
  576.         If strInfo <> "" And strUsername <> "" Then
  577.             Call SafeAddUser(strUsername,strSplit(1),"S",False)
  578.             'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  579.             Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  580.             oldCRC = GetFileCRC32(users_list)
  581.             newCRC = oldCRC
  582.             dbTimer.Enabled = True
  583.             ReloadSettings 1
  584.             Exit Sub
  585.         ElseIf strInfo = "" And strUsername <> "" Then
  586.             Call SafeAddUser(strUsername,"0","S",False)
  587.             'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  588.             Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
  589.             oldCRC = GetFileCRC32(users_list)
  590.             newCRC = oldCRC
  591.             dbTimer.Enabled = True
  592.             ReloadSettings 1
  593.             Exit Sub
  594.         End If
  595.        
  596.     End If
  597.  
  598.     If LCase(Command.Name) = "safedel" Then
  599.    
  600.         dbTimer.Enabled = False
  601.  
  602.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  603.             strUser = Command.Username
  604.             strUsername = Command.Args
  605.             strInfo = InfoUser(strUsername, True)
  606.         Else
  607.             strUser = Command.Username
  608.             strSplit = Split(Command.Args, " ") '2 or more args
  609.             strUsername = strSplit(0)
  610.             strInfo = InfoUser(strUsername, True)
  611.         End If
  612.  
  613.         strSplit = Split(strInfo, " ") '2 or more args
  614.         If UBound(strSplit) > 2 Then
  615.             If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  616.         Else
  617.             strRank = "Username"
  618.         End If
  619.        
  620.         If strInfo <> "" And strUsername <> "" Then
  621.             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           
  622.                 Call SafeAddUser(strUsername,strSplit(1),"%",False)
  623.                 'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  624.                 Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  625.                 oldCRC = GetFileCRC32(users_list)
  626.                 newCRC = oldCRC
  627.                 dbTimer.Enabled = True
  628.                 ReloadSettings 1
  629.                 Exit Sub
  630.             End If
  631.         ElseIf strInfo = "" And strUsername <> "" Then
  632.             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
  633.                 Call SafeAddUser(strUsername,"0","%",False)
  634.                 'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  635.                 Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  636.                 oldCRC = GetFileCRC32(users_list)
  637.                 newCRC = oldCRC
  638.                 dbTimer.Enabled = True
  639.                 ReloadSettings 1
  640.                 Exit Sub
  641.             End If
  642.         End If
  643.  
  644.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  645.        
  646.         intRank = GetRankIndex(Command.Username)
  647.         intSupRank = GetRankIndex(strUsername)
  648.        
  649.         If intSupRank = "" Then intSupRank = intRank + 1
  650.        
  651.         If intRank < intSupRank And strInfo = "" And strUsername <> "" Then
  652.             Call SafeAddUser(strUsername,"0","%",False)
  653.             'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  654.             Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  655.             oldCRC = GetFileCRC32(users_list)
  656.             newCRC = oldCRC
  657.             dbTimer.Enabled = True
  658.             ReloadSettings 1
  659.             Exit Sub
  660.         ElseIf intRank < intSupRank And strInfo <> "" And strUsername <> "" Then       
  661.             Call SafeAddUser(strUsername,strSplit(1),"%",False)
  662.             'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  663.             Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
  664.             oldCRC = GetFileCRC32(users_list)
  665.             newCRC = oldCRC
  666.             dbTimer.Enabled = True
  667.             ReloadSettings 1
  668.             Exit Sub
  669.         ElseIf intRank >= intSupRank Then
  670.             'AddChat &H99CC00, "[ERROR] Cannot safedel " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist. " & strUser & " has a higher rank."
  671.             Command.Respond "[ERROR] Cannot safedel " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist. " & strUser & " has a higher rank."
  672.             Exit Sub
  673.         End If
  674.        
  675.     End If
  676.  
  677.    
  678.     If LCase(Command.Name) = "members" Then
  679.    
  680.         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
  681.            
  682.             intNumMembers = NumLines(members_list)
  683.             strMembers = Split(ListMembers(), vbcrlf)
  684.  
  685.             For x = 0 To intNumMembers - 1
  686.                 'AddChat &H99CC00, strMembers(x)
  687.                 Command.Respond strMembers(x)
  688.             Next
  689.            
  690.             Exit Sub
  691.            
  692.         End If
  693.        
  694.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  695.    
  696.         intNumMembers = NumLines(members_list)
  697.         strMembers = Split(ListMembers(), vbcrlf)
  698.  
  699.         For x = 0 To intNumMembers - 1
  700.             'AddQ &H99CC00, strMembers(x)
  701.             Command.Respond strMembers(x)
  702.         Next
  703.        
  704.     End If
  705.    
  706.     If LCase(Command.Name) = "info" Then
  707.    
  708.         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
  709.        
  710.             intNumMembers = NumMembers()
  711.             If intOpenPos > 0 Then
  712.                 strOpenPos = Left(strOpenPos,Len(strOpenPos)-2) & "."
  713.                 'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " open recruiting positions: " & strOpenPos
  714.                 Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " open recruiting positions: " & strOpenPos
  715.                 Exit Sub
  716.             Else
  717.                 'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
  718.                 Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
  719.                 Exit Sub
  720.             End If
  721.        
  722.         End If
  723.        
  724.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  725.    
  726.         intNumMembers = NumMembers()
  727.         If intOpenPos > 0 Then
  728.             strOpenPos = Left(strOpenPos,Len(strOpenPos)-2) & "."
  729.             'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " recruiting positions: " & strOpenPos
  730.             Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " recruiting positions: " & strOpenPos
  731.             Exit Sub
  732.         Else
  733.             'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
  734.             Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
  735.             Exit Sub
  736.         End If
  737.        
  738.     End If
  739.    
  740.     If LCase(Command.Name) = "ranks" Then
  741.    
  742.         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
  743.        
  744.             For x = LBound(clanranks) To UBound(clanranks)
  745.                 strMessage = strMessage & clanranks(x) & ", "
  746.             Next
  747.             strMessage = Left(strMessage,Len(strMessage)-2) & "."
  748.             'AddChat &H99CC00, "[" & UBound(clanranks) + 1 &"] " & strMessage
  749.             Command.Respond "[" & UBound(clanranks) + 1 &"] " & strMessage
  750.             Exit Sub
  751.        
  752.         End If
  753.  
  754.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  755.    
  756.         For x = LBound(clanranks) To UBound(clanranks)
  757.             strMessage = strMessage & clanranks(x) & ", "
  758.         Next
  759.         strMessage = Left(strMessage,Len(strMessage)-2) & "."
  760.         'AddChat &H99CC00, "[" & UBound(clanranks) + 1 &"] " & strMessage
  761.         Command.Respond "[" & UBound(clanranks) + 1 &"] " & strMessage
  762.        
  763.     End If
  764.    
  765.     If LCase(Command.Name) = "add" Then
  766.  
  767.         dbTimer.Enabled = False
  768.    
  769.         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
  770.    
  771.             If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  772.                 'AddChat &H99CC00, "[ERROR] You must specify a username and clanrank."
  773.                 Command.Respond "[ERROR] You must specify a username and clanrank."
  774.             Else
  775.            
  776.                 strSplit = Split(Command.Args, " ") '2 or more args
  777.                 strUsername = strSplit(0)
  778.                 strSetRank = strSplit(1)
  779.        
  780.                 If CheckTag(strUsername) = 1 And FindRank(strSetRank) <> "" Then
  781.                     If DelCMember(strUsername) = True Then
  782.                         Call AddCMember(strUsername, strSetRank)
  783.                         'AddChat &H99CC00, "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
  784.                         Command.Respond "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
  785.                         Call SafeAddUser(strUsername,"1","S",False)
  786.                         oldCRC = GetFileCRC32(users_list)
  787.                         newCRC = oldCRC
  788.                         dbTimer.Enabled = True
  789.                         ReloadSettings 1
  790.                     End If
  791.                 ElseIf FindRank(strSetRank) = "" Then
  792.                     'AddChat &H99CC00, "[ERROR] The clanrank you specified is not valid."  
  793.                     Command.Respond "[ERROR] The clanrank you specified is not valid." 
  794.                 ElseIf CheckTag(strUsername) = 0 Then
  795.                     'AddChat &H99CC00, "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
  796.                     Command.Respond "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
  797.                 End If
  798.                
  799.             End If
  800.            
  801.             Exit Sub
  802.        
  803.         End If
  804.  
  805.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  806.    
  807.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  808.                 'AddChat &H99CC00, "[ERROR] You must specify a username and clanrank."
  809.                 Command.Respond "[ERROR] You must specify a username and clanrank."
  810.         Else
  811.            
  812.             strUser = Command.Username
  813.             strSplit = Split(Command.Args, " ") '2 or more args
  814.             strUsername = strSplit(0)
  815.             strSetRank = strSplit(1)
  816.            
  817.             If CheckTag(strUser) = 1 And FindRank(strSetRank) <> "" Then
  818.            
  819.                 strRankIndex = GetIndexOfRank(strSetRank)              
  820.                 strSupRank = GetRankIndex(strUser)
  821.                
  822.                 If strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  823.                    
  824.                     If strUserAccess >= strAccess And DelCMember(strUsername) = True Then
  825.                         Call AddCMember(strUsername, strSetRank)
  826.                         'AddChat &H99CC00, "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
  827.                         Command.Respond "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
  828.                         Call SafeAddUser(strUsername,"1","S",False)
  829.                         ReloadSettings 1
  830.                     End If
  831.                    
  832.                 ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  833.                     'AddChat &H99CC00, "[ERROR] You cannot add a clan member to your same rank or higher."
  834.                     Command.Respond "[ERROR] You cannot add a clan member to your same rank or higher."
  835.                 End If
  836.  
  837.             ElseIf CheckTag(strUser) = 2 Then
  838.                 'AddChat &H99CC00, "[ERROR] Cannot add member to Clan " & clantag & " members list. The username "" " & strUsername & " "" is restricted. i.e Invalid special characters."
  839.                 Command.Respond "[ERROR] Cannot add member to Clan " & clantag & " members list. The username "" " & strUsername & " "" is restricted. i.e Invalid special characters."
  840.             ElseIf FindRank(strSetRank) = "" Then
  841.                 'AddChat &H99CC00, "[ERROR] The clanrank you specified is not valid."  
  842.                 Command.Respond "[ERROR] The clanrank you specified is not valid." 
  843.             ElseIf CheckTag(strUsername) = 0 Then
  844.                 'AddChat &H99CC00, "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
  845.                 Command.Respond "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
  846.             End If
  847.                        
  848.         End If
  849.        
  850.     End If
  851.    
  852.     If LCase(Command.Name) = "rem" Then
  853.    
  854.         dbTimer.Enabled = False
  855.    
  856.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  857.             strUser = Command.Username
  858.             strUsername = Command.Args
  859.             strInfo = InfoUser(strUsername, True)
  860.         Else
  861.             strUser = Command.Username
  862.             strSplit = Split(Command.Args, " ") '2 or more args
  863.             strUsername = strSplit(0)
  864.             strInfo = InfoUser(strUsername, True)
  865.         End If
  866.        
  867.         If strInfo <> "" Then
  868.             strSplit = Split(strInfo, " ") '2 or more args
  869.             strSafe = strSplit(2)
  870.         Else
  871.             'AddChat &H99CC00, "[ERROR] That user does not exist."
  872.             Command.Respond "[ERROR] That user does not exist."
  873.             Exit Sub
  874.         End If
  875.  
  876.         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
  877.             If strSafe <> "S" Then
  878.                 strRank = GetRank(strUsername)     
  879.                 If DelCMember(strUsername) = True Then             
  880.                         strSplit = Split(strInfo, " ") '2 or more args
  881.                         If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  882.                         Call RemUser(strUsername)          
  883.                         'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
  884.                         Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
  885.                         oldCRC = GetFileCRC32(users_list)
  886.                         newCRC = oldCRC
  887.                         dbTimer.Enabled = True
  888.                         ReloadSettings 1               
  889.                         Exit Sub   
  890.                     End If
  891.                 ElseIf strSafe = "S" Then
  892.                     'AddChat &H99CC00, "[ERROR] That user is safelisted."
  893.                     Command.Respond "[ERROR] That user is safelisted."
  894.                     Exit Sub
  895.                 End If
  896.         End If
  897.  
  898.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  899.        
  900.         strRank = GetRankIndex(strUser)
  901.         strGetRank = GetRankIndex(strUsername)
  902.         If strGetRank = "" Then strGetRank = strRank + 1
  903.                    
  904.         If CheckTag(strUser) = 1 And strRank < strGetRank And strSafe <> "S" Then
  905.             strRank = GetRank(strUsername) 
  906.             If DelCMember(strUsername) = True Then     
  907.                 strSplit = Split(strInfo, " ") '2 or more args
  908.                 If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
  909.                 Call RemUser(strUsername)          
  910.                 'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
  911.                 Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
  912.                 oldCRC = GetFileCRC32(users_list)
  913.                 newCRC = oldCRC
  914.                 dbTimer.Enabled = True
  915.                 ReloadSettings 1               
  916.                 Exit Sub   
  917.             End If
  918.         ElseIf CheckTag(strUser) = 1 And strRank < strGetRank And strSafe = "S" Then
  919.             'AddChat &H99CC00, "[ERROR] That user is safelisted."
  920.             Command.Respond "[ERROR] That user is safelisted."
  921.             Exit Sub
  922.         ElseIf CheckTag(strUser) = 2 Or strRank > strGetRank Then
  923.             'AddChat &H99CC00, "[ERROR] You do not have sufficient access to do that."
  924.             Command.Respond "[ERROR] You do not have sufficient access to do that."
  925.             Exit Sub
  926.         End If
  927.        
  928.     End If
  929.        
  930.     If LCase(Command.Name) = "promote" Then
  931.  
  932.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  933.             strUsername = Command.Args
  934.             strRankIndex = GetRankIndex(strUsername)
  935.             strSupRank = GetRankIndex(Command.Username)    
  936.         Else
  937.             strSplit = Split(Command.Args, " ") '2 or more args
  938.             strUsername = strSplit(0)
  939.             strRankIndex = GetRankIndex(strUsername)
  940.             strSupRank = GetRankIndex(Command.Username)
  941.         End If
  942.    
  943.         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
  944.             strRank = GetRank(strUsername)
  945.             PromoteCMember(strUsername)
  946.             strNewRank = GetRank(strUsername)
  947.             'AddChat &H99CC00, "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  948.             Command.Respond "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  949.             Exit Sub   
  950.         End If
  951.    
  952.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  953.    
  954.         If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  955.             strRank = GetRank(strUsername)
  956.             PromoteCMember(strUsername)
  957.             strNewRank = GetRank(strUsername)
  958.             'AddChat &H99CC00, "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  959.             Command.Respond "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  960.             Exit Sub
  961.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < (strRankIndex - 1) Then
  962.             strRank = GetRank(strUsername)
  963.             PromoteCMember(strUsername)
  964.             strNewRank = GetRank(strUsername)
  965.             'AddChat &H99CC00, "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  966.             Command.Respond "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
  967.             Exit Sub
  968.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  969.             'AddChat &H99CC00, "[ERROR] You cannot promote a clan member of same rank or higher."
  970.             Command.Respond "[ERROR] You cannot promote a clan member of same rank or higher."
  971.             Exit Sub
  972.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= (strRankIndex - 1) Then
  973.             'AddChat &H99CC00, "[ERROR] You cannot promote a clan member to the same rank or higher."
  974.             Command.Respond "[ERROR] You cannot promote a clan member to the same rank or higher."
  975.             Exit Sub
  976.         ElseIf Command.Args = "" Then
  977.             'AddChat &H99CC00, "[ERROR] You must specify a clan member to promote."
  978.             Command.Respond "[ERROR] You must specify a clan member to promote."
  979.             Exit Sub
  980.         Else
  981.             'AddChat &H99CC00, "[ERROR] The member you are trying to promote is not in Clan " & clantag & " members list."
  982.             Command.Respond "[ERROR] The member you are trying to promote is not in Clan " & clantag & " members list."
  983.         End If 
  984.        
  985.     End If 
  986.    
  987.     If LCase(Command.Name) = "demote" Then
  988.    
  989.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  990.             strUsername = Command.Args
  991.             strRankIndex = GetRankIndex(strUsername)
  992.             strSupRank = GetRankIndex(Command.Username)
  993.         Else
  994.             strSplit = Split(strArgs, " ") '2 or more args
  995.             strUsername = strSplit(0)
  996.             strRankIndex = GetRankIndex(strUsername)
  997.             strSupRank = GetRankIndex(Username)
  998.         End If
  999.                
  1000.         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
  1001.             strRank = GetRank(strUsername)
  1002.             DemoteCMember(strUsername)
  1003.             strNewRank = GetRank(strUsername)
  1004.             'AddChat &H99CC00, "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1005.             Command.Respond "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1006.             Exit Sub   
  1007.         End If
  1008.            
  1009.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  1010.            
  1011.         If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  1012.             strRank = GetRank(strUsername)
  1013.             DemoteCMember(strUsername)
  1014.             strNewRank = GetRank(strUsername)
  1015.             'AddChat &H99CC00, "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1016.             Command.Respond "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1017.             Exit Sub
  1018.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  1019.             strRank = GetRank(strUsername)
  1020.             DemoteCMember(strUsername)
  1021.             strNewRank = GetRank(strUsername)
  1022.             'AddChat &H99CC00, "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
  1023.             Command.Respond "[DEMOTE] " & strRank & ": " & strUsername & " has been demoted to rank " & strNewRank
  1024.             Exit Sub
  1025.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  1026.             'AddChat &H99CC00, "[ERROR] You cannot demote a clan member of same rank or higher."
  1027.             Command.Respond "[ERROR] You cannot demote a clan member of same rank or higher."
  1028.             Exit Sub
  1029.         ElseIf Command.Args = "" Then
  1030.             'AddChat &H99CC00, "[ERROR] You must specify a clan member to demote."
  1031.             Command.Respond "[ERROR] You must specify a clan member to demote."
  1032.             Exit Sub
  1033.         Else
  1034.             'AddChat &H99CC00, "[ERROR] The member you are trying to demote is not in Clan " & clantag & " members list."
  1035.             Command.Respond "[ERROR] The member you are trying to demote is not in Clan " & clantag & " members list."
  1036.         End If
  1037.        
  1038.     End If
  1039.  
  1040.     If LCase(Command.Name) = "open" Then
  1041.  
  1042.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  1043.             strUser = Command.Username
  1044.             strSetRank = FindRank(Command.Args)
  1045.             strRankIndex = GetIndexOfRank(strSetRank)
  1046.             strSupRank = GetRankIndex(Command.Username)
  1047.         Else
  1048.             strUser = Command.Username
  1049.             strSplit = Split(strArgs, " ") '2 or more args
  1050.             strSetRank = FindRank(strSplit(0))
  1051.             strRankIndex = GetIndexOfRank(strSetRank)
  1052.             strSupRank = GetRankIndex(Username)
  1053.         End If
  1054.        
  1055.         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
  1056.             Call AddCMember("(OPEN)", strSetRank)
  1057.             'AddChat &H99CC00, "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1058.             Command.Respond "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1059.             Exit Sub
  1060.         End If
  1061.    
  1062.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  1063.                    
  1064.         If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  1065.             Call AddCMember("(OPEN)", strSetRank)
  1066.             'AddChat &H99CC00, "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1067.             Command.Respond "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1068.             Exit Sub
  1069.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  1070.             Call AddCMember("(OPEN)", strSetRank)
  1071.             'AddChat &H99CC00, "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1072.             Command.Respond "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1073.             Exit Sub
  1074.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  1075.             'AddChat &H99CC00, "[ERROR] You cannot open this recruiting position for Clan " & clantag & " you are not of a high enough rank."
  1076.             Command.Respond "[ERROR] You cannot open this recruiting position for Clan " & clantag & " you are not of a high enough rank."
  1077.             Exit Sub
  1078.         ElseIf Command.Args = "" Then
  1079.             'AddChat &H99CC00, "[ERROR] You must specify a clanrank recruiting position to open."
  1080.             Command.Respond "[ERROR] You must specify a clanrank recruiting position to open."
  1081.             Exit Sub
  1082.         Else
  1083.             'AddChat &H99CC00, "[ERROR] You specified an invalid clanrank recruiting position to open."
  1084.             Command.Respond "[ERROR] You specified an invalid clanrank recruiting position to open."
  1085.         End If 
  1086.        
  1087.     End If
  1088.  
  1089.     If LCase(Command.Name) = "close" Then
  1090.    
  1091.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  1092.             strUser = Command.Username
  1093.             strSetRank = FindRank(Command.Args)
  1094.             strRankIndex = GetIndexOfRank(strSetRank)
  1095.             strSupRank = GetRankIndex(Command.Username)
  1096.         Else
  1097.             strUser = Command.Username
  1098.             strSplit = Split(strArgs, " ") '2 or more args
  1099.             strSetRank = FindRank(strSplit(0))
  1100.             strRankIndex = GetIndexOfRank(strSetRank)
  1101.             strSupRank = GetRankIndex(Username)
  1102.         End If
  1103.        
  1104.         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
  1105.             If RemRankPos(strSetRank) = True Then
  1106.                 'AddChat &H99CC00, "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1107.                 Command.Respond "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1108.                 Exit Sub
  1109.             End If
  1110.         End If
  1111.  
  1112.         isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
  1113.        
  1114.         If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  1115.             If RemRankPos(strSetRank) = True Then
  1116.                 'AddChat &H99CC00, "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1117.                 Command.Respond "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1118.                 Exit Sub
  1119.             End If
  1120.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  1121.             If RemRankPos(strSetRank) = True Then
  1122.                 'AddChat &H99CC00, "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1123.                 Command.Respond "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
  1124.                 Exit Sub
  1125.             End If
  1126.         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  1127.             'AddChat &H99CC00, "[ERROR] You cannot close this recruiting position for Clan " & clantag & " you are not of a high enough rank."
  1128.             Command.Respond "[ERROR] You cannot close this recruiting position for Clan " & clantag & " you are not of a high enough rank."
  1129.             Exit Sub
  1130.         ElseIf Command.Args = "" Then
  1131.             'AddChat &H99CC00, "[ERROR] You must specify a clanrank recruiting position to close."
  1132.             Command.Respond "[ERROR] You must specify a clanrank recruiting position to close."
  1133.             Exit Sub
  1134.         Else
  1135.             'AddChat &H99CC00, "[ERROR] You specified an invalid clanrank recruiting position to close."
  1136.             Command.Respond "[ERROR] You specified an invalid clanrank recruiting position to close."
  1137.         End If 
  1138.        
  1139.     End If
  1140.    
  1141.     If LCase(Command.Name) = "dice" Then
  1142.    
  1143.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  1144.             intDice = Command.Args
  1145.         Else
  1146.             strSplit = Split(Command.Args, " ") '2 or more args
  1147.             intDice = Int(strSplit(0))
  1148.         End If
  1149.  
  1150.         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
  1151.             If intDice <> "" Then
  1152.                 If IsNumeric(intDice) = True And Int(intDice) > 0 And Int(intDice) < 6 Then
  1153.                     Randomize()
  1154.                     strRolled = "Rolls dice: "
  1155.                     For x = 1 To intDice
  1156.                         theDice = Int((6 * Rnd) + 1)
  1157.                         strRolled = strRolled & theDice & " "
  1158.                     Next
  1159.                     'AddChat &H99CC00, strRolled
  1160.                     Command.Respond strRolled
  1161.                     Exit Sub
  1162.                 Else
  1163.                     'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1164.                     Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1165.                     Exit Sub
  1166.                 End If
  1167.             Else
  1168.                 'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1169.                 Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1170.                 Exit Sub
  1171.             End If
  1172.         End If
  1173.        
  1174.         If intDice <> "" Then
  1175.             If IsNumeric(intDice) = True And Int(intDice) > 0 And Int(intDice) < 6 Then
  1176.                 Randomize()
  1177.                 strRolled = "Rolls dice: "
  1178.                 For x = 1 To intDice
  1179.                     theDice = Int((6 * Rnd) + 1)
  1180.                     strRolled = strRolled & theDice & " "
  1181.                 Next
  1182.                 'AddChat &H99CC00, strRolled
  1183.                 Command.Respond strRolled
  1184.                 Exit Sub
  1185.             Else
  1186.                 'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1187.                 Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1188.                 Exit Sub
  1189.             End If
  1190.         Else
  1191.             'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1192.             Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P"
  1193.         End If
  1194.                
  1195.     End If
  1196.    
  1197. End Sub
  1198.  
  1199. Function NumLines(strFile) 'Count words in a specific dictionary
  1200.  
  1201.     Dim objFile, strLine
  1202.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1203.     Set objFile= objFSO.OpenTextFile(strFile, 1)
  1204.    
  1205.     Do While Not objFile.AtEndOfStream
  1206.         strLine = objFile.readline 'Read line
  1207.         If strLine <> "" Then
  1208.             intNumLines = intNumLines + 1 'Count lines
  1209.         End If
  1210.     Loop
  1211.    
  1212.     objFile.Close 'Close file
  1213.     NumLines = intNumLines 'Exit function with number of lines in file
  1214.  
  1215. End Function
  1216.  
  1217. Public Sub SafeAddUser(strUsername, strAccess, strSafe, blnSendChat)
  1218.  
  1219.     dbTimer.Enabled = False
  1220.  
  1221.     Dim objReadFile, objWriteFile, strLine
  1222.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1223.     Set objReadFile= objFSO.OpenTextFile(users_list, 1)
  1224.  
  1225.     Do While Not objReadFile.AtEndOfStream
  1226.    
  1227.         intFilePos = Int(intFilePos) + 1
  1228.         intNumLines = NumLines(users_list)
  1229.         strLine = objReadFile.readline 'Read line
  1230.        
  1231.         If strLine <> "" Then
  1232.             strFile = strFile & strLine
  1233.             If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1234.         End If
  1235.            
  1236.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1237.             strSplit = Split(strLine, " ")
  1238.             strUser = strSplit(0)
  1239.            
  1240.             If LCase(strUser) = LCase(strUsername) Then
  1241.                 intSetFilePos = Int(intFilePos)
  1242.                 Exit Do
  1243.             End If
  1244.            
  1245.         End If
  1246.        
  1247.     Loop
  1248.  
  1249.     If intSetFilePos = "" Then
  1250.         intSetFilePos = NumLines(users_list) + 1
  1251.     End If
  1252.        
  1253.     objReadFile.Close 'Close file
  1254.  
  1255.     Set objWriteFile= objFSO.OpenTextFile(users_list, 2)
  1256.     strSplit = Split(strFile, vbcrlf)
  1257.  
  1258.     blnFound = False
  1259.    
  1260.     For x = LBound(strSplit) To UBound(strSplit)
  1261.         intCount = x + 1
  1262.         If intCount = intSetFilePos Then
  1263.            
  1264.             blnFound = True
  1265.             strNow = Now
  1266.             strDay = Day(strNow) : If Len(strDay) = 1 Then : strDay = "0" & strDay : End If
  1267.             strMonth = Month(strNow) : If Len(strMonth) = 1 Then : strMonth = "0" & strMonth : End If
  1268.             strYear = Year(strNow)
  1269.             strHour = Hour(strNow) : If Len(strHour) = 1 Then : strHour = "0" & strHour : End If
  1270.             strMinute = Minute(strNow) : If Len(strMinute) = 1 Then : strMinute = "0" & strMinute : End If
  1271.             strSecond = Second(strNow) : If Len(strSecond) = 1 Then : strSecond = "0" & strSecond : End If
  1272.            
  1273.             strTimeStamp = strMonth & "-" & strDay & "-" & strYear & "_" & strHour & ":" & strMinute & ":" & strSecond
  1274.                    
  1275.             strWrite = strUsername & " " & strAccess & " " & strSafe & " <console> " & strTimeStamp & " <console> "  & strTimeStamp & " USER % %"
  1276.             objWriteFile.WriteLine(strWrite)
  1277.  
  1278.             'Username 1 S <console> mm-dd-yyyy_hh:mm:ss <console> mm-dd-yyyy_hh:mm:ss USER % %
  1279.            
  1280.         Else
  1281.             objWriteFile.WriteLine(strSplit(x))
  1282.         End If
  1283.     Next
  1284.    
  1285.     If blnFound = False Then
  1286.  
  1287.         strNow = Now
  1288.         strDay = Day(strNow) : If Len(strDay) = 1 Then : strDay = "0" & strDay : End If
  1289.         strMonth = Month(strNow) : If Len(strMonth) = 1 Then : strMonth = "0" & strMonth : End If
  1290.         strYear = Year(strNow)
  1291.         strHour = Hour(strNow) : If Len(strHour) = 1 Then : strHour = "0" & strHour : End If
  1292.         strMinute = Minute(strNow) : If Len(strMinute) = 1 Then : strMinute = "0" & strMinute : End If
  1293.         strSecond = Second(strNow) : If Len(strSecond) = 1 Then : strSecond = "0" & strSecond : End If
  1294.        
  1295.         strTimeStamp = strMonth & "-" & strDay & "-" & strYear & "_" & strHour & ":" & strMinute & ":" & strSecond
  1296.                
  1297.         strWrite = strUsername & " " & strAccess & " " & strSafe & " <console> " & strTimeStamp & " <console> "  & strTimeStamp & " USER % %"
  1298.         objWriteFile.WriteLine(strWrite)
  1299.     End If
  1300.  
  1301.     objWriteFile.Close 'Close file
  1302.     oldCRC = GetFileCRC32(users_list)
  1303.     newCRC = oldCRC
  1304.     ReloadSettings 1
  1305.     dbTimer.Enabled = True
  1306.    
  1307. End Sub
  1308.  
  1309. Public Sub RemUser(strUsername)
  1310.  
  1311.     dbTimer.Enabled = False
  1312.  
  1313.     Dim objReadFile, objWriteFile, strLine
  1314.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1315.     Set objReadFile= objFSO.OpenTextFile(users_list, 1)
  1316.  
  1317.     Do While Not objReadFile.AtEndOfStream
  1318.    
  1319.         intFilePos = intFilePos + 1
  1320.         intNumLines = NumLines(users_list)
  1321.         strLine = objReadFile.readline 'Read line
  1322.                
  1323.         If strLine <> "" Then
  1324.             strFile = strFile & strLine
  1325.             If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1326.         End If
  1327.        
  1328.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1329.             strSplit = Split(strLine, " ")
  1330.             strUser = strSplit(0)
  1331.  
  1332.             If LCase(strUser) = LCase(strUsername) Then
  1333.                 blnNextRank = True
  1334.             ElseIf LCase(strUser) <> LCase(strUsername) And blnNextRank = True Then
  1335.                 intSetFilePos = intFilePos - 1
  1336.                 blnNextRank = False
  1337.             End If
  1338.            
  1339.         End If
  1340.        
  1341.     Loop
  1342.  
  1343.     objReadFile.Close 'Close file
  1344.    
  1345.     If intSetFilePos = "" Then
  1346.         intSetFilePos = NumLines(users_list)
  1347.     End If
  1348.        
  1349.     Set objWriteFile= objFSO.OpenTextFile(users_list, 2)
  1350.     strSplit = Split(strFile, vbcrlf)
  1351.  
  1352.     blnFound = False
  1353.    
  1354.     For x = LBound(strSplit) To UBound(strSplit)
  1355.         intCount = x + 1
  1356.  
  1357.         If intCount = intSetFilePos Then   
  1358.    
  1359.         Else
  1360.             objWriteFile.WriteLine(strSplit(x))
  1361.         End If
  1362.     Next
  1363.  
  1364.     objWriteFile.Close 'Close file
  1365.    
  1366. End Sub
  1367.  
  1368. Public Function InfoUser(strUsername, blnReturnVal)
  1369.  
  1370.     Dim objReadFile, objWriteFile, strLine
  1371.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1372.     Set objReadFile= objFSO.OpenTextFile(users_list, 1)
  1373.  
  1374.     intNumLines = NumLines(users_list)
  1375.     blnFoundUser = False
  1376.    
  1377.     Do While Not objReadFile.AtEndOfStream
  1378.    
  1379.         intFilePos = intFilePos + 1
  1380.         strLine = objReadFile.readline 'Read line
  1381.                
  1382.         If strLine <> "" Then
  1383.             strFile = strFile & strLine
  1384.             If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1385.         End If
  1386.            
  1387.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1388.        
  1389.             strSplit = Split(strLine, " ")
  1390.             strUser = strSplit(0)
  1391.             strAccess = strSplit(1)
  1392.             strSafe = strSplit(2)
  1393.  
  1394.             If LCase(strUser) = LCase(strUsername) Then
  1395.                            
  1396.                 blnFoundUser = True
  1397.                
  1398.                 strRank = GetRank(strUser)
  1399.                            
  1400.                 If blnReturnVal = True Then
  1401.                     InfoUser = strUser & " " & strAccess & " " & strSafe & " " & strRank
  1402.                     Exit Do
  1403.                 End If 
  1404.            
  1405.             End If
  1406.            
  1407.         End If
  1408.        
  1409.     Loop
  1410.                
  1411.     objReadFile.Close 'Close file
  1412.                
  1413. End Function
  1414.  
  1415. Public Function GetCmdAccess(strCommand)
  1416.  
  1417.     Dim objReadFile, strLine
  1418.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1419.     Set objReadFile= objFSO.OpenTextFile(BotPath() & "commands.xml", 1)
  1420.  
  1421.     Do While Not objReadFile.AtEndOfStream
  1422.    
  1423.         strLine = objReadFile.readline 'Read line
  1424.                
  1425.         If strLine <> "" Then
  1426.             strLine = Replace(strLine, " ", "")
  1427.            
  1428.             blnNotGot = True
  1429.            
  1430.             If(Left(strLine,14+Len(strCommand)) = "<commandname=""" & strCommand) Then
  1431.                    
  1432.                 Do Until Left(strLine,6) = "<rank>" And blnNotGot = True
  1433.                     strLine = objReadFile.readline 'Read line
  1434.                     strLine = Replace(strLine, " ", "")
  1435.                 Loop
  1436.                        
  1437.                 strLine = Replace(strLine, "</rank>", "")
  1438.                 strLine = Replace(strLine, "<rank>", "")
  1439.                 strRank = strLine
  1440.                
  1441.                 Do Until Left(strLine,6) = "<rank>" Or Left(strLine,10) = "</command>"
  1442.                     strLine = objReadFile.readline 'Read line
  1443.                     strLine = Replace(strLine, " ", "")
  1444.                 Loop
  1445.                
  1446.                 If Left(strLine,10) = "</command>" Then blnNotGot = False : Exit Do
  1447.                 If Left(strLine,6) = "<rank>" Then
  1448.  
  1449.                     strLine = Replace(strLine, "</rank>", "")
  1450.                     strLine = Replace(strLine, "<rank>", "")
  1451.                     strRank = strLine
  1452.                
  1453.                 End If
  1454.                
  1455.             End If
  1456.            
  1457.         End If
  1458.    
  1459.     Loop
  1460.    
  1461.     objReadFile.Close 'Close file
  1462.     GetCmdAccess = strRank
  1463.    
  1464. End Function
  1465.  
  1466. Public Sub ResetCommands()
  1467.  
  1468.     Dim objReadFile, objWriteFile, strLine
  1469.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1470.    
  1471.     If objFSO.FileExists(cmds_list) Then
  1472.    
  1473.         Set objReadFile= objFSO.OpenTextFile(cmds_list, 1)
  1474.  
  1475.         Do While Not objReadFile.AtEndOfStream
  1476.  
  1477.             intFilePos = intFilePos + 1
  1478.             intNumLines = NumLines(cmds_list)
  1479.             strLine = objReadFile.readline 'Read line
  1480.                    
  1481.             If strLine <> "" Then
  1482.                 strFile = strFile & strLine
  1483.                 If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1484.             End If
  1485.            
  1486.         Loop
  1487.        
  1488.         objReadFile.Close
  1489.        
  1490.         Set objWriteFile= objFSO.OpenTextFile(BotPath & "commands.xml", 2)
  1491.         strSplit = Split(strFile, vbcrlf)
  1492.        
  1493.         For x = LBound(strSplit) To UBound(strSplit)
  1494.             objWriteFile.WriteLine(strSplit(x))
  1495.         Next
  1496.        
  1497.         objWriteFile.Close
  1498.        
  1499.         ReloadSettings 1
  1500.         AddChat &H99CC00, "[INFO] All bot commands reset - Clan Management Script"
  1501.         AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "commands.xml file created."
  1502.         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."
  1503.  
  1504.     End If
  1505.  
  1506. End Sub
  1507.  
  1508. Public Sub KickUser(strUsername)
  1509.     Call Command(BotVars.Username,"/kick " & strUsername,True)
  1510. End Sub
  1511.  
  1512. Public Sub BanUser(strUsername)
  1513.     Call Command(BotVars.Username,"/ban " & strUsername,True)
  1514. End Sub
  1515.  
  1516. Public Sub UnBanUser(strUsername)
  1517.     Call Command(BotVars.Username,"/unban " & strUsername,True)
  1518. End Sub
  1519.  
  1520. Function PromoteCMember(strMember)
  1521.    
  1522.     strRankIndex = GetRankIndex(strMember)
  1523.     For x = LBound(clanranks) To UBound(clanranks)
  1524.         If x = strRankIndex - 1 Then
  1525.             If x <> LBound(clanranks) Then
  1526.                 DelCMember(strMember)
  1527.                 Call AddCMember(strMember, clanranks(x-1))
  1528.                 Exit For
  1529.             End If
  1530.         End If
  1531.     Next
  1532.    
  1533. End Function
  1534.  
  1535. Function DemoteCMember(strMember)
  1536.  
  1537.     strRankIndex = GetRankIndex(strMember)
  1538.     For x = LBound(clanranks) To UBound(clanranks)
  1539.         If x = strRankIndex - 1 Then
  1540.             If x <> UBound(clanranks) Then
  1541.                 DelCMember(strMember)
  1542.                 Call AddCMember(strMember, clanranks(x+1))
  1543.                 Exit For
  1544.             End If
  1545.         End If
  1546.     Next
  1547.  
  1548. End Function
  1549.  
  1550. Function AddCMember(strUser, strSetRank)
  1551.  
  1552.     Dim objReadFile, objWriteFile, strLine
  1553.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1554.  
  1555.     For x = LBound(clanranks) To UBound(clanranks)
  1556.         If LCase(strSetRank) = LCase(clanranks(x)) Then
  1557.             strSetRank = clanranks(x)
  1558.             Exit For
  1559.         End If
  1560.     Next
  1561.  
  1562.     blnFoundPos = False
  1563.    
  1564.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  1565.     Do While Not objReadFile.AtEndOfStream
  1566.        
  1567.         intFilePos = intFilePos + 1
  1568.         intNumLines = NumLines(members_list)
  1569.         strLine = objReadFile.readline 'Read line
  1570.                
  1571.         If strLine <> "" Then
  1572.             strFile = strFile & strLine
  1573.             If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  1574.         End If
  1575.  
  1576.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1577.             strSplit = Split(strLine, " ")
  1578.             strRank = Replace(strSplit(0),":","")
  1579.             strMember = strSplit(1) 'infile
  1580.            
  1581.             intRank = GetRankIndex(strMember) 'infile
  1582.             intSetRank = GetIndexOfRank(strSetRank) 'toset
  1583.            
  1584.             If intSetRank > intRank Then
  1585.                 intSetFilePos = intFilePos
  1586.             End If
  1587.            
  1588.         End If
  1589.        
  1590.     Loop
  1591.    
  1592.     objReadFile.Close 'Close file
  1593.  
  1594.     If intSetFilePos = "" Then
  1595.         intSetFilePos = NumLines(members_list) + 1
  1596.     End If
  1597.  
  1598.     strSplit = Split(strFile, vbcrlf)
  1599.  
  1600.     blnFound = False
  1601.    
  1602.     Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  1603.     For x = LBound(strSplit) To UBound(strSplit)
  1604.        
  1605.         intCount = x + 1
  1606.         If intCount = intSetFilePos Then
  1607.             blnFound = True 'new
  1608.             objWriteFile.WriteLine(strSplit(x))
  1609.             objWriteFile.WriteLine(strSetRank & ": " & strUser)
  1610.         Else
  1611.             objWriteFile.WriteLine(strSplit(x))
  1612.         End If 
  1613.     Next
  1614.  
  1615.     If blnFound = False Then
  1616.  
  1617.         objWriteFile.WriteLine(strSetRank & ": " & strUser)
  1618.    
  1619.     End If
  1620.    
  1621.    
  1622.     objWriteFile.Close 'Close file     
  1623.    
  1624. End Function
  1625.  
  1626. Function DelCMember(strMember)
  1627.    
  1628.     Dim objReadFile, objWriteFile, strLine
  1629.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1630.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  1631.    
  1632.     blnWriteFile = False
  1633.     Do While Not objReadFile.AtEndOfStream
  1634.         strLine = objReadFile.readline 'Read line
  1635.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1636.             strSplit = Split(strLine, " ")
  1637.             If LCase(strSplit(1)) <> LCase(strMember) Then
  1638.                 strFile = strFile & strLine & vbcrlf
  1639.             End If
  1640.             blnWriteFile = True
  1641.         End If
  1642.     Loop
  1643.    
  1644.     If blnWriteFile = True Then
  1645.         objReadFile.Close 'Close file
  1646.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  1647.         strSplit = Split(strFile, vbcrlf)
  1648.         For x = LBound(strSplit) To UBound(strSplit)
  1649.             If strSplit(x) <> "" Then
  1650.                 objWriteFile.WriteLine(strSplit(x))
  1651.             End If
  1652.         Next
  1653.         DelCMember = True
  1654.     End If
  1655.    
  1656. End Function
  1657.  
  1658. Function RemRankPos(strRank)
  1659.  
  1660.     Dim objReadFile, objWriteFile, strLine
  1661.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1662.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  1663.    
  1664.     blnWriteFile = False
  1665.     Do While Not objReadFile.AtEndOfStream
  1666.         strLine = objReadFile.readline 'Read line
  1667.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1668.             strSplit = Split(strLine, " ")
  1669.             strRankFind = Left(strSplit(0),Len(strSplit(0))-1)
  1670.             strUser = strSplit(1)
  1671.             If LCase(strRankFind) = LCase(strRank) And LCase(strUser) = LCase("(OPEN)") And blnWriteFile = False Then
  1672.                 'Do Nothing
  1673.                 blnWriteFile = True
  1674.             Else
  1675.                 strFile = strFile & strLine & vbcrlf
  1676.             End If
  1677.         End If
  1678.     Loop
  1679.    
  1680.     If blnWriteFile = True Then
  1681.         objReadFile.Close 'Close file
  1682.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  1683.         strSplit = Split(strFile, vbcrlf)
  1684.         For x = LBound(strSplit) To UBound(strSplit)
  1685.             If strSplit(x) <> "" Then
  1686.                 objWriteFile.WriteLine(strSplit(x))
  1687.             End If
  1688.         Next
  1689.         RemRankPos = True
  1690.     End If
  1691.  
  1692. End Function
  1693.  
  1694. Function FindRank(strRank)
  1695.  
  1696.     For x = LBound(clanranks) To UBound(clanranks)
  1697.         If LCase(strRank) = LCase(clanranks(x)) Then
  1698.             FindRank = clanranks(x)
  1699.             Exit For
  1700.         End If
  1701.     Next
  1702.    
  1703. End Function
  1704.  
  1705. Function GetTopRankUser()
  1706.  
  1707.     Dim objFile, strLine
  1708.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1709.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1710.  
  1711.     Do While Not objFile.AtEndOfStream
  1712.         strLine = objFile.readline 'Read line
  1713.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1714.             strSplit = Split(strLine," ")
  1715.             strRank = Left(strSplit(0),Len(strSplit(0))-1)
  1716.             If Lcase(strRank) = Lcase(clanranks(0)) Then
  1717.                 GetTopRankUser = strSplit(1)
  1718.                 Exit Function
  1719.             End If
  1720.         End If
  1721.     Loop
  1722.    
  1723. End Function
  1724.  
  1725. Function GetIndexOfRank(strRank)
  1726.  
  1727.     For x = LBound(clanranks) To UBound(clanranks)
  1728.         If LCase(strRank) = LCase(clanranks(x)) Then
  1729.             GetIndexOfRank = x + 1
  1730.             Exit For
  1731.         End If
  1732.     Next
  1733.  
  1734. End Function
  1735.  
  1736. Function GetRankIndex(strMember)
  1737.  
  1738.     Dim objFile, strLine
  1739.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1740.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1741.  
  1742.     Do While Not objFile.AtEndOfStream
  1743.         strLine = objFile.readline 'Read line
  1744.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1745.             strSplit = Split(strLine," ")
  1746.             If Lcase(strSplit(1)) = Lcase(strMember) Then
  1747.                 strRankName = Left(strSplit(0),Len(strSplit(0))-1)
  1748.                 Exit Do
  1749.             End If
  1750.         End If
  1751.     Loop   
  1752.     objFile.Close 'Close file
  1753.    
  1754.     For x = LBound(clanranks) To UBound(clanranks)
  1755.         If LCase(strRankName) = LCase(clanranks(x)) Then
  1756.             If strRankName = clanranks(x) Then
  1757.                 GetRankIndex = x + 1
  1758.                 Exit For
  1759.             End If
  1760.         End If
  1761.     Next   
  1762.    
  1763. End Function
  1764.    
  1765. Function GetRank(strMember)
  1766.  
  1767.     Dim objFile, strLine
  1768.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1769.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1770.    
  1771.     Do While Not objFile.AtEndOfStream
  1772.         strLine = objFile.readline 'Read line
  1773.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1774.             strSplit = Split(strLine," ")
  1775.             If Lcase(strSplit(1)) = Lcase(strMember) Then
  1776.                 GetRank = Left(strSplit(0),Len(strSplit(0))-1)
  1777.                 Exit Do
  1778.             End If
  1779.         End If
  1780.     Loop
  1781.    
  1782.     objFile.Close 'Close file
  1783.    
  1784. End Function
  1785.  
  1786. Function GetRankNum()
  1787.  
  1788.     For x = LBound(clanranks) To UBound(clanranks)
  1789.         strMessage = strMessage & clanranks(x) & ", "
  1790.     Next
  1791.  
  1792. End Function
  1793.  
  1794. Function NumMembers() 'Count words in a specific dictionary
  1795.  
  1796.     Dim objFile, strLine
  1797.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1798.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1799.    
  1800.     strOpenPos = ""
  1801.     intOpenPos = 0
  1802.     intNumLines = 0
  1803.    
  1804.     Do While Not objFile.AtEndOfStream
  1805.         strLine = objFile.readline 'Read line
  1806.         If strLine <> "" Then
  1807.             If LCase(Right(strLine, 6)) <> LCase("(OPEN)") Then
  1808.                 intNumLines = intNumLines + 1 'Count lines
  1809.             Else
  1810.                 intOpenPos = intOpenPos + 1
  1811.                 strSplit = Split(strLine," ")
  1812.                 strOpenPos = strOpenPos & Left(strSplit(0),Len(strSplit(0))-1) & ", "
  1813.             End If
  1814.         End If
  1815.     Loop
  1816.    
  1817.     objFile.Close 'Close file
  1818.     NumMembers = intNumLines 'Exit function with number of lines in file
  1819.  
  1820. End Function
  1821.  
  1822. Function ListMembers() 'Fetch a word from a specific dictionary
  1823.  
  1824.     Dim objFile, strLine
  1825.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1826.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  1827.    
  1828.     intNumLines = 0
  1829.     Do While Not objFile.AtEndOfStream
  1830.         strLine = objFile.readline 'Read line
  1831.         If strLine <> "" Then
  1832.             intNumLines = intNumLines + 1
  1833.             strMembers = strMembers & "[" & intNumLines & "] " & strLine & vbcrlf
  1834.         End If
  1835.     Loop
  1836.    
  1837.     objFile.Close 'Close file
  1838.     ListMembers = strMembers 'Exit function with Members
  1839.    
  1840. End Function
  1841.  
  1842. Function FormatTag()
  1843.     intWilds = 0
  1844.     For x = 1 To Len(clantag)
  1845.         If Mid(clantag,x,1) = "*" Then
  1846.             intWilds = intWilds + 1
  1847.             If intWilds > 1 Then
  1848.             Else
  1849.                 strTag = strTag & Mid(clantag,x,1)
  1850.             End If
  1851.         Else
  1852.             strTag = strTag & Mid(clantag,x,1)
  1853.         End If
  1854.     Next
  1855.     clantag = strTag
  1856. End Function
  1857.  
  1858. Function CheckTag(strUser)
  1859.    
  1860.     CheckTag = 0
  1861.     If InStr(1, clantag, "*") > 0 Then
  1862.  
  1863.         strSplitTag = Split(clantag,"*")
  1864.         intLeft = Len(strSplitTag(0))
  1865.         intRight = Len(strSplitTag(1))
  1866.         blnLeft = False : blnRight = False
  1867.         For x = 1 To Len(strUser)
  1868.             strFind = Mid(strUser,x,intLeft)
  1869.             If LCase(strFind) = LCase(strSplitTag(0)) Then blnLeft = True
  1870.             strFind = Mid(strUser,x,intRight)
  1871.             If LCase(strFind) = LCase(strSplitTag(1)) Then blnRight = True
  1872.         Next
  1873.        
  1874.         strLeftTag = Left(strUser,Len(strSplitTag(0)))
  1875.         lenLeftTag = Len(strLeftTag)
  1876.         strRightTag = Right(strUser,Len(strSplitTag(1)))
  1877.         lenRightTag = Len(strRightTag)
  1878.         strMember = Right(strUser, Len(strUser) - lenLeftTag)
  1879.         strMember = Left(strMember, Len(strMember) - lenRightTag)
  1880.        
  1881.         If Left(clantag,1)  = "*" Then
  1882.             strRestricted = Mid(clantag,2,1)
  1883.             If Right(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
  1884.         ElseIf Right(clantag,1)  = "*" Then
  1885.             strRestricted = Mid(clantag,Len(clantag)-1,1)
  1886.             If Left(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
  1887.         Else
  1888.             strRestricted1 = Right(strLeftTag,1)
  1889.             strRestricted2 = Left(strRightTag,1)
  1890.             If Left(strMember,1) = strRestricted1 Then CheckTag = 2 : Exit Function
  1891.             If Right(strMember,1) = strRestricted2 Then CheckTag = 2 : Exit Function
  1892.         End If
  1893.                
  1894.         If strMember <> Replace(clantag, "*", "") Then
  1895.             strMember = strSplitTag(0) & strMember & strSplitTag(1)
  1896.         Else
  1897.             CheckTag = 2 : Exit Function
  1898.         End If
  1899.        
  1900.         If LCase(strUser) = LCase(strMember) And blnLeft = True And blnRight = True Then CheckTag = 1
  1901.  
  1902.     End If
  1903.    
  1904. End Function
  1905.  
  1906. Public Function GetFileCRC32(FilePath)
  1907.  
  1908.     On Error Resume Next
  1909.  
  1910.     Dim oFSO: Set oFSO = CreateObject("Scripting.FileSystemObject")
  1911.     Dim oFile: Set oFile = oFSO.GetFile(FilePath)
  1912.    
  1913.     With oFile.OpenAsTextStream()
  1914.         Data = .Read(oFile.Size)
  1915.         .Close
  1916.     End With
  1917.  
  1918.     GetFileCRC32 = CRC32(Data)
  1919.    
  1920. End Function
  1921.  
  1922. Public Sub updateMembersList()
  1923.  
  1924.     dbTimer.Enabled = False
  1925.  
  1926.     Dim objFile, strLine
  1927.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  1928.    
  1929.     Set objFile= objFSO.OpenTextFile(users_list, 1)
  1930.     Do While Not objFile.AtEndOfStream
  1931.         strLine = objFile.readline 'Read line
  1932.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  1933.             strSplit = Split(strLine," ")
  1934.             strUserFile = strUserFile & " " & strSplit(0)
  1935.         End If
  1936.     Loop
  1937.     objFile.Close 'Close file
  1938.  
  1939.     strSplit = Split(strUserFile, " ")
  1940.    
  1941.     For x = LBound(strSplit) To UBound(strSplit)
  1942.         strUser = strSplit(x)
  1943.         strRankOfUser = GetRank(strUser)
  1944.         If strUser <> "" And strRankOfUser = "" Then
  1945.             AddChat &H99CC00, "[INFO] A user appears to be added to bot using - User Database Manager - removing user."
  1946.             AddChat &H99CC00, "[INFO] Please use bot commands to add / remove users. i.e add, del, safeadd, safedel"
  1947.             AddQ "[INFO] A user appears to be added to bot using - User Database Manager - removing user."
  1948.             AddQ "[INFO] Please use bot commands to add / remove users. i.e add, del, safeadd, safedel"
  1949.             Call RemUser(strUser)
  1950.             Call DelCMember(strUser)
  1951.         End If
  1952.     Next
  1953.  
  1954.     oldCRC = GetFileCRC32(users_list)
  1955.     newCRC = oldCRC
  1956.     ReloadSettings 1
  1957.     dbTimer.Enabled = True
  1958.        
  1959. 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.

×