SHARE
TWEET

Clan Management Script [StealthBot]

a guest Aug 23rd, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Script("Name")          = "Clan Members"
  2. Script("Abbreviation"= "clan members"
  3. Script("Author")        = "Fpa-rF-"
  4. Script("Category")      = "Utility"
  5. Script("Major")         = 1
  6. Script("Minor")         = 0
  7. Script("Revision")      = 1
  8. Script("Description")   = "Clan Member Management"
  9.  
  10. ' https://pastebin.com/TQwTkGCF
  11. ' SCRIPT COMMANDS
  12. ' ===============
  13. ' rhelp    - LISTS CLAN MEMBER COMMANDS (THIS SCRIPT)                       !rhelp
  14. ' members  - LISTS MEMBERS BY RANK (scripts\..\members.txt) (SEE ABOVE)     !members
  15. ' rnum     - LISTS NUMBER OF MEMBERS AND OPEN POSITIONS -> (OPEN)           !rnum
  16. ' rfind    - LISTS A MEMBER AND RANK                                        !rfind      Username
  17. ' rlist    - LISTS NUMBER OF RANKS (SEE ABOVE)                              !rlist
  18. ' radd     - ADDS MEMBER TO CLAN LIST                                       !radd       Username clanrank OR !radd (OPEN) clanrank
  19. ' rdel     - DELS MEMBER FROM CLAN LIST                                     !rdel       Username
  20. ' redit    - EDITS A MEMBER RANK IN CLAN LIST                               !redit      Username clanrank
  21. ' rpromote - PROMOTE A MEMBER 1 RANK                                        !rpromote   Username
  22. ' rdemote  - DEMOTE A MEMBER 1 RANK                                         !rdemote    Username
  23. ' ropen    - ADDS A RANK POSITION (OPEN)                                    !ropen      clanrank
  24. ' rclose   - DELS A RANK POSITION (OPEN)                                    !rclose     clanrank
  25.  
  26. ' SCRIPT SETTINGS
  27. ' ===============
  28. 'ENTER YOUR REQUIRED ACCESS LEVEL FOR COMMANDS
  29. Public reqaccess : reqaccess = 1
  30.  
  31. 'RANKS/ROSTER FILE (KEEP OUT OF SCRIPTS FOLDER)
  32. Public members_list : members_list = BotPath() & "scripts\..\members.txt"
  33.  
  34. 'ENTER YOUR CLAN TAG BELOW (ONE WILDCARD * ALLOWED, * IS MEMBER NAME)
  35. 'EXAMPLE RIGHT SIDED: clantag = "*-TaG-"
  36. 'EXAMPLE LEFT SIDED:  clantag = "~TaG~*"
  37. 'EXAMPLE DUAL SIDED:  clantag = "]*["
  38. Public clantag : clantag = "*-rF-"
  39.  
  40. 'ENTER YOUR RANKS BELOW - ADD AS MANY AS YOU NEED
  41. Public clanranks : clanranks = Array( _
  42. "Founder", _
  43. "Leader", _
  44. "Commander", _
  45. "Captain", _
  46. "Lieutenant", _
  47. "1stSergeant", _
  48. "MasterSergeant", _
  49. "Sergeant1stClass", _
  50. "StaffSergeant", _
  51. "Sergeant", _
  52. "Corporal", _
  53. "Specialist", _
  54. "Private", _
  55. "Spy")
  56.  
  57. Public intOpen : intOpen = 0
  58. Public strOpen : strOpen = ""
  59.  
  60. Public Sub Event_Load()
  61.  
  62.     Dim objWriteFile
  63.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  64.     If objFSO.FileExists(members_list) Then
  65.    
  66.     Else
  67.         Set objWriteFile= objFSO.OpenTextFile(members_list, 8, True, 0)
  68.         objWriteFile.Close
  69.     End If
  70.  
  71.     If OpenCommand("members") Is Nothing Then
  72.         With CreateCommand("members")
  73.             .Description = "List Clan Members"
  74.             .RequiredRank = reqaccess
  75.             .Save
  76.         End With
  77.     End If
  78.  
  79.     If OpenCommand("rhelp") Is Nothing Then
  80.         With CreateCommand("rhelp")
  81.             .Description = "List Clan Member Commands"  
  82.             .RequiredRank = reqaccess
  83.             .Save
  84.         End With
  85.     End If
  86.  
  87.     If OpenCommand("rnum") Is Nothing Then
  88.         With CreateCommand("rnum")
  89.             .Description = "List Number Of Clan Members"  
  90.             .RequiredRank = reqaccess
  91.             .Save
  92.         End With
  93.     End If
  94.    
  95.     If OpenCommand("rfind") Is Nothing Then
  96.         With CreateCommand("rfind")
  97.             .Description = "Find Clan Members"
  98.             .RequiredRank = reqaccess
  99.             .Save
  100.         End With
  101.     End If
  102.  
  103.     If OpenCommand("rlist") Is Nothing Then
  104.         With CreateCommand("rlist")
  105.             .Description = "List Clan Ranks"
  106.             .RequiredRank = reqaccess
  107.             .Save
  108.         End With
  109.     End If
  110.  
  111.     If OpenCommand("radd") Is Nothing Then
  112.         With CreateCommand("radd")
  113.             .Description = "Add Clan Members"
  114.             .RequiredRank = reqaccess
  115.             .Save
  116.         End With
  117.     End If
  118.  
  119.     If OpenCommand("rdel") Is Nothing Then
  120.         With CreateCommand("rdel")
  121.             .Description = "Delete Clan Members"
  122.             .RequiredRank = reqaccess
  123.             .Save
  124.         End With
  125.     End If
  126.  
  127.     If OpenCommand("redit") Is Nothing Then
  128.         With CreateCommand("redit")
  129.             .Description = "Edit Clan Members"
  130.             .RequiredRank = reqaccess
  131.             .Save
  132.         End With
  133.     End If
  134.  
  135.     If OpenCommand("rpromote") Is Nothing Then
  136.         With CreateCommand("rpromote")
  137.             .Description = "Promote Clan Members"
  138.             .RequiredRank = reqaccess
  139.             .Save
  140.         End With
  141.     End If
  142.    
  143.     If OpenCommand("rdemote") Is Nothing Then
  144.         With CreateCommand("rdemote")
  145.             .Description = "Demote Clan Members"
  146.             .RequiredRank = reqaccess
  147.             .Save
  148.         End With
  149.     End If
  150.  
  151.     If OpenCommand("ropen") Is Nothing Then
  152.         With CreateCommand("ropen")
  153.             .Description = "Add Clan Rank Recruting Position"
  154.             .RequiredRank = reqaccess
  155.             .Save
  156.         End With
  157.     End If
  158.  
  159.     If OpenCommand("rclose") Is Nothing Then
  160.         With CreateCommand("rclose")
  161.             .Description = "Remove Clan Rank Recruting Position"
  162.             .RequiredRank = reqaccess
  163.             .Save
  164.         End With
  165.     End If
  166.    
  167. End Sub
  168.  
  169. Public Sub Event_Command(Command)
  170.  
  171.     FormatTag()
  172.  
  173.     Dim objWriteFile
  174.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  175.     If objFSO.FileExists(members_list) Then
  176.    
  177.     Else
  178.         Set objWriteFile= objFSO.OpenTextFile(members_list, 8, True, 0)
  179.         objWriteFile.Close
  180.     End If
  181.    
  182.     If LCase(Command.Name) = "rhelp" Then
  183.         AddQ "Clan Member Management Commands: members, rnum, rfind, rlist, radd, rdel, redit, rpromote, rdemote, ropen, rclose, rhelp."
  184.     End If
  185.    
  186.     If LCase(Command.Name) = "members" Then
  187.         intNumMembers = NumLines()
  188.         strMembers = Split(ListMembers(), vbcrlf)
  189.         For x = 0 To intNumMembers - 1
  190.             AddQ strMembers(x)
  191.         Next
  192.     End If
  193.    
  194.     If LCase(Command.Name) = "rnum" Then
  195.         intNumMembers = NumMembers()
  196.         If intOpen > 0 Then
  197.             strOpen = Left(strOpen,Len(strOpen)-2) & "."
  198.             AddQ "Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpen & " recruiting positions: " & strOpen
  199.         Else
  200.             AddQ "Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
  201.         End If
  202.     End If
  203.    
  204.     If LCase(Command.Name) = "rfind" Then
  205.  
  206.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  207.             strUser = Command.Args
  208.             strRank = GetRank(strUser)
  209.             If strRank <> "" And LCase(strUser) <> LCase("(OPEN)") Then
  210.                 AddQ strRank & ": " & strUser
  211.             ElseIf strRank = "" And strUser <> "" Then
  212.                 AddQ strUser & " not found in Clan " & clantag & " members list."
  213.             Else
  214.                 AddQ "You must specify a username."
  215.             End If
  216.         Else
  217.             strSplit = Split(Command.Args, " ") '2 or more args
  218.             strUser = strSplit(0)
  219.             strRank = GetRank(strUser)
  220.             If strRank <> "" And LCase(strUser) <> LCase("(OPEN)") Then
  221.                 AddQ strRank & ": " & strUser
  222.             End If
  223.         End If
  224.        
  225.     End If
  226.  
  227.     If LCase(Command.Name) = "rlist" Then
  228.         For x = LBound(clanranks) To UBound(clanranks)
  229.             strMessage = strMessage & clanranks(x) & ", "
  230.         Next
  231.         strMessage = Left(strMessage,Len(strMessage)-2) & "."
  232.         AddQ "[" & UBound(clanranks) + 1 &"] " & strMessage
  233.     End If
  234.  
  235.     If LCase(Command.Name) = "radd" Then
  236.        
  237.         If NumLines() = 0 Then
  238.             strUser = Command.Username             
  239.             Call AddCMember(strUser, clanranks(0))
  240.             AddQ "[NEW] " & members_list & " is empty, adding " & strUser & " as highest rank " & clanranks(0) & "."
  241.         End If
  242.    
  243.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  244.             AddQ "You must specify a username and clanrank."
  245.         Else
  246.        
  247.             strSplit = Split(Command.Args, " ") '2 or more args
  248.             strUser = strSplit(0)
  249.             strSetRank = strSplit(1)
  250.             strRank = GetRank(strUser)
  251.             If strRank <> "" And LCase(strUser) <> LCase("(OPEN)") Then
  252.                 AddQ strUser & " is already a ranked member."                  
  253.             ElseIf strUser <> "" And strSetRank <> "" Then
  254.                            
  255.                 If CheckTag(strUser) = 1 Then
  256.                     If FindRank(strSetRank) <> "" Then
  257.                         For x = LBound(clanranks) To UBound(clanranks)
  258.                             If LCase(strSetRank) = LCase(clanranks(x)) Then
  259.                                 strRankIndex = x + 1
  260.                                 Exit For
  261.                             End If
  262.                         Next
  263.                    
  264.                         strSupRank = GetRankIndex(Command.Username)
  265.  
  266.                         If strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then            
  267.                             If DelCMember(strUser) = True Then                         
  268.                                 Call AddCMember(strUser, strSetRank)
  269.                                 AddQ "[ADDED] " & strUser & " as rank " & strSetRank & " to Clan " & clantag & " members list."
  270.                             End If
  271.                         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  272.                             AddQ "You cannot add a member to the same rank or higher."
  273.                         End If
  274.                        
  275.                     Else
  276.                         AddQ "The clanrank you specified is not valid."
  277.                     End If
  278.                 ElseIf CheckTag(strUser) = 2 Then
  279.                     AddQ "Cannot add member to Clan " & clantag & " members list. The username " & strUser & " is restricted."
  280.                 Else
  281.                    
  282.                     AddQ "Cannot add member to Clan " & clantag & " members list. " & strUser & " is not wearing clan tag."
  283.                 End If
  284.             End If
  285.         End If
  286.     End If
  287.    
  288.        
  289.     If LCase(Command.Name) = "rdel" Then
  290.    
  291.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  292.             strUser = Command.Args
  293.             strRank = GetRank(strUser)
  294.  
  295.             If strRank <> "" And LCase(strUser) <> LCase("(OPEN)") Then
  296.            
  297.                 strRankIndex = GetRankIndex(strUser)
  298.                 strSupRank = GetRankIndex(Command.Username)
  299.                
  300.                 If strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then            
  301.                     If DelCMember(strUser) = True Then
  302.                         AddQ "[REMOVED] " & strRank & ": " & strUser & " from Clan " & clantag & " members list."
  303.                     End If
  304.                 ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  305.                     AddQ "You cannot delete a member of same rank or higher."
  306.                 End If
  307.                
  308.             ElseIf strRank = "" Then
  309.                 AddQ "The member you are trying to delete is not in Clan " & clantag & " members list."
  310.             Else
  311.                 AddQ "You must specify a username."
  312.             End If
  313.            
  314.         Else
  315.    
  316.             strSplit = Split(Command.Args, " ") '2 or more args
  317.             strUser = strSplit(0)
  318.             strRank = GetRank(strUser)
  319.            
  320.             If strRank <> "" And LCase(strUser) <> LCase("(OPEN)") Then
  321.            
  322.                 strRankIndex = GetRankIndex(strUser)
  323.                 strSupRank = GetRankIndex(Command.Username)
  324.                
  325.                 If strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then            
  326.                     If DelCMember(strUser) = True Then
  327.                         AddQ "[REMOVED] " & strUser & " from Clan " & clantag & " members list."
  328.                     End If
  329.                 ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  330.                     AddQ "You cannot delete a member of same rank or higher."
  331.                 End If
  332.                
  333.             End If
  334.         End If
  335.        
  336.     End If
  337.    
  338.     If LCase(Command.Name) = "redit" Then
  339.    
  340.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  341.             AddQ "You must specify a username and a clanrank."
  342.         Else
  343.             strSplit = Split(Command.Args, " ") '2 or more args
  344.             strUser = strSplit(0)
  345.             strSetRank = strSplit(1)
  346.             If FindRank(strSetRank) <> "" Then
  347.                 strRank = GetRank(strUser)
  348.                 If strRank <> "" And strSetRank <> "" Then
  349.                     strSupRank = GetRankIndex(Command.Username)     '4
  350.                     strRankIndex = GetRankIndex(strUser)        '5
  351.  
  352.                     For x = LBound(clanranks) To UBound(clanranks)
  353.                         If LCase(strSetRank) = Lcase(clanranks(x)) Then
  354.                             strChangeRank = x + 1
  355.                             Exit For
  356.                         End If
  357.                     Next
  358.                    
  359.                     If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  360.                         If DelCMember(strUser) = True Then
  361.                             Call AddCMember(strUser, strSetRank)
  362.                             AddQ "[EDITED] " & strUser & " as rank " & strSetRank & " to Clan " & clantag & " members list."
  363.                         End If
  364.                     ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex And strChangeRank > strSupRank Then
  365.                         If DelCMember(strUser) = True Then
  366.                             Call AddCMember(strUser, strSetRank)
  367.                             AddQ "[EDITED] " & strUser & " as rank " & strSetRank & " to Clan " & clantag & " members list."
  368.                         End If
  369.                     ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  370.                         AddQ "You cannot edit a member of same rank or higher."
  371.                     ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank = strChangeRank Then
  372.                         AddQ "You cannot edit a member to the same rank or higher."
  373.                     Else
  374.                         AddQ "The member you are trying to edit is not in Clan " & clantag & " members list."
  375.                     End If
  376.  
  377.                 Else
  378.                     AddQ "The member you are trying to edit is not in Clan " & clantag & " members list."
  379.                 End If
  380.             Else
  381.                 AddQ "You specified an invalid clanrank."
  382.             End If
  383.         End If
  384.     End If 
  385.    
  386.     If LCase(Command.Name) = "rpromote" Then
  387.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  388.             strUser = Command.Args
  389.             strRankIndex = GetRankIndex(strUser)
  390.             strSupRank = GetRankIndex(Command.Username)    
  391.  
  392.             If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  393.                 PromoteCMember(strUser)
  394.                 strRank = GetRank(strUser)
  395.                 AddQ strUser & " has been promoted to rank " & strRank
  396.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < (strRankIndex - 1) Then
  397.                 PromoteCMember(strUser)
  398.                 strRank = GetRank(strUser)
  399.                 AddQ strUser & " has been promoted to rank " & strRank
  400.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  401.                 AddQ "You cannot promote a member of same rank or higher."
  402.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= (strRankIndex - 1) Then
  403.                 AddQ "You cannot promote a member to the same rank or higher."
  404.             ElseIf Command.Args = "" Then
  405.                 AddQ "You must specify a member to promote."
  406.             Else
  407.                 AddQ "The member you are trying to promote is not in Clan " & clantag & " members list."
  408.             End If 
  409.            
  410.         Else
  411.             strSplit = Split(Command.Args, " ") '2 or more args
  412.             strUser = strSplit(0)
  413.             strRankIndex = GetRankIndex(strUser)
  414.             strSupRank = GetRankIndex(Command.Username)
  415.  
  416.             If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  417.                 PromoteCMember(strUser)
  418.                 strRank = GetRank(strUser)
  419.                 AddQ strUser & " has been promoted to rank " & strRank
  420.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < (strRankIndex - 1) Then
  421.                 PromoteCMember(strUser)
  422.                 strRank = GetRank(strUser)
  423.                 AddQ strUser & " has been promoted to rank " & strRank
  424.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  425.                 AddQ "You cannot promote a member of same rank or higher."
  426.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= (strRankIndex - 1) Then
  427.                 AddQ "You cannot promote a member to the same rank or higher."
  428.             ElseIf Command.Args = "" Then
  429.                 AddQ "You must specify a member to promote."
  430.             Else
  431.                 AddQ "The member you are trying to promote is not in Clan " & clantag & " members list."
  432.             End If 
  433.  
  434.         End If
  435.  
  436.     End If 
  437.    
  438.     If LCase(Command.Name) = "rdemote" Then
  439.    
  440.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  441.             strUser = Command.Args
  442.             strRankIndex = GetRankIndex(strUser)
  443.             strSupRank = GetRankIndex(Command.Username)
  444.  
  445.             If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  446.                 DemoteCMember(strUser)
  447.                 strRank = GetRank(strUser)
  448.                 AddQ strUser & " has been demoted to rank " & strRank
  449.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  450.                 DemoteCMember(strUser)
  451.                 strRank = GetRank(strUser)
  452.                 AddQ strUser & " has been demoted to rank " & strRank
  453.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  454.                 AddQ "You cannot demote a member of same rank or higher."
  455.             ElseIf Command.Args = "" Then
  456.                 AddQ "You must specify a member to demote."
  457.             Else
  458.                 AddQ "The member you are trying to demote is not in Clan " & clantag & " members list."
  459.             End If
  460.            
  461.         Else
  462.        
  463.             strSplit = Split(strArgs, " ") '2 or more args
  464.             strUser = strSplit(0)
  465.             strRankIndex = GetRankIndex(strUser)
  466.             strSupRank = GetRankIndex(Username)
  467.            
  468.             If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  469.                 DemoteCMember(strUser)
  470.                 strRank = GetRank(strUser)
  471.                 AddQ strUser & " has been demoted to rank " & strRank
  472.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  473.                 DemoteCMember(strUser)
  474.                 strRank = GetRank(strUser)
  475.                 AddQ strUser & " has been demoted to rank " & strRank
  476.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  477.                 AddQ "You cannot demote a member of same rank or higher."
  478.             ElseIf Command.Args = "" Then
  479.                 AddQ "You must specify a member to demote."
  480.             Else
  481.                 AddQ "The member you are trying to demote is not in Clan " & clantag & " members list."
  482.             End If
  483.  
  484.         End If
  485.     End If
  486.  
  487.    
  488.     If LCase(Command.Name) = "ropen" Then
  489.    
  490.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  491.             strRank = Command.Args
  492.             If LCase(strRank) = LCase(FindRank(strRank)) And strRank <> "" Then
  493.                 Call AddCMember("(OPEN)", strRank)
  494.                 AddQ "[ADDED] " & strRank & " open-position to Clan " & clantag & " members list."
  495.             Else
  496.                 AddQ "You must specify a clanrank to open a position. Try " & BotVars.Trigger & "ropen clanrank"
  497.             End If
  498.         Else
  499.             strSplit = Split(Command.Args, " ") '2 or more args
  500.             strRank = strSplit(0)
  501.             If LCase(strRank) = LCase(FindRank(strRank)) And strRank <> "" Then
  502.                 Call AddCMember("(OPEN)", strRank)
  503.                 AddQ "[ADDED] " & strRank & " open-position to Clan " & clantag & " members list."
  504.             Else
  505.                 AddQ "You must specify a clanrank to open a position. Try " & BotVars.Trigger & "ropen clanrank"
  506.             End If
  507.         End If
  508.        
  509.     End If
  510.  
  511.     If LCase(Command.Name) = "rclose" Then
  512.    
  513.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  514.             strRank = Command.Args
  515.             If LCase(strRank) = LCase(FindRank(strRank)) And strRank <> "" Then
  516.                 If RemRankPos(strRank) = True Then
  517.                     AddQ "[REMOVED] " & strRank & " open-position removed from Clan " & clantag & " members list."
  518.                 End If
  519.             Else
  520.                 AddQ "You must specify a clanrank to remove an open position. Try " & BotVars.Trigger & "rclose clanrank"
  521.             End If
  522.         Else
  523.             strSplit = Split(Command.Args, " ") '2 or more args
  524.             strRank = strSplit(0)
  525.             If LCase(strRank) = LCase(FindRank(strRank)) And strRank <> "" Then
  526.                 If RemRankPos(strRank) = True Then
  527.                     AddQ "[REMOVED] " & strRank & " open-position removed from Clan " & clantag & " members list."
  528.                 End If
  529.             Else
  530.                 AddQ "You must specify a clanrank to remove an open position. Try " & BotVars.Trigger & "rclose clanrank"
  531.             End If
  532.         End If
  533.     End If
  534.    
  535. End Sub
  536.  
  537. Function PromoteCMember(strMember)
  538.    
  539.     strRankIndex = GetRankIndex(strMember)
  540.     For x = LBound(clanranks) To UBound(clanranks)
  541.         If x = strRankIndex - 1 Then
  542.             If x <> LBound(clanranks) Then
  543.                 DelCMember(strMember)
  544.                 Call AddCMember(strMember, clanranks(x-1))
  545.                 Exit For
  546.             End If
  547.         End If
  548.     Next
  549.    
  550. End Function
  551.  
  552. Function DemoteCMember(strMember)
  553.  
  554.     strRankIndex = GetRankIndex(strMember)
  555.     For x = LBound(clanranks) To UBound(clanranks)
  556.         If x = strRankIndex - 1 Then
  557.             If x <> UBound(clanranks) Then
  558.                 DelCMember(strMember)
  559.                 Call AddCMember(strMember, clanranks(x+1))
  560.                 Exit For
  561.             End If
  562.         End If
  563.     Next
  564.  
  565. End Function
  566.  
  567. Function AddCMember(strMember, strSetRank)
  568.  
  569.     Dim objReadFile, objWriteFile, strLine
  570.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  571.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  572.        
  573.     For x = LBound(clanranks) To UBound(clanranks)
  574.         If LCase(strSetRank) = LCase(clanranks(x)) Then
  575.             intPrevRankPos = x + 1
  576.             blnRankExists = True
  577.             strSetRank = clanranks(x)
  578.             Exit For
  579.         End If
  580.         blnRankExists = False
  581.     Next
  582.    
  583.     If blnRankExists = True Then
  584.        
  585.         intFilePos = 0
  586.         blnNextRank = False
  587.        
  588.         Do While Not objReadFile.AtEndOfStream
  589.        
  590.             intFilePos = intFilePos + 1
  591.             intNumLines = NumLines
  592.             strLine = objReadFile.readline 'Read line
  593.                    
  594.             If strLine <> "" Then
  595.                 strFile = strFile & strLine
  596.                 If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  597.             End If
  598.            
  599.             If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  600.                 strSplit = Split(strLine, " ")
  601.                 strRank = Left(strSplit(0),Len(strSplit(0))-1)
  602.  
  603.                 If strRank = strSetRank Then
  604.                     blnNextRank = True
  605.                 ElseIf strRank <> strSetRank And blnNextRank = True Then
  606.                     intSetFilePos = intFilePos - 1
  607.                     blnNextRank = False
  608.                 End If
  609.                
  610.             End If
  611.            
  612.         Loop
  613.                
  614.         If intSetFilePos = "" Then
  615.             intSetFilePos = NumLines()
  616.         End If
  617.            
  618.         objReadFile.Close 'Close file
  619.  
  620.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  621.         strSplit = Split(strFile, vbcrlf)
  622.         For x = LBound(strSplit) To UBound(strSplit)
  623.             intCount = x + 1
  624.             If intCount = intSetFilePos Then
  625.                 objWriteFile.WriteLine(strSplit(x))
  626.                 objWriteFile.WriteLine(strSetRank & ": " & strMember)
  627.             Else
  628.                 objWriteFile.WriteLine(strSplit(x))
  629.             End If
  630.         Next
  631.  
  632.         objWriteFile.Close 'Close file
  633.        
  634.     End If
  635.  
  636. End Function
  637.  
  638. Function DelCMember(strMember)
  639.    
  640.     Dim objReadFile, objWriteFile, strLine
  641.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  642.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  643.    
  644.     blnWriteFile = False
  645.     Do While Not objReadFile.AtEndOfStream
  646.         strLine = objReadFile.readline 'Read line
  647.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  648.             strSplit = Split(strLine, " ")
  649.             If LCase(strSplit(1)) <> LCase(strMember) Then
  650.                 strFile = strFile & strLine & vbcrlf
  651.             End If
  652.             blnWriteFile = True
  653.         End If
  654.     Loop
  655.    
  656.     If blnWriteFile = True Then
  657.         objReadFile.Close 'Close file
  658.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  659.         strSplit = Split(strFile, vbcrlf)
  660.         For x = LBound(strSplit) To UBound(strSplit)
  661.             If strSplit(x) <> "" Then
  662.                 objWriteFile.WriteLine(strSplit(x))
  663.             End If
  664.         Next
  665.         DelCMember = True
  666.     End If
  667.    
  668. End Function
  669.  
  670. Function RemRankPos(strRank)
  671.  
  672.     Dim objReadFile, objWriteFile, strLine
  673.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  674.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  675.    
  676.     blnWriteFile = False
  677.     Do While Not objReadFile.AtEndOfStream
  678.         strLine = objReadFile.readline 'Read line
  679.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  680.             strSplit = Split(strLine, " ")
  681.             strRankFind = Left(strSplit(0),Len(strSplit(0))-1)
  682.             strUser = strSplit(1)
  683.             If LCase(strRankFind) = LCase(strRank) And LCase(strUser) = LCase("(OPEN)") And blnWriteFile = False Then
  684.                 'Do Nothing
  685.                 blnWriteFile = True
  686.             Else
  687.                 strFile = strFile & strLine & vbcrlf
  688.             End If
  689.         End If
  690.     Loop
  691.    
  692.     If blnWriteFile = True Then
  693.         objReadFile.Close 'Close file
  694.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  695.         strSplit = Split(strFile, vbcrlf)
  696.         For x = LBound(strSplit) To UBound(strSplit)
  697.             If strSplit(x) <> "" Then
  698.                 objWriteFile.WriteLine(strSplit(x))
  699.             End If
  700.         Next
  701.         RemRankPos = True
  702.     End If
  703.  
  704. End Function
  705.  
  706. Function FindRank(strRank)
  707.  
  708.     For x = LBound(clanranks) To UBound(clanranks)
  709.         If LCase(strRank) = LCase(clanranks(x)) Then
  710.             FindRank = clanranks(x)
  711.             Exit For
  712.         End If
  713.     Next
  714.    
  715. End Function
  716.  
  717. Function GetRankIndex(strMember)
  718.  
  719.     Dim objFile, strLine
  720.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  721.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  722.  
  723.     Do While Not objFile.AtEndOfStream
  724.         strLine = objFile.readline 'Read line
  725.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  726.             strSplit = Split(strLine," ")
  727.             If Lcase(strSplit(1)) = Lcase(strMember) Then
  728.                 strRankName = Left(strSplit(0),Len(strSplit(0))-1)
  729.                 Exit Do
  730.             End If
  731.         End If
  732.     Loop   
  733.     objFile.Close 'Close file
  734.    
  735.     For x = LBound(clanranks) To UBound(clanranks)
  736.         If LCase(strRankName) = LCase(clanranks(x)) Then
  737.             If strRankName = clanranks(x) Then
  738.                 GetRankIndex = x + 1
  739.                 Exit For
  740.             End If
  741.         End If
  742.     Next   
  743.    
  744. End Function
  745.    
  746. Function GetRank(strMember)
  747.  
  748.     Dim objFile, strLine
  749.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  750.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  751.    
  752.     Do While Not objFile.AtEndOfStream
  753.         strLine = objFile.readline 'Read line
  754.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  755.             strSplit = Split(strLine," ")
  756.             If Lcase(strSplit(1)) = Lcase(strMember) Then
  757.                 GetRank = Left(strSplit(0),Len(strSplit(0))-1)
  758.                 Exit Do
  759.             End If
  760.         End If
  761.     Loop
  762.    
  763.     objFile.Close 'Close file
  764.    
  765. End Function
  766.  
  767. Function GetRankNum()
  768.  
  769.     For x = LBound(clanranks) To UBound(clanranks)
  770.         strMessage = strMessage & clanranks(x) & ", "
  771.     Next
  772.  
  773. End Function
  774.  
  775. Function NumMembers() 'Count words in a specific dictionary
  776.  
  777.     Dim objFile, strLine
  778.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  779.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  780.    
  781.     strOpen = ""
  782.     intOpen = 0
  783.     intNumLines = 0
  784.    
  785.     Do While Not objFile.AtEndOfStream
  786.         strLine = objFile.readline 'Read line
  787.         If strLine <> "" Then
  788.             If LCase(Right(strLine, 6)) <> LCase("(OPEN)") Then
  789.                 intNumLines = intNumLines + 1 'Count lines
  790.             Else
  791.                 intOpen = intOpen + 1
  792.                 strSplit = Split(strLine," ")
  793.                 strOpen = strOpen & Left(strSplit(0),Len(strSplit(0))-1) & ", "
  794.             End If
  795.         End If
  796.     Loop
  797.    
  798.     objFile.Close 'Close file
  799.     NumMembers = intNumLines 'Exit function with number of lines in file
  800.  
  801. End Function
  802.  
  803. Function NumLines() 'Count words in a specific dictionary
  804.  
  805.     Dim objFile, strLine
  806.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  807.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  808.    
  809.     Do While Not objFile.AtEndOfStream
  810.         strLine = objFile.readline 'Read line
  811.         If strLine <> "" Then
  812.             intNumLines = intNumLines + 1 'Count lines
  813.         End If
  814.     Loop
  815.    
  816.     objFile.Close 'Close file
  817.     NumLines = intNumLines 'Exit function with number of lines in file
  818.  
  819. End Function
  820.  
  821. Function ListMembers() 'Fetch a word from a specific dictionary
  822.  
  823.     Dim objFile, strLine
  824.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  825.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  826.    
  827.     intNumLines = 0
  828.     Do While Not objFile.AtEndOfStream
  829.         strLine = objFile.readline 'Read line
  830.         If strLine <> "" Then
  831.             intNumLines = intNumLines + 1
  832.             strMembers = strMembers & "[" & intNumLines & "] " & strLine & vbcrlf
  833.         End If
  834.     Loop
  835.    
  836.     objFile.Close 'Close file
  837.     ListMembers = strMembers 'Exit function with Members
  838.    
  839. End Function
  840.  
  841. Function FormatTag()
  842.     intWilds = 0
  843.     For x = 1 To Len(clantag)
  844.         If Mid(clantag,x,1) = "*" Then
  845.             intWilds = intWilds + 1
  846.             If intWilds > 1 Then
  847.             Else
  848.                 strTag = strTag & Mid(clantag,x,1)
  849.             End If
  850.         Else
  851.             strTag = strTag & Mid(clantag,x,1)
  852.         End If
  853.     Next
  854.     clantag = strTag
  855. End Function
  856.  
  857. Function CheckTag(strUser)
  858.    
  859.     CheckTag = 0
  860.     If InStr(1, clantag, "*") > 0 Then
  861.  
  862.         strSplitTag = Split(clantag,"*")
  863.         intLeft = Len(strSplitTag(0))
  864.         intRight = Len(strSplitTag(1))
  865.         blnLeft = False : blnRight = False
  866.         For x = 1 To Len(strUser)
  867.             strFind = Mid(strUser,x,intLeft)
  868.             If LCase(strFind) = LCase(strSplitTag(0)) Then blnLeft = True
  869.             strFind = Mid(strUser,x,intRight)
  870.             If LCase(strFind) = LCase(strSplitTag(1)) Then blnRight = True
  871.         Next
  872.        
  873.         strLeftTag = Left(strUser,Len(strSplitTag(0)))
  874.         lenLeftTag = Len(strLeftTag)
  875.         strRightTag = Right(strUser,Len(strSplitTag(1)))
  876.         lenRightTag = Len(strRightTag)
  877.         strMember = Right(strUser, Len(strUser) - lenLeftTag)
  878.         strMember = Left(strMember, Len(strMember) - lenRightTag)
  879.        
  880.         If Left(clantag,1)  = "*" Then
  881.             strRestricted = Mid(clantag,2,1)
  882.             If Right(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
  883.         ElseIf Right(clantag,1)  = "*" Then
  884.             strRestricted = Mid(clantag,Len(clantag)-1,1)
  885.             If Left(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
  886.         Else
  887.             strRestricted1 = Right(strLeftTag,1)
  888.             strRestricted2 = Left(strRightTag,1)
  889.             If Left(strMember,1) = strRestricted1 Then CheckTag = 2 : Exit Function
  890.             If Right(strMember,1) = strRestricted2 Then CheckTag = 2 : Exit Function
  891.         End If
  892.                
  893.         If strMember <> Replace(clantag, "*", "") Then
  894.             strMember = strSplitTag(0) & strMember & strSplitTag(1)
  895.         Else
  896.             CheckTag = 2 : Exit Function
  897.         End If
  898.        
  899.         If LCase(strUser) = LCase(strMember) And blnLeft = True And blnRight = True Then CheckTag = 1
  900.  
  901.     End If
  902.    
  903. End Function
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top