SHARE
TWEET

Untitled

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