Fixed major issues with the "limit" command. The bot was trying to issue the add/set command using Command() With the user's access, but I had already restricted both add and set in access.ini (so it didn't work).
To overcome this limitation, I had to instead call Command() Using BotVars.Username, and the /add command (which overrides all access.ini limitations), then check the user's access against the AMAddSettAcc variable (70, which is the default access level for add and set)
It now has a custom message, similar to the bot's default "Set user to blah access". I also added various other checks and bounds to it. I also added a "nolimit" command too.
@Shadow: Anyone with the A flag has no restrictions whatsoever. I just simply exit the sub if they have the A flag, to prevent duplicate addition entries.
[2:46:42 PM] <Bot-Vector> .whoami
[2:46:42 PM] <Bot-Vector@Northrend> You have 999 access and flags A.
[2:46:18 PM] <Bot-Vector> .add testing 600
[2:46:19 PM] <Bot-Vector@Northrend> Set testing's access to 600.
[2:46:20 PM] <Bot-Vector@Northrend> Set testing's access to 600.
[1:54:42 PM] <Bot-Vector> .add hero.a 120
[1:54:42 PM] <Bot-Vector@Northrend> Set hero.a's access to 120.
[1:55:05 PM] <Bot-Vector> .add aunoVector@europe 150
[1:55:06 PM] <Bot-Vector@Northrend> Set aunoVector@europe's access to 150.
[1:55:15 PM] <Bot-Vector> ~say .limit aunoVector@europe 20
[1:55:16 PM] <Hero.A@Northrend> .limit aunoVector@europe 20
[1:55:16 PM] <Bot-Vector@Northrend> aunoVector@europe (150 access) has higher access than you (120 access). Unable to limit.
[1:55:41 PM] <Bot-Vector> .limit hero.a 121
[1:55:41 PM] <Bot-Vector@Northrend> Unable to limit hero.a's access. Limit (121) too high for his access (120).
[1:55:52 PM] <Bot-Vector> .limit hero.a 120
[1:55:52 PM] <Bot-Vector@Northrend> Limit is ambiguous to user's access.
[1:56:08 PM] <Bot-Vector> .limit hero.a
[1:56:09 PM] <Bot-Vector@Northrend> hero.a has no limitation.
[1:56:14 PM] <Bot-Vector> .limit hero.a 50
[1:56:15 PM] <Bot-Vector@Northrend> Limited hero.a to giving out 50 access.
[1:56:19 PM] <Bot-Vector> ~say .add bob 51
[1:56:19 PM] <Hero.A@Northrend> .add bob 51
[1:56:20 PM] <Bot-Vector@Northrend> You are limited to giving out 50 access only.
[1:56:22 PM] <Bot-Vector> ~say .add bob 50
[1:56:23 PM] <Hero.A@Northrend> .add bob 50
[1:56:23 PM] <Bot-Vector@Northrend> Set bob's access to 50.
[2:02:44 PM] <Bot-Vector> .limit hero.a
[2:02:45 PM] <Bot-Vector@Northrend> hero.a has an access limit of 50.
[1:56:36 PM] <Bot-Vector> .limit test ee
[1:56:36 PM] <Bot-Vector@Northrend> The limitation argument must be a numeric value.
[1:56:45 PM] <Bot-Vector> .limit testing
[1:56:45 PM] <Bot-Vector@Northrend> User not found.
[1:56:52 PM] <Bot-Vector> .limit testing 30
[1:56:53 PM] <Bot-Vector@Northrend> That user doesn't exist. Cannot limit.
[1:58:01 PM] <Bot-Vector@Northrend> Removed hero.a's add restrictions.
[div class='codetop']CODE[/div][div class='codemain' style='height:200px;white-space:pre;overflow:auto'] Case "limit"
If uNum < AMLimitUsersAcc Then Exit Sub
GetDBEntry Arg(1), a, f
getLim = GetConfigEntry("limit", Arg(1), AMSettingsPath)
'// Query limits
If Ubound(Arg) = 1 Then
If getLim = "" And a <> -1 Then
Send Source, Arg(1) & " has no limitation.", User
ElseIf getLim <> "" And a <> - 1 Then
Send Source, Arg(1) & " has an access limit of " & getLim & ".", User
Else
Send Source, "User not found.", User
End If
Exit Sub
End If
If Not IsNumeric(Arg(2)) Then
Send Source, "The limitation argument must be a numeric value.", User
Exit Sub
End If
'// User exists?
If a = -1 Then
Send Source, "That user doesn't exist. Cannot limit.", User
Exit Sub
End If
'// Trying to limit a user who has higher access than you?
If cInt(uNum) < cInt(a) Then
Send Source, Arg(1) & " (" & a & " access) has higher access than you (" & uNum & " access). Unable to limit.", User
Exit Sub
End If
'// Limiting user to their access level?
If cInt(Arg(2)) = cInt(a) Then
Send Source, "Limit is ambiguous to user's access.", User
Exit Sub
End If
'// Limiting someone to higher access than they currently have?
If cInt(Arg(2)) > cInt(a) Then
Send Source, "Unable to limit " & Arg(1) & "'s access. Limit (" & Arg(2) & ") too high for his access (" & a & ").", User
Exit Sub
End If
WriteConfigEntry "limit", Arg(1), Arg(2), AMSettingsPath
Send Source, "Limited " & Arg(1) & " to giving out " & Arg(2) & " access.", User[/div]
Codebox ftw ~Hero