SHARE
TWEET

Untitled

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