SHARE
TWEET

SB CLAN MANAGEMENT SCRIPT

a guest Aug 23rd, 2019 168 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 = "]*["
  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.                 If CheckTag(strUser) = 1 Then
  255.                     If FindRank(strSetRank) <> "" Then
  256.                         For x = LBound(clanranks) To UBound(clanranks)
  257.                             If LCase(strSetRank) = LCase(clanranks(x)) Then
  258.                                 strRankIndex = x + 1
  259.                                 Exit For
  260.                             End If
  261.                         Next
  262.                    
  263.                         strSupRank = GetRankIndex(Command.Username)
  264.  
  265.                         If strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then            
  266.                             If DelCMember(strUser) = True Then                         
  267.                                 Call AddCMember(strUser, strSetRank)
  268.                                 AddQ "[ADDED] " & strUser & " as rank " & strSetRank & " to Clan " & clantag & " members list."
  269.                             End If
  270.                         ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  271.                             AddQ "You cannot add a member to the same rank or higher."
  272.                         End If
  273.                        
  274.                     Else
  275.                         AddQ "The clanrank you specified is not valid."
  276.                     End If
  277.                 ElseIf CheckTag(strUser) = 2 Then
  278.                     AddQ "Cannot add member to Clan " & clantag & " members list. The username " & strUser & " is restricted."
  279.                 Else
  280.                    
  281.                     AddQ "Cannot add member to Clan " & clantag & " members list. " & strUser & " is not wearing clan tag."
  282.                 End If
  283.             End If
  284.         End If
  285.     End If
  286.    
  287.        
  288.     If LCase(Command.Name) = "rdel" Then
  289.    
  290.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  291.             strUser = Command.Args
  292.             strRank = GetRank(strUser)
  293.  
  294.             If strRank <> "" And LCase(strUser) <> LCase("(OPEN)") Then
  295.            
  296.                 strRankIndex = GetRankIndex(strUser)
  297.                 strSupRank = GetRankIndex(Command.Username)
  298.                
  299.                 If strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then            
  300.                     If DelCMember(strUser) = True Then
  301.                         AddQ "[REMOVED] " & strRank & ": " & strUser & " from Clan " & clantag & " members list."
  302.                     End If
  303.                 ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  304.                     AddQ "You cannot delete a member of same rank or higher."
  305.                 End If
  306.                
  307.             ElseIf strRank = "" Then
  308.                 AddQ "The member you are trying to delete is not in Clan " & clantag & " members list."
  309.             Else
  310.                 AddQ "You must specify a username."
  311.             End If
  312.            
  313.         Else
  314.    
  315.             strSplit = Split(Command.Args, " ") '2 or more args
  316.             strUser = strSplit(0)
  317.             strRank = GetRank(strUser)
  318.            
  319.             If strRank <> "" And LCase(strUser) <> LCase("(OPEN)") Then
  320.            
  321.                 strRankIndex = GetRankIndex(strUser)
  322.                 strSupRank = GetRankIndex(Command.Username)
  323.                
  324.                 If strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then            
  325.                     If DelCMember(strUser) = True Then
  326.                         AddQ "[REMOVED] " & strUser & " from Clan " & clantag & " members list."
  327.                     End If
  328.                 ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  329.                     AddQ "You cannot delete a member of same rank or higher."
  330.                 End If
  331.                
  332.             End If
  333.         End If
  334.        
  335.     End If
  336.    
  337.     If LCase(Command.Name) = "redit" Then
  338.    
  339.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  340.             AddQ "You must specify a username and a clanrank."
  341.         Else
  342.             strSplit = Split(Command.Args, " ") '2 or more args
  343.             strUser = strSplit(0)
  344.             strSetRank = strSplit(1)
  345.             If FindRank(strSetRank) <> "" Then
  346.                 strRank = GetRank(strUser)
  347.                 If strRank <> "" And strSetRank <> "" Then
  348.                     strSupRank = GetRankIndex(Command.Username)     '4
  349.                     strRankIndex = GetRankIndex(strUser)        '5
  350.  
  351.                     For x = LBound(clanranks) To UBound(clanranks)
  352.                         If LCase(strSetRank) = Lcase(clanranks(x)) Then
  353.                             strChangeRank = x + 1
  354.                             Exit For
  355.                         End If
  356.                     Next
  357.                    
  358.                     If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  359.                         If DelCMember(strUser) = True Then
  360.                             Call AddCMember(strUser, strSetRank)
  361.                             AddQ "[EDITED] " & strUser & " as rank " & strSetRank & " to Clan " & clantag & " members list."
  362.                         End If
  363.                     ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex And strChangeRank > strSupRank Then
  364.                         If DelCMember(strUser) = True Then
  365.                             Call AddCMember(strUser, strSetRank)
  366.                             AddQ "[EDITED] " & strUser & " as rank " & strSetRank & " to Clan " & clantag & " members list."
  367.                         End If
  368.                     ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  369.                         AddQ "You cannot edit a member of same rank or higher."
  370.                     ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank = strChangeRank Then
  371.                         AddQ "You cannot edit a member to the same rank or higher."
  372.                     Else
  373.                         AddQ "The member you are trying to edit is not in Clan " & clantag & " members list."
  374.                     End If
  375.  
  376.                 Else
  377.                     AddQ "The member you are trying to edit is not in Clan " & clantag & " members list."
  378.                 End If
  379.             Else
  380.                 AddQ "You specified an invalid clanrank."
  381.             End If
  382.         End If
  383.     End If 
  384.    
  385.     If LCase(Command.Name) = "rpromote" Then
  386.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  387.             strUser = Command.Args
  388.             strRankIndex = GetRankIndex(strUser)
  389.             strSupRank = GetRankIndex(Command.Username)    
  390.  
  391.             If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  392.                 PromoteCMember(strUser)
  393.                 strRank = GetRank(strUser)
  394.                 AddQ strUser & " has been promoted to rank " & strRank
  395.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < (strRankIndex - 1) Then
  396.                 PromoteCMember(strUser)
  397.                 strRank = GetRank(strUser)
  398.                 AddQ strUser & " has been promoted to rank " & strRank
  399.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  400.                 AddQ "You cannot promote a member of same rank or higher."
  401.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= (strRankIndex - 1) Then
  402.                 AddQ "You cannot promote a member to the same rank or higher."
  403.             ElseIf Command.Args = "" Then
  404.                 AddQ "You must specify a member to promote."
  405.             Else
  406.                 AddQ "The member you are trying to promote is not in Clan " & clantag & " members list."
  407.             End If 
  408.            
  409.         Else
  410.             strSplit = Split(Command.Args, " ") '2 or more args
  411.             strUser = strSplit(0)
  412.             strRankIndex = GetRankIndex(strUser)
  413.             strSupRank = GetRankIndex(Command.Username)
  414.  
  415.             If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  416.                 PromoteCMember(strUser)
  417.                 strRank = GetRank(strUser)
  418.                 AddQ strUser & " has been promoted to rank " & strRank
  419.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < (strRankIndex - 1) Then
  420.                 PromoteCMember(strUser)
  421.                 strRank = GetRank(strUser)
  422.                 AddQ strUser & " has been promoted to rank " & strRank
  423.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
  424.                 AddQ "You cannot promote a member of same rank or higher."
  425.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= (strRankIndex - 1) Then
  426.                 AddQ "You cannot promote a member to the same rank or higher."
  427.             ElseIf Command.Args = "" Then
  428.                 AddQ "You must specify a member to promote."
  429.             Else
  430.                 AddQ "The member you are trying to promote is not in Clan " & clantag & " members list."
  431.             End If 
  432.  
  433.         End If
  434.  
  435.     End If 
  436.    
  437.     If LCase(Command.Name) = "rdemote" Then
  438.    
  439.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  440.             strUser = Command.Args
  441.             strRankIndex = GetRankIndex(strUser)
  442.             strSupRank = GetRankIndex(Command.Username)
  443.  
  444.             If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  445.                 DemoteCMember(strUser)
  446.                 strRank = GetRank(strUser)
  447.                 AddQ strUser & " has been demoted to rank " & strRank
  448.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  449.                 DemoteCMember(strUser)
  450.                 strRank = GetRank(strUser)
  451.                 AddQ strUser & " has been demoted to rank " & strRank
  452.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  453.                 AddQ "You cannot demote a member of same rank or higher."
  454.             ElseIf Command.Args = "" Then
  455.                 AddQ "You must specify a member to demote."
  456.             Else
  457.                 AddQ "The member you are trying to demote is not in Clan " & clantag & " members list."
  458.             End If
  459.            
  460.         Else
  461.        
  462.             strSplit = Split(strArgs, " ") '2 or more args
  463.             strUser = strSplit(0)
  464.             strRankIndex = GetRankIndex(strUser)
  465.             strSupRank = GetRankIndex(Username)
  466.            
  467.             If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  468.                 DemoteCMember(strUser)
  469.                 strRank = GetRank(strUser)
  470.                 AddQ strUser & " has been demoted to rank " & strRank
  471.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
  472.                 DemoteCMember(strUser)
  473.                 strRank = GetRank(strUser)
  474.                 AddQ strUser & " has been demoted to rank " & strRank
  475.             ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
  476.                 AddQ "You cannot demote a member of same rank or higher."
  477.             ElseIf Command.Args = "" Then
  478.                 AddQ "You must specify a member to demote."
  479.             Else
  480.                 AddQ "The member you are trying to demote is not in Clan " & clantag & " members list."
  481.             End If
  482.  
  483.         End If
  484.     End If
  485.  
  486.    
  487.     If LCase(Command.Name) = "ropen" Then
  488.    
  489.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  490.             strRank = Command.Args
  491.             If LCase(strRank) = LCase(FindRank(strRank)) And strRank <> "" Then
  492.                 Call AddCMember("(OPEN)", strRank)
  493.                 AddQ "[ADDED] " & strRank & " open-position to Clan " & clantag & " members list."
  494.             Else
  495.                 AddQ "You must specify a clanrank to open a position. Try " & BotVars.Trigger & "ropen clanrank"
  496.             End If
  497.         Else
  498.             strSplit = Split(Command.Args, " ") '2 or more args
  499.             strRank = strSplit(0)
  500.             If LCase(strRank) = LCase(FindRank(strRank)) And strRank <> "" Then
  501.                 Call AddCMember("(OPEN)", strRank)
  502.                 AddQ "[ADDED] " & strRank & " open-position to Clan " & clantag & " members list."
  503.             Else
  504.                 AddQ "You must specify a clanrank to open a position. Try " & BotVars.Trigger & "ropen clanrank"
  505.             End If
  506.         End If
  507.        
  508.     End If
  509.  
  510.     If LCase(Command.Name) = "rclose" Then
  511.    
  512.         If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
  513.             strRank = Command.Args
  514.             If LCase(strRank) = LCase(FindRank(strRank)) And strRank <> "" Then
  515.                 If RemRankPos(strRank) = True Then
  516.                     AddQ "[REMOVED] " & strRank & " open-position removed from Clan " & clantag & " members list."
  517.                 End If
  518.             Else
  519.                 AddQ "You must specify a clanrank to remove an open position. Try " & BotVars.Trigger & "rclose clanrank"
  520.             End If
  521.         Else
  522.             strSplit = Split(Command.Args, " ") '2 or more args
  523.             strRank = strSplit(0)
  524.             If LCase(strRank) = LCase(FindRank(strRank)) And strRank <> "" Then
  525.                 If RemRankPos(strRank) = True Then
  526.                     AddQ "[REMOVED] " & strRank & " open-position removed from Clan " & clantag & " members list."
  527.                 End If
  528.             Else
  529.                 AddQ "You must specify a clanrank to remove an open position. Try " & BotVars.Trigger & "rclose clanrank"
  530.             End If
  531.         End If
  532.     End If
  533.    
  534. End Sub
  535.  
  536. Function PromoteCMember(strMember)
  537.    
  538.     strRankIndex = GetRankIndex(strMember)
  539.     For x = LBound(clanranks) To UBound(clanranks)
  540.         If x = strRankIndex - 1 Then
  541.             If x <> LBound(clanranks) Then
  542.                 DelCMember(strMember)
  543.                 Call AddCMember(strMember, clanranks(x-1))
  544.                 Exit For
  545.             End If
  546.         End If
  547.     Next
  548.    
  549. End Function
  550.  
  551. Function DemoteCMember(strMember)
  552.  
  553.     strRankIndex = GetRankIndex(strMember)
  554.     For x = LBound(clanranks) To UBound(clanranks)
  555.         If x = strRankIndex - 1 Then
  556.             If x <> UBound(clanranks) Then
  557.                 DelCMember(strMember)
  558.                 Call AddCMember(strMember, clanranks(x+1))
  559.                 Exit For
  560.             End If
  561.         End If
  562.     Next
  563.  
  564. End Function
  565.  
  566. Function AddCMember(strMember, strSetRank)
  567.  
  568.     Dim objReadFile, objWriteFile, strLine
  569.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  570.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  571.        
  572.     For x = LBound(clanranks) To UBound(clanranks)
  573.         If LCase(strSetRank) = LCase(clanranks(x)) Then
  574.             intPrevRankPos = x + 1
  575.             blnRankExists = True
  576.             strSetRank = clanranks(x)
  577.             Exit For
  578.         End If
  579.         blnRankExists = False
  580.     Next
  581.    
  582.     If blnRankExists = True Then
  583.        
  584.         intFilePos = 0
  585.         blnNextRank = False
  586.        
  587.         Do While Not objReadFile.AtEndOfStream
  588.        
  589.             intFilePos = intFilePos + 1
  590.             intNumLines = NumLines
  591.             strLine = objReadFile.readline 'Read line
  592.                    
  593.             If strLine <> "" Then
  594.                 strFile = strFile & strLine
  595.                 If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
  596.             End If
  597.            
  598.             If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  599.                 strSplit = Split(strLine, " ")
  600.                 strRank = Left(strSplit(0),Len(strSplit(0))-1)
  601.  
  602.                 'If intFilePos = intPrevRankPos Then
  603.                 '   intSetFilePos = intFilePos
  604.                 'End If
  605.  
  606.                 If strRank = strSetRank Then
  607.                     blnNextRank = True
  608.                 ElseIf strRank <> strSetRank And blnNextRank = True Then
  609.                     intSetFilePos = intFilePos - 1
  610.                     blnNextRank = False
  611.                 End If
  612.                
  613.             End If
  614.            
  615.         Loop
  616.                
  617.         If intSetFilePos = "" Then
  618.             intSetFilePos = NumLines()
  619.         End If
  620.            
  621.         objReadFile.Close 'Close file
  622.  
  623.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  624.         strSplit = Split(strFile, vbcrlf)
  625.         For x = LBound(strSplit) To UBound(strSplit)
  626.             intCount = x + 1
  627.             If intCount = intSetFilePos Then
  628.                 objWriteFile.WriteLine(strSplit(x))
  629.                 objWriteFile.WriteLine(strSetRank & ": " & strMember)
  630.             Else
  631.                 objWriteFile.WriteLine(strSplit(x))
  632.             End If
  633.         Next
  634.  
  635.         objWriteFile.Close 'Close file
  636.        
  637.     End If
  638.  
  639. End Function
  640.  
  641. Function DelCMember(strMember)
  642.    
  643.     Dim objReadFile, objWriteFile, strLine
  644.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  645.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  646.    
  647.     blnWriteFile = False
  648.     Do While Not objReadFile.AtEndOfStream
  649.         strLine = objReadFile.readline 'Read line
  650.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  651.             strSplit = Split(strLine, " ")
  652.             If LCase(strSplit(1)) <> LCase(strMember) Then
  653.                 strFile = strFile & strLine & vbcrlf
  654.             End If
  655.             blnWriteFile = True
  656.         End If
  657.     Loop
  658.    
  659.     If blnWriteFile = True Then
  660.         objReadFile.Close 'Close file
  661.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  662.         strSplit = Split(strFile, vbcrlf)
  663.         For x = LBound(strSplit) To UBound(strSplit)
  664.             If strSplit(x) <> "" Then
  665.                 objWriteFile.WriteLine(strSplit(x))
  666.             End If
  667.         Next
  668.         DelCMember = True
  669.     End If
  670.    
  671. End Function
  672.  
  673. Function RemRankPos(strRank)
  674.  
  675.     Dim objReadFile, objWriteFile, strLine
  676.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  677.     Set objReadFile= objFSO.OpenTextFile(members_list, 1)
  678.    
  679.     blnWriteFile = False
  680.     Do While Not objReadFile.AtEndOfStream
  681.         strLine = objReadFile.readline 'Read line
  682.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  683.             strSplit = Split(strLine, " ")
  684.             strRankFind = Left(strSplit(0),Len(strSplit(0))-1)
  685.             strUser = strSplit(1)
  686.             If LCase(strRankFind) = LCase(strRank) And LCase(strUser) = LCase("(OPEN)") And blnWriteFile = False Then
  687.                 'Do Nothing
  688.                 blnWriteFile = True
  689.             Else
  690.                 strFile = strFile & strLine & vbcrlf
  691.             End If
  692.         End If
  693.     Loop
  694.    
  695.     If blnWriteFile = True Then
  696.         objReadFile.Close 'Close file
  697.         Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
  698.         strSplit = Split(strFile, vbcrlf)
  699.         For x = LBound(strSplit) To UBound(strSplit)
  700.             If strSplit(x) <> "" Then
  701.                 objWriteFile.WriteLine(strSplit(x))
  702.             End If
  703.         Next
  704.         RemRankPos = True
  705.     End If
  706.  
  707. End Function
  708.  
  709. Function FindRank(strRank)
  710.  
  711.     For x = LBound(clanranks) To UBound(clanranks)
  712.         If LCase(strRank) = LCase(clanranks(x)) Then
  713.             FindRank = clanranks(x)
  714.             Exit For
  715.         End If
  716.     Next
  717.    
  718. End Function
  719.  
  720. Function GetRankIndex(strMember)
  721.  
  722.     Dim objFile, strLine
  723.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  724.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  725.  
  726.     Do While Not objFile.AtEndOfStream
  727.         strLine = objFile.readline 'Read line
  728.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  729.             strSplit = Split(strLine," ")
  730.             If Lcase(strSplit(1)) = Lcase(strMember) Then
  731.                 strRankName = Left(strSplit(0),Len(strSplit(0))-1)
  732.                 Exit Do
  733.             End If
  734.         End If
  735.     Loop   
  736.     objFile.Close 'Close file
  737.    
  738.     For x = LBound(clanranks) To UBound(clanranks)
  739.         If LCase(strRankName) = LCase(clanranks(x)) Then
  740.             If strRankName = clanranks(x) Then
  741.                 GetRankIndex = x + 1
  742.                 Exit For
  743.             End If
  744.         End If
  745.     Next   
  746.    
  747. End Function
  748.    
  749. Function GetRank(strMember)
  750.  
  751.     Dim objFile, strLine
  752.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  753.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  754.    
  755.     Do While Not objFile.AtEndOfStream
  756.         strLine = objFile.readline 'Read line
  757.         If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
  758.             strSplit = Split(strLine," ")
  759.             If Lcase(strSplit(1)) = Lcase(strMember) Then
  760.                 GetRank = Left(strSplit(0),Len(strSplit(0))-1)
  761.                 Exit Do
  762.             End If
  763.         End If
  764.     Loop
  765.    
  766.     objFile.Close 'Close file
  767.    
  768. End Function
  769.  
  770. Function GetRankNum()
  771.  
  772.     For x = LBound(clanranks) To UBound(clanranks)
  773.         strMessage = strMessage & clanranks(x) & ", "
  774.     Next
  775.  
  776. End Function
  777.  
  778. Function NumMembers() 'Count words in a specific dictionary
  779.  
  780.     Dim objFile, strLine
  781.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  782.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  783.    
  784.     strOpen = ""
  785.     intOpen = 0
  786.     intNumLines = 0
  787.    
  788.     Do While Not objFile.AtEndOfStream
  789.         strLine = objFile.readline 'Read line
  790.         If strLine <> "" Then
  791.             If LCase(Right(strLine, 6)) <> LCase("(OPEN)") Then
  792.                 intNumLines = intNumLines + 1 'Count lines
  793.             Else
  794.                 intOpen = intOpen + 1
  795.                 strSplit = Split(strLine," ")
  796.                 strOpen = strOpen & Left(strSplit(0),Len(strSplit(0))-1) & ", "
  797.             End If
  798.         End If
  799.     Loop
  800.    
  801.     objFile.Close 'Close file
  802.     NumMembers = intNumLines 'Exit function with number of lines in file
  803.  
  804. End Function
  805.  
  806. Function NumLines() 'Count words in a specific dictionary
  807.  
  808.     Dim objFile, strLine
  809.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  810.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  811.    
  812.     Do While Not objFile.AtEndOfStream
  813.         strLine = objFile.readline 'Read line
  814.         If strLine <> "" Then
  815.             intNumLines = intNumLines + 1 'Count lines
  816.         End If
  817.     Loop
  818.    
  819.     objFile.Close 'Close file
  820.     NumLines = intNumLines 'Exit function with number of lines in file
  821.  
  822. End Function
  823.  
  824. Function ListMembers() 'Fetch a word from a specific dictionary
  825.  
  826.     Dim objFile, strLine
  827.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  828.     Set objFile= objFSO.OpenTextFile(members_list, 1)
  829.    
  830.     intNumLines = 0
  831.     Do While Not objFile.AtEndOfStream
  832.             intNumLines = intNumLines + 1
  833.             strLine = objFile.readline 'Read line
  834.             If strLine <> "" Then
  835.                 strMembers = strMembers & "[" & intNumLines & "] " & strLine & vbcrlf
  836.             End If
  837.     Loop
  838.    
  839.     objFile.Close 'Close file
  840.     ListMembers = strMembers 'Exit function with Members
  841.    
  842. End Function
  843.  
  844. Function FormatTag()
  845.     intWilds = 0
  846.     For x = 1 To Len(clantag)
  847.         If Mid(clantag,x,1) = "*" Then
  848.             intWilds = intWilds + 1
  849.             If intWilds > 1 Then
  850.             Else
  851.                 strTag = strTag & Mid(clantag,x,1)
  852.             End If
  853.         Else
  854.             strTag = strTag & Mid(clantag,x,1)
  855.         End If
  856.     Next
  857.     clantag = strTag
  858. End Function
  859.  
  860. Function CheckTag(strUser)
  861.    
  862.     CheckTag = 0
  863.     If InStr(1, clantag, "*") > 0 Then
  864.  
  865.         strSplitTag = Split(clantag,"*")
  866.         intLeft = Len(strSplitTag(0))
  867.         intRight = Len(strSplitTag(1))
  868.         blnLeft = False : blnRight = False
  869.         For x = 1 To Len(strUser)
  870.             strFind = Mid(strUser,x,intLeft)
  871.             If LCase(strFind) = LCase(strSplitTag(0)) Then blnLeft = True
  872.             strFind = Mid(strUser,x,intRight)
  873.             If LCase(strFind) = LCase(strSplitTag(1)) Then blnRight = True
  874.         Next
  875.        
  876.         strLeftTag = Left(strUser,Len(strSplitTag(0)))
  877.         lenLeftTag = Len(strLeftTag)
  878.         strRightTag = Right(strUser,Len(strSplitTag(1)))
  879.         lenRightTag = Len(strRightTag)
  880.         strMember = Right(strUser, Len(strUser) - lenLeftTag)
  881.         strMember = Left(strMember, Len(strMember) - lenRightTag)
  882.        
  883.         If Left(clantag,1)  = "*" Then
  884.             strRestricted = Mid(clantag,2,1)
  885.             If Right(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
  886.         ElseIf Right(clantag,1)  = "*" Then
  887.             strRestricted = Mid(clantag,Len(clantag)-1,1)
  888.             If Left(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
  889.         Else
  890.             strRestricted1 = Right(strLeftTag,1)
  891.             strRestricted2 = Left(strRightTag,1)
  892.             If Left(strMember,1) = strRestricted1 Then CheckTag = 2 : Exit Function
  893.             If Right(strMember,1) = strRestricted2 Then CheckTag = 2 : Exit Function
  894.         End If
  895.                
  896.         If strMember <> Replace(clantag, "*", "") Then
  897.             strMember = strSplitTag(0) & strMember & strSplitTag(1)
  898.         Else
  899.             CheckTag = 2 : Exit Function
  900.         End If
  901.        
  902.         If LCase(strUser) = LCase(strMember) And blnLeft = True And blnRight = True Then CheckTag = 1
  903.  
  904.     End If
  905.    
  906. 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