SCripts anyone?
5 posters
:: Trash Can
Page 1 of 1
SCripts anyone?
- Code:
If GetSettingsEntry("dsllLimit") = vbNullString Then
WriteSettingsEntry "'// For all settings that have a True or False, True enables the setting, False disables the setting. Do not remove the True/False, simply put one or the other.", vbNullString
WriteSettingsEntry "'// This setting will determine how many backups of the CRS database you want to keep; -1 = unlimited, 0 = disable this feature", vbNullString
WriteSettingsEntry "'// Any other number will reflect how many backups will be in the folder. Once that limit is reached, the script will start deleting the oldest backup to make room.", vbNullString
WriteSettingsEntry "'// When the bot closes or you reload the script, the CRS script will make a backup into a directory called CRS DB Backups.", vbNullString
WriteSettingsEntry "backupNum", -1
WriteSettingsEntry "'// Clan Name.", vbNullString
WriteSettingsEntry "clan_name", "Black Hand Assassins"
WriteSettingsEntry "'// Enable CRS auto-access so when users are promoted to different ranks, their access will be automatically adjusted according to each rank's access setting.", vbNullString
WriteSettingsEntry "aa_on", False
WriteSettingsEntry "'// Set autoadd_tag_on to True to automatically add members to the database with a certain tag in their name (autoadd_tag).", vbNullString
WriteSettingsEntry "autoadd_tag_on", False
WriteSettingsEntry "autoadd_tag", "(BHA)"
WriteSettingsEntry "'// Demotes users with X days of last logging into the channel.", vbNullString
WriteSettingsEntry "dsllLimit", 10
WriteSettingsEntry "'// Enable auto-demote based on days of last channel log in.", vbNullString
WriteSettingsEntry "dsll_on", True
WriteSettingsEntry "'// Every X days (dayIncrement) in the clan, users will be promoted starting from the numerical rank of dayLowRank, stopping at dayHighRank", vbNullString
WriteSettingsEntry "'// Disable this system by setting dayPromote_on to False", vbNullString
WriteSettingsEntry "dayPromote_on", True
WriteSettingsEntry "dayHighRank", 7
WriteSettingsEntry "dayLowRank", 12
WriteSettingsEntry "dayIncrement", 5
WriteSettingsEntry "'// For every X recruits recruited (recruitIncrement), users will be promoted starting from the numerical rank of recruitLowRank, stopping at recruitHighRank", vbNullString
WriteSettingsEntry "'// Disable this system by setting recruitPromote_on to False", vbNullString
WriteSettingsEntry "recruitPromote_on", True
WriteSettingsEntry "recruitHighRank", 6
WriteSettingsEntry "recruitLowRank", 4
WriteSettingsEntry "recruitIncrement", 5
WriteSettingsEntry "'// Member greet display type; 1 - all chat, 2 - emote, 3 - whisper", vbNullString
WriteSettingsEntry "m_greet_dsp", 3
WriteSettingsEntry "'// Non-member greet display type; 1 - all chat, 2 - emote, 3 - whisper", vbNullString
WriteSettingsEntry "nm_greet_dsp", 3
WriteSettingsEntry "'// Member greet enabled?", vbNullString
WriteSettingsEntry "m_greet_on", True
WriteSettingsEntry "'// Non-member greet enabled?", vbNullString
WriteSettingsEntry "nm_greet_on", True
WriteSettingsEntry "'// Member greet message.", vbNullString
WriteSettingsEntry "m_greet", "Welcome back, %0. You are ranked %u - %r. You have %a Access."
WriteSettingsEntry "'// Non-member greet message.", vbNullString
WriteSettingsEntry "nm_greet", "Welcome %0 to %c. Your ping is %pms."
WriteSettingsEntry "'// Anti-flood settings for the greet message.", vbNullString
WriteSettingsEntry "'// greet_bufferTime - If users join within these seconds, they will not be greeted.", vbNullString
WriteSettingsEntry "'// greet_coolDown - Users will need to wait these amount of seconds before they will be greeted again. 1800 sec = 30 mins", vbNullString
WriteSettingsEntry "'// greet_queueExit - If the queue load gets to this number, the bot will not greet until the queue decreases.", vbNullString
WriteSettingsEntry "greet_bufferTime", 7
WriteSettingsEntry "greet_coolDown", 1800
WriteSettingsEntry "greet_queueExit", 4
WriteSettingsEntry "'// Rank specific greet messages.", vbNullString
WriteSettingsEntry "***", "***"
Call CleanINI()
End If
AddChat 16759296, "CRS Script:. ", 10682112, "Checking commands and creating if neccesary ... This may take a few minutes; ignore the Script-Control pop-up."
Call CreateCmds()
'// Database exists?
crsDatabasePath = BotPath() & "MemberData.mdb"
Set crsFSO = CreateObject("Scripting.FileSystemObject")
If Not crsFSO.FileExists(crsDatabasePath) Then
AddChat 16759296, "Welcome to the Clan Rank Script! You can customize the number and names of existing ranks inside crsClanRankScript.txt"
AddChat 16759296, "Please note that all changes to the ", vbRed, "NUMBER OF EXISTING RANKS", vbCyan, " should be made ", vbRed, "BEFORE", vbCyan, " you start adding members!"
AddChat 16759296, "You may customize the access level for each rank inside crsClanRankScript.txt"
AddChat 10682112, "For help on common CRS questions and issues, visit:"
AddChat 10682112, "[url=http://www.stealthbot.net/forum/index.php?/topic/368-clan-rank-script-faqs-crs/]http://www.stealthbot.net/forum/index.php?/topic/368-clan-rank-script-faqs-crs/[/url]"
crs_create_database '// Create the database
Else
crs_connect '// Connect to database
End If
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members`")
If rs.Fields(0) = 0 Then
'// No one is in the Database, so add the bot's username as the first user
crsConn.Execute("INSERT INTO `members` (`name`, `rank`, `previous_rank`, `promoter_name`, `promotion_date`, `join_date`, `reason`, `time_logged`, `last_active`, `recruiter`) " & _
"Values ('" & BotVars.Username & "', " & 1 & ", " & 1 & ", '" & BotVars.Username & "', '" & Now & "', '" & Now & "', 'Bot Console', " & 0 & ", '0', '" & BotVars.Username & "')")
AddChat 16759296, "CRS Script:. ", 10682112, "Bot console has been added as the first member in your CRS database. Console is now able to add other users and perform CRS commands."
End If
Call CreateObj("LongTimer", "Check_dsll")
Check_dsll.Enabled = True
Check_dsll.Interval = 720
Set crsUsers = CreateObject("Scripting.Dictionary")
crsUsers.CompareMode = 1
Set crsGreetUsers = CreateObject("Scripting.Dictionary")
crsGreetUsers.CompareMode = 1
crsLastGreet = Now -1
End Sub
Sub Event_Userjoins(Username, Flags, Message, Ping, Product, Level, OriginalStatString, Banned)
'// Get user's rank data
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name`='" & Username & "'")
If rs.Fields(0) <> 0 Then
Set rs = crsConn.Execute("SELECT * FROM `members` WHERE `name`='" & Username & "'")
rank = rs.Fields(1)
reason = rs.Fields(6)
'// Update last active date/time
crsConn.Execute("UPDATE `members` SET `last_active` = '" & Now() & "' WHERE `name`='" & Username & "'")
AutoPromote(Username)
crsUsers.Item(Username) = Now
Else
If GetSettingsEntry("autoadd_tag_on") Then
If InStr(Username, GetSettingsEntry("autoadd_tag")) > 0 Then
If LCase(crsRanks(UBound(crsRanks)-1)) = "banned" Then
nRank = UBound(crsRanks)-2
Else
nRank = UBound(crsRanks)-1
End If
crsConn.Execute("INSERT INTO `members` (`name`, `rank`, `previous_rank`, `promoter_name`, `promotion_date`, `join_date`, `reason`, `time_logged`, `last_active`, `recruiter`) " & _
"Values ('" & Username & "', " & nRank & ", " & nRank & ", '" & BotVars.Username & "', '" & Now & "', '" & Now & "', 'Automatically added due to tag in name.', " & 0 & ", '0', '" & BotVars.Username & "')")
AddChat 16759296, "CRS Script:. ", 10682112, Username & " was added to the database for having "" " & GetSettingsEntry("autoadd_tag") & " "" within their name."
Else
rank = 0
End If
Else
rank = 0
End If
End If
'// Replace greet variables
If rank > 0 Then
If LCase(crsRanks(rank)) = "banned" Then
Command BotVars.Username, "/ipban " & Username & " " & reason, True
Exit Sub
End If
If NOT GetSettingsEntry("m_greet_on") Then Exit Sub
If GetSettingsEntry(rank) = vbNullString Then
strRankGreet = GetSettingsEntry("m_greet")
Else
strRankGreet = GetSettingsEntry(rank)
End If
Else
If NOT GetSettingsEntry("nm_greet_on") Then Exit Sub
strRankGreet = GetSettingsEntry("nm_greet")
End If
strRankGreet = Replace(strRankGreet, "%0", Username)
strRankGreet = Replace(strRankGreet, "%r", crsRanks(rank))
strRankGreet = Replace(strRankGreet, "%u", CInt(rank))
strRankGreet = Replace(strRankGreet, "%m", GetDBMembers(0))
strRankGreet = Replace(strRankGreet, "%n", GetSettingsEntry("clan_name"))
strRankGreet = Replace(strRankGreet, "%c", myChannel)
strRankGreet = Replace(strRankGreet, "%1", BotVars.Username)
strRankGreet = Replace(strRankGreet, "%t", Time)
strRankGreet = Replace(strRankGreet, "%d", Date)
strRankGreet = Replace(strRankGreet, "%v", ssc.GetBotVersion())
strRankGreet = Replace(strRankGreet, "%a", GetDBEntry(Username).Rank)
strRankGreet = Replace(strRankGreet, "%f", GetDBEntry(Username).Flags)
strRankGreet = Replace(strRankGreet, "%p", Ping)
'// Display greeting
If GetQueueSize => CInt(GetSettingsEntry("greet_queueExit")) Then Exit Sub
addchat vbGreen, "crsLastGreet: " & DateDiff("s", crsLastGreet, Now) & " < " & CInt(GetSettingsEntry("greet_bufferTime"))
If DateDiff("s", crsLastGreet, Now) < CInt(GetSettingsEntry("greet_bufferTime")) Then Exit Sub
If crsGreetUsers.Exists(Username) Then
If DateDiff("s", crsGreetUsers.Item(Username), Now) < CInt(GetSettingsEntry("greet_coolDown")) Then Exit Sub
If rank > 0 Then
dspId = GetSettingsEntry("m_greet_dsp")
Select Case dspId
Case 1: AddQ strRankGreet
Case 2: AddQ "/me " & strRankGreet
Case 3: AddQ "/w " & Username & " " & strRankGreet
End Select
Else
dspId = GetSettingsEntry("nm_greet_dsp")
Select Case dspId
Case 1: AddQ strRankGreet
Case 2: AddQ "/me " & strRankGreet
Case 3: AddQ "/w " & Username & " " & strRankGreet
End Select
End If
crsGreetUsers.Item(Username) = Now
Else
If rank > 0 Then
dspId = GetSettingsEntry("m_greet_dsp")
Select Case dspId
Case 1: AddQ strRankGreet
Case 2: AddQ "/me " & strRankGreet
Case 3: AddQ "/w " & Username & " " & strRankGreet
End Select
Else
dspId = GetSettingsEntry("nm_greet_dsp")
Select Case dspId
Case 1: AddQ strRankGreet
Case 2: AddQ "/me " & strRankGreet
Case 3: AddQ "/w " & Username & " " & strRankGreet
End Select
End If
crsGreetUsers.Item(Username) = Now
End If
crsLastGreet = Now
End Sub
Sub Event_UserLeaves(Username, Flags)
If crsUsers.Exists(Username) Then
crsConn.Execute("UPDATE `members` SET `time_logged` = `time_logged` +" & DateDiff("s", crsUsers.Item(Username), Now) & " WHERE `name` = '" & Username & "'")
crsUsers.Remove Username
End If
End Sub
Sub Event_Close()
'// Close DB Connection
AddChat 16759296, "CRS Script:. ", 10682112, "Closing Database connection."
crsConn.Close
'// Create a backup of the database
temp = Int(GetSettingsEntry("backupNum"))
If temp <> 0 Then
AddChat 16759296, "CRS Script:. ", 10682112, "Creating backup of current database."
'// Make our backup folder
backFolder = BotPath & "CRS Database Backups"
If NOT crsFSO.FolderExists(backFolder) Then crsFSO.CreateFolder(backFolder)
'// Unlimited backups allowed
If temp = -1 Then
Set Folder = crsFSO.GetFolder(backFolder)
'// If there are no files in the folder, create the first one
If Folder.Files.Count = 0 Then
tFile = backFolder & "MemberData (1).mdb"
Set File = crsFSO.GetFile(crsDatabasePath)
File.Copy(tFile)
Else
'// Find the highest appeneded number and set the new file to +1
highestAppend = 0
For Each f In Folder.Files
appendNum = Int(Split(Split(f.Name, "(")(1), ")")(0))
If appendNum > highestAppend Then highestAppend = appendNum
Next
Set File = crsFSO.GetFile(crsDatabasePath)
File.Copy(backFolder & "MemberData (" & highestAppend+1 & ").mdb")
End If
Else
Set Folder = crsFSO.GetFolder(backFolder)
If Folder.Files.Count >= temp Then
oldFile = 0
fName = vbNullString
highestAppend = 0
For Each f In Folder.Files
dDiff = DateDiff("s", f.DateCreated, Now)
appendNum = Int(Split(Split(f.Name, "(")(1), ")")(0))
If appendNum > highestAppend Then highestAppend = appendNum
If dDiff > oldFile Then
oldFile = dDiff
fName = f.Name
End If
Next
tFile = backFolder & "MemberData (" & highestAppend+1 & ").mdb"
crsFSO.DeleteFile(backFolder & fName)
Set File = crsFSO.GetFile(crsDatabasePath)
File.Copy(tFile)
Else
Set File = crsFSO.GetFile(crsDatabasePath)
tFile = backFolder & "MemberData (1).mdb"
Set Folder = crsFSO.GetFolder(backFolder)
If Folder.Files.Count = 0 Then
tFile = backFolder & "MemberData (" & Folder.Files.Count+1 & ").mdb"
File.Copy(tFile)
Exit Sub
End If
'// If a backup already exists, append a #
i = Folder.Files.Count
Do
If crsFSO.FileExists(tFile) Then
i=i+1
tFile = backFolder & "MemberData (" & i & ").mdb"
Else
nFound = True
End If
Loop While nFound
File.Copy(tFile)
End If
End If
End If
End Sub
Public Sub Event_Command(Command)
'// This makes it so you can use the commands while offline
If Command.IsLocal Then Command.Username = BotVars.Username
Select Case LCase(Command.Name)
Case "crsadmin": Call crsadminCmd(Command, Command.Username)
Case "crscmds": Call crsCmdsCmd(Command, Command.Username)
Case "crsdemote": Call crsdemoteCmd(Command, Command.Username)
Case "crsdisable": Call crsdisableCmd(Command, Command.Username)
Case "crsgreet": Call crsgreetCmd(Command, Command.Username)
Case "crsmeminfo": Call crsmeminfoCmd(Command, Command.Username)
Case "crspromote": Call crspromoteCmd(Command, Command.Username)
Case "crsqranks": Call crsqranksCmd(Command, Command.Username)
Case "crsrank": Call crsrankCmd(Command, Command.Username)
Case "crsrankinfo": Call crsrankinfoCmd(Command, Command.Username)
Case "crsrankstats": Call crsrankstatsCmd(Command, Command.Username)
Case "crsremove": Call crsremoveCmd(Command, Command.Username)
Case "crsrestore": Call crsrestoreCmd(Command, Command.Username)
Case "crsset": Call crssetCmd(Command, Command.Username)
End Select
End Sub
Sub Check_dsll_Timer()
If NOT GetSettingsEntry("dsll_on") Then Exit Sub
Set rs = crsConn.Execute("SELECT `name`, `promotion_date`, `reason` FROM `members`")
If NOT (rs.BOF OR rs.EOF) Then
Do Until rs.EOF
iniLimit = Int(GetSettingsEntry("dsllLimit"))
dsll = GetDaysLastLogged(rs.Fields(0))
If dsll >= iniLimit AND rs.Fields(0) <> BotVars.Username Then
If DateDiff("d", rs.Fields(1), Now) >= iniLimit Then
Command BotVars.Username, "/crsdemote " & rs.Fields(0) & " Days inactive: " & dsll, True
End If
End If
rs.MoveNext
Loop
End If
End Sub
Sub crs_create_database()
'// Create the database
Set Catalog = CreateObject("ADOX.Catalog")
Catalog.Create "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & crsDatabasePath
'// Connect to database
crs_connect()
'// Create members Table
crsConn.Execute("CREATE TABLE `members` (`name` varchar(30) NOT NULL, `rank` int NULL, `previous_rank` int NULL, " & _
"`promoter_name` varchar(30) NOT NULL, `promotion_date` varchar(32), " & _
"`join_date` varchar(32), `reason` Text, `time_logged` Int, `last_active` varchar(32), `recruiter` varchar(15))")
End Sub
Sub crs_connect()
'// Create database connection
Set crsConn = CreateObject("ADODB.connection")
dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & crsDatabasePath
crsConn.ConnectionString = dsn
crsConn.Open
End Sub
Private Sub crsCmdsCmd(Command, user)
'// If proper syntax
If Command.IsValid Then
'// Has enough access
If Command.HasAccess Then
If NOT IsCRSMember(user) Then Exit Sub
'// Get command requirements. Use official names as they appear in the Command Manager; these names will not change unless users edit the XML, which is idiotic when they can just create an alias.
cmdNames = Array("crsAdmin", "crsCmds", "crsDemote", "crsDisable", "crsGreet", "crsMemInfo", "crsPromote", "crsQRanks", "crsRank", "crsRankInfo", "crsRankStats", "crsRemove", "crsRestore", "crsSet")
For i = 0 To UBound(cmdNames)
Set cmd = OpenCommand(cmdNames(i))
If cmd.RequiredRank <= GetDBEntry(user).Rank OR user = BotVars.Username Then text = text & cmdNames(i) & ", "
Next
If text <> vbNullString Then
Command.Respond "You are able to use the following CRS commands: " & Left(text, Len(text) -2)
Else
Command.Respond "You are not able to use any CRS commands."
End If
End If
End If
End Sub
Private Sub crsadminCmd(Command, user)
If Command.IsValid Then
If user = BotVars.Username Then
If NOT IsCRSMember(user) Then Exit Sub
Select Case LCase(Split(Command.Args)(0))
Case "override"
cmdArr = Split(Command.Args)
If Ubound(cmdArr) < 3 Then Exit Sub
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name` = '" & cmdArr(2) & "'")
If rs.Fields(0) <> 0 Then
On Error Resume Next
If IsNumeric(cmdArr(3)) Then
crsConn.Execute("UPDATE `members` SET `" & cmdArr(1) & "` = " & cmdArr(3) & " WHERE `name` ='" & cmdArr(2) & "'")
On Error Resume Next
Select Case Err.Number
Case -2147217904
Command.Respond "CRS Database error: That field does not exist. Please do not use this command if you don't know what you are doing. Misuse of this command WILL cause this script to error."
Exit Sub
Case -2147217913
Command.Respond "CRS Database error: Field is not formatted for the specified entry. Please do not use this command if you don't know what you are doing. Misuse of this command WILL cause this script to error."
Exit Sub
End Select
Command.Respond "Field was changed to the specified entry for user "" " & cmdArr(2) & """ ."
Else
If UBound(cmdArr) > 3 Then
sValue = Split(Command.Args, " ", 4)(3)
Else
sValue = cmdArr(3)
End If
crsConn.Execute("UPDATE `members` SET `" & cmdArr(1) & "` = '" & sValue & "' WHERE `name` ='" & cmdArr(2) & "'")
Select Case Err.Number
Case -2147217904
Command.Respond "CRS Database error: That field does not exist. Please do not use this command if you don't know what you are doing. Misuse of this command WILL cause this script to error."
Exit Sub
Case -2147217913
Command.Respond "CRS Database error: Field is not formatted for the specified entry. Please do not use this command if you don't know what you are doing. Misuse of this command WILL cause this script to error."
Exit Sub
End Select
Command.Respond "Field was changed to the specified entry for user "" " & cmdArr(2) & """ ."
End If
End If
Case "members"
Command.Respond "Members in the CRS database (" & GetDBMembers(0) & "): " & GetDBMembers(1)
Case "massrank"
cmdArr = Split(LCase(Command.Args))
If IsNumeric(cmdArr(2)) AND (cmdArr(1) = "probation" OR cmdArr(1) = "peon" OR cmdArr(1) = "grunt" OR cmdArr(1) = "shaman") Then
If Int(cmdArr(2)) > UBound(crsRanks)-1 OR Int(cmdArr(2)) < LBound(crsRanks)+1 Then
Command.Respond "Invalid rank. Ranks must be between " & LBound(crsRanks)+1 & " and " & UBound(crsRanks)-1 &"."
Exit Sub
End If
Select Case cmdArr(1)
Case "probation":sRank = 0
Case "peon":sRank = 1
Case "grunt":sRank = 2
Case "shaman":sRank = 3
End Select
For Each mem In Clan.Members
If mem.Rank = sRank Then
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name` = '" & mem.Name & "'")
If rs.Fields(0) <> 0 Then
crsConn.Execute("UPDATE `members` SET `promotion_date` ='" & Now & "', `previous_rank` = `rank`, `rank` =" & cmdArr(2) & ", `promoter_name`='" & BotVars.Username & "', `reason` = 'Mass Set' WHERE `name` ='" & mem.Name & "'")
Set rs = crsConn.Execute("SELECT `rank` FROM `members` WHERE `name` ='" & mem.Name & "'")
Command.Respond """ " & mem.Name & " "" has had their rank changed to rank " & rs.Fields(0) & " - " & crsRanks(rs.Fields(0))
If GetSettingsEntry("aa_on") Then Call GiveAccess(Mem.name, rs.Fields(0))
Else '// Brand new member
crsConn.Execute("INSERT INTO `members` (`name`, `rank`, `previous_rank`, `promoter_name`, `promotion_date`, `join_date`, `reason`, `time_logged`, `last_active`, `recruiter`) " & _
"Values ('" & mem.Name & "', " & cmdArr(2) & ", " & cmdArr(2) & ", '" & BotVars.Username & "', '" & Now & "', '" & Now & "', 'Mass Set', " & 0 & ", '0', '" & BotVars.Username & "')")
Set rs = crsConn.Execute("SELECT `rank` FROM `members` WHERE `name` ='" & mem.Name & "'")
Command.Respond """ " & mem.Name & " "" has been added as a new member with the rank of " & rs.Fields(0) & " - " & crsRanks(rs.Fields(0))
If GetSettingsEntry("aa_on") Then Call GiveAccess(mem.Name, rs.Fields(0))
End If
End If
Next
End If
Case "resetdb"
AddChat 16759296, "CRS Script:. ", 10682112, "Resetting database..."
crsConn.Close
crsFSO.DeleteFile(crsDatabasePath)
Call crs_create_database()
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members`")
If rs.Fields(0) = 0 Then
'// No one is in the Database, so add the bot's username as the first user
crsConn.Execute("INSERT INTO `members` (`name`, `rank`, `previous_rank`, `promoter_name`, `promotion_date`, `join_date`, `reason`, `time_logged`, `last_active`, `recruiter`) " & _
"Values ('" & BotVars.Username & "', " & 1 & ", " & 1 & ", '" & BotVars.Username & "', '" & Now & "', '" & Now & "', 'Bot Console', " & 0 & ", '0', '" & BotVars.Username & "')")
AddChat 16759296, "CRS Script:. ", 10682112, "Bot console has been added as the first member in your CRS database. Console is now able to add other users and perform CRS commands."
End If
End Select
End If
End If
End Sub
Private Sub crsgreetCmd(Command, user)
If Command.IsValid Then
If Command.HasAccess Then
If NOT IsCRSMember(user) Then Exit Sub
'// Get command agruments
cmdArr = Split(Command.Args)
Select Case LCase(cmdArr(0))
Case "on"
WriteSettingsEntry "nm_greet_on", True
WriteSettingsEntry "m_greet_on", True
Command.Respond "Member and non-member CRS greets have been turned on."
Case "off"
WriteSettingsEntry "nm_greet_on", False
WriteSettingsEntry "m_greet_on", False
Command.Respond "Member and non-member CRS greets have been turned off."
Case "mem"
If UBound(cmdArr) < 1 Then Exit Sub
Select Case cmdArr(1)
Case "on"
WriteSettingsEntry "m_greet_on", True
Command.Respond "Member CRS greets have been turned on."
Case "off"
WriteSettingsEntry "m_greet_on", False
Command.Respond "Member CRS greets have been turned off."
Case Else
WriteSettingsEntry "m_greet", Split(Command.Args, " ", 2)(1)
Command.Respond "Greet saved for CRS members."
End Select
Case "nmem"
If UBound(cmdArr) < 1 Then Exit Sub
Select Case cmdArr(1)
Case "on"
WriteSettingsEntry "nm_greet_on", True
Command.Respond "Non member CRS greets have been turned on."
Case "off"
WriteSettingsEntry "nm_greet_on", False
Command.Respond "Non member CRS greets have been turned off."
Case Else
WriteSettingsEntry "nm_greet", Split(Command.Args, " ", 2)(1)
Command.Respond "Greet saved for non CRS members."
End Select
Case Else
'// Rank Specific greets
If UBound(cmdArr) < 1 Then Exit Sub
If IsNumeric(cmdArr(0)) Then
WriteSettingsEntry cmdArr(0), Split(Command.Args, " ", 2)(1)
Command.Respond "Greet saved for rank " & cmdArr(0) & "."
End If
End Select
End If
End If
End Sub
Private Sub crsremoveCmd(Command, user)
If Command.IsValid Then
If Command.HasAccess Then
If NOT IsCRSMember(user) Then Exit Sub
name = Command.Args
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name`='" & name & "'")
If rs.Fields(0) <> 0 Then
If NOT IsAlterValid("remove", name, user, vbNullString) Then
Command.Respond "You cannot remove someone equal to or higher than your current CRS rank."
Exit Sub
End If
crsConn.Execute("DELETE FROM `members` WHERE `name`='" & name & "'")
Command.Respond """ " & name & " "" has been removed from the CRS database."
Else
Command.Respond """ " & name & " "" does not have a record on the CRS database."
End If
End If
End If
End Sub
Private Sub crsdemoteCmd(Command, user)
If Command.IsValid Then
If Command.HasAccess Then
If NOT IsCRSMember(user) Then Exit Sub
If Len(Command.Args) < 1 Then Exit Sub
cmdArr = Split(Command.Args)
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name` ='" & cmdArr(0) & "'")
If rs.Fields(0) <> 0 Then
Select Case UBound(cmdArr)
Case 0 '// No number, no reason = demoting down by 1
'// Check if rank is a valid rank
If NOT IsAlterValid("demote", cmdArr(0), user, 1) Then
Command.Respond "You cannot demote someone that is an equal or higher rank than yourself, or below the lowest rank."
Exit Sub
End If
Call GivePromotion(Command, cmdArr(0), user, 1, vbNullString)
Case Else '// Number and/or reason
If IsNumeric(cmdArr(1)) Then
If NOT IsAlterValid("demote", cmdArr(0), user, cmdArr(1)) Then
Command.Respond "You cannot demote someone that is an equal or higher rank than yourself, or below the lowest rank."
Exit Sub
End If
If Int(cmdArr(1)) > UBound(crsRanks)-1 OR Int(cmdArr(1)) < LBound(crsRanks)+1 Then
Command.Respond "Invalid rank. Ranks must be between " & LBound(crsRanks)+1 & " and " & UBound(crsRanks)-1 &"."
Exit Sub
End If
'// Check for a reason
If UBound(cmdArr) > 1 Then
reason = Split(Command.Args, " ", 3)(2)
Else
reason = vbNullString
End If
Call GivePromotion(Command, cmdArr(0), user, cmdArr(1), reason)
Else
If NOT IsAlterValid("demote", cmdArr(0), user, 1) Then
Command.Respond "You cannot demote someone that is an equal or higher rank than yourself, or below the lowest rank."
Exit Sub
End If
If UBound(cmdArr) => 0 Then
reason = Split(Command.Args, " ", 2)(1)
Else
reason = vbNullString
End If
Call GivePromotion(Command, cmdArr(0), user, 1, reason)
End If
End Select
Else
Command.Respond """ " & cmdArr(0) & " "" does not have a record on the CRS database."
End If
End If
End If
End Sub
Private Sub crsdisableCmd(Command, user)
If Command.IsValid Then
If Command.HasAccess Then
If NOT IsCRSMember(user) Then Exit Sub
If Len(Command.Args) < 1 Then Exit Sub
cmdArr = Split(Command.Args)
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name` ='" & cmdArr(0) & "'")
If rs.Fields(0) <> 0 Then
If NOT IsAlterValid("demote", cmdArr(0), user, 0) Then
Command.Respond "You cannot disable someone that is of equal or higher rank than yourself."
Exit Sub
End If
If UBound(cmdArr) > 0 Then
reason = Split(Command.Args, " ", 2)(1)
Else
reason = vbNullString
End If
Call GivePromotion(Command, cmdArr(0), user, vbNullString, reason)
Else
Command.Respond """ " & cmdArr(0) & " "" does not have a record on the CRS database."
End If
End If
End If
End Sub
Private Sub crspromoteCmd(Command, user)
If Command.IsValid Then
If Command.HasAccess Then
If NOT IsCRSMember(user) Then Exit Sub
If Len(Command.Args) < 1 Then Exit Sub
cmdArr = Split(Command.Args)
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name` ='" & cmdArr(0) & "'")
If rs.Fields(0) <> 0 Then
Select Case UBound(cmdArr)
Case 0 '// No number, no reason = promoting up by 1
'// Check if rank is a valid rank
If NOT IsAlterValid("promote", cmdArr(0), user, 1) Then
Command.Respond "You cannot promote someone to an equal or higher rank than yourself."
Exit Sub
End If
Call GivePromotion(Command, cmdArr(0), user, 1, vbNullString)
Case Else '// Number and/or reason
If IsNumeric(cmdArr(1)) Then
If NOT IsAlterValid("promote", cmdArr(0), user, cmdArr(1)) Then
Command.Respond "You cannot promote someone to an equal or higher rank than yourself."
Exit Sub
End If
If Int(cmdArr(1)) > UBound(crsRanks)-1 OR Int(cmdArr(1)) < LBound(crsRanks)+1 Then
Command.Respond "Invalid rank. Ranks must be between " & LBound(crsRanks)+1 & " and " & UBound(crsRanks)-1 &"."
Exit Sub
End If
'// Check for a reason
If UBound(cmdArr) > 1 Then
reason = Split(Command.Args, " ", 3)(2)
Else
reason = vbNullString
End If
Call GivePromotion(Command, cmdArr(0), user, cmdArr(1), reason)
Else
If NOT IsAlterValid("promote", cmdArr(0), user, 1) Then
Command.Respond "You cannot promote someone to an equal or higher rank than yourself."
Exit Sub
End If
If UBound(cmdArr) => 1 Then
reason = Split(Command.Args, " ", 2)(1)
Else
reason = vbNullString
End If
Call GivePromotion(Command, cmdArr(0), user, 1, reason)
End If
End Select
Else
Command.Respond """ " & cmdArr(0) & " "" does not have a record on the CRS database."
End If
End If
End If
End Sub
Private Sub crsrestoreCmd(Command, user)
If Command.IsValid Then
If Command.HasAccess Then
If NOT IsCRSMember(user) Then Exit Sub
If Len(Command.Args) < 1 Then Exit Sub
cmdArr = Split(Command.Args)
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name` ='" & cmdArr(0) & "'")
If rs.Fields(0) <> 0 Then
If NOT IsAlterValid("restore", cmdArr(0), user, vbNullString) Then
Command.Respond "You cannot restore someone that is or will be of equal or higher rank than yourself."
Exit Sub
End If
If UBound(cmdArr) > 0 Then
reason = Split(Command.Args, " ", 2)(1)
Else
reason = vbNullString
End If
Call GivePromotion(Command, cmdArr(0), user, vbNullString, reason)
Else
Command.Respond """ " & cmdArr(0) & " "" does not have a record on the CRS database."
End If
End If
End If
End Sub
Private Sub crssetCmd(Command, user)
If Command.IsValid Then
If Command.HasAccess Then
If NOT IsCRSMember(user) Then Exit Sub
If Len(Command.Args) < 0 Then Exit Sub
cmdArr = Split(Command.Args)
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name` ='" & cmdArr(0) & "'")
Select Case UBound(cmdArr)
Case 0
Call GivePromotion(Command, cmdArr(0), user, UBound(crsRanks)-1, vbNullString)
Case Else
If IsNumeric(cmdArr(1)) Then
If NOT IsAlterValid("set", cmdArr(0), user, cmdArr(1)) Then
Command.Respond "You cannot set someone equal to or higher than your current CRS rank."
Exit Sub
End If
If Int(cmdArr(1)) > UBound(crsRanks)-1 OR Int(cmdArr(1)) < LBound(crsRanks)+1 Then
Command.Respond "Invalid rank. Ranks must be between " & LBound(crsRanks)+1 & " and " & UBound(crsRanks)-1 &"."
Exit Sub
End If
If UBound(cmdArr) > 1 Then
reason = Split(Command.Args, " ", 3)(2)
Else
reason = vbNullString
End If
Call GivePromotion(Command, cmdArr(0), user, cmdArr(1), reason)
Else
'// Check if the rank name is valid
rankName = Split(Command.Args, " ", 2)(1)
For i = 0 To UBound(crsRanks)-1
If Match(LCase(rankName), LCase(crsRanks(i)) & "*", True) Then
rank = i
If Len(rankName) = Len(crsRanks(rank)) Then
reason = vbNullString
Else
reason = Right(rankName, Len(rankName) - (Len(crsRanks(rank))+1))
End If
Exit For
End If
Next
Call GivePromotion(Command, cmdArr(0), user, rank, reason)
End If
End Select
End If
End If
End Sub
Private Sub crsmeminfoCmd(Command, user)
If Command.IsValid Then
If Command.HasAccess Then
If NOT IsCRSMember(user) Then Exit Sub
name = Split(Command.Args)(0)
Set rs = crsConn.Execute("SELECT COUNT(*) FROM `members` WHERE `name` ='" & name & "'")
If rs.Fields(0) <> 0 Then
Set rs = crsConn.Execute("SELECT `join_date`, `last_active`, `time_logged` FROM `members` WHERE `name` ='" & name & "'")
Command.Respond """ " & name & " "" joined on " & rs.Fields(0) & ", has spent " & GetTimeSpent(rs.Fields(2), False) & " in the clan, and was last active on " & rs.Fields(1) & "."
Else
Command.Respond """ " & name & " "" does not have a record on the CRS database."
End If
End If
End If
End Sub
Last edited by Zigafoo on Thu 12 Aug 2010 - 21:24; edited 1 time in total
Zigafoo- Administration:
- Posts : 691
Join date : 2009-07-03
Age : 30
ROTD Rank : GoND 105270 (8/12/09)
Warn Status :
Marine Statistics
MOS Specialty: Forward Observer - 0861
MOS Experience:
(105270/999999)
Re: SCripts anyone?
TOO F-ING LONG
Nightshade92- Private
- Posts : 19
Join date : 2010-06-13
ROTD Rank : GoND
Warn Status :
Marine Statistics
MOS Specialty: Force Recon
MOS Experience:
(9999007/9999999)
Re: SCripts anyone?
what the fcuk is this?!
Knipfaa- Commander
- Posts : 241
Join date : 2010-07-04
Age : 31
ROTD Rank : Capt.
Warn Status :
Marine Statistics
MOS Specialty: Force Recon
MOS Experience:
(98/100)
Re: SCripts anyone?
Scripts for Ghost-3, you know when you enter the channel and its like
Hello Knipfaa, your ping is 54 and your rank is Grunt lvl 0.
Thats all that crap needed to do that and a little more.
Hello Knipfaa, your ping is 54 and your rank is Grunt lvl 0.
Thats all that crap needed to do that and a little more.
Zigafoo- Administration:
- Posts : 691
Join date : 2009-07-03
Age : 30
ROTD Rank : GoND 105270 (8/12/09)
Warn Status :
Marine Statistics
MOS Specialty: Forward Observer - 0861
MOS Experience:
(105270/999999)
Re: SCripts anyone?
wow you seem to know what you are doing
Knipfaa- Commander
- Posts : 241
Join date : 2010-07-04
Age : 31
ROTD Rank : Capt.
Warn Status :
Marine Statistics
MOS Specialty: Force Recon
MOS Experience:
(98/100)
Re: SCripts anyone?
Pew Pew Pew?
Zigafoo- Administration:
- Posts : 691
Join date : 2009-07-03
Age : 30
ROTD Rank : GoND 105270 (8/12/09)
Warn Status :
Marine Statistics
MOS Specialty: Forward Observer - 0861
MOS Experience:
(105270/999999)
Re: SCripts anyone?
pew pew pew indeeds
idiedtoday- ClanRotd Bot Admin:
- Posts : 458
Join date : 2009-07-03
Age : 27
ROTD Rank : What isn't my rank..
Warn Status :
Marine Statistics
MOS Specialty: Assaultman - 0351
MOS Experience:
(90/100)
Re: SCripts anyone?
Les PewPew moar QQ >.Q lol
BurnOut91- Contributor
- Posts : 158
Join date : 2009-07-08
Age : 31
ROTD Rank : Sargeant Dairy Queen
Warn Status :
Marine Statistics
MOS Specialty: Designated Marksman
MOS Experience:
(100/100)
Re: SCripts anyone?
I have moved this topic to the Trash Can.
If you have any
questions or concerns as to why this topic was trashed, please contact
me privately through the board's personal messaging service.
Recreating
this thread or discussing these actions publicly is against the rules
and will be grounds for a warning. Please do not do it.
If you have any
questions or concerns as to why this topic was trashed, please contact
me privately through the board's personal messaging service.
Recreating
this thread or discussing these actions publicly is against the rules
and will be grounds for a warning. Please do not do it.
Zigafoo- Administration:
- Posts : 691
Join date : 2009-07-03
Age : 30
ROTD Rank : GoND 105270 (8/12/09)
Warn Status :
Marine Statistics
MOS Specialty: Forward Observer - 0861
MOS Experience:
(105270/999999)
:: Trash Can
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Sun 7 Feb 2021 - 20:33 by jason-la-zone
» The forum is open again!
Sun 7 Feb 2021 - 19:30 by Fleaw
» Yo old friend anyone
Tue 4 Aug 2020 - 22:17 by Zigafoo
» yooooooooooooooooooooooo
Sun 25 Jun 2017 - 9:29 by dawownz
» Discord Channel & Facebook Group
Sat 15 Apr 2017 - 0:01 by psyscope
» EXCUSE ME (K1CKMYASS)
Thu 16 Mar 2017 - 6:08 by ShadowThong
» I'm back lets playyy
Thu 19 Jan 2017 - 21:37 by Infierno-
» admin admin
Tue 3 Jan 2017 - 15:42 by TheWildOnes
» K1ckMyAsS [12/10/2016]
Sat 10 Dec 2016 - 4:35 by Anonymou_s