Author Topic: Unban By Password Help  (Read 821 times)

Shadow

  • Guest
Unban By Password Help
« on: September 26, 2008, 01:48:16 PM »
I am trying to add a command when a user type "!UbPD2 <On/Off>" (where ! is the trigger), it toggles a setting, which is already included. I have tried adding the command with 0 Success or lead way. Who ever wants to add it can, else this can be moved to Moderation Scripts.

Code: [Select]
'UbP
'1.0
'& Unban by Password:ShadoW
'&
'&
'& This script will unban you when you whisper the UNBAN Password

'// Version History
'// Version 1.0
'//     Split from CCPO 2.1
'//     When the value of UbP_UnBan is whispered to the bot if it has OPS, it will unban you.

Dim UbP_UnBan

Sub UbP_Event_Load()

    Addchat VBCyan, "Unban by Password 1.0 by Shadow is loaded"
    SetSetting "UbP", "AddSafe", False
    UbP_UnBan = "UnBan Me!"
    '// Change the setting below to true if you are using a bot on Diablo 2 or Diablo 2 Lord of Destruction
    SetSetting "UbP", "D2", False

End Sub

Sub UbP_Event_WhisperFromUser(Username, Flags, Message)

    If LCase(Message) = LCase(UbP_UnBan) Then
        If GetSetting("UbP", "D2") Then
            AddQ "/Unban *" & Username
            AddQ "/w *" & Username & " [UbP] You have been unbanned."
        Else
            AddQ "/Unban " & Username
            AddQ "/w " & Username & " [UbP] You have been unbanned."
        End If

        If GetSetting("UbP", "AddSafe") Then
            If GetSetting("UbP", "D2") Then
                AddQ "/add *" & Username & " SL"
            Else
                AddQ "/add " & Username & " SL"
            End If
        End If
    End If

End Sub
« Last Edit: September 26, 2008, 01:58:08 PM by Shadow »

Hero

  • Administrator
  • Hero Member
  • *****
  • Posts: 502
    • View Profile
    • http://rev7.net
Unban By Password Help
« Reply #1 on: September 26, 2008, 02:41:01 PM »
Code: [Select]
'UP
'1.5
'&Unban Password:Shadow and Hero

Private UP_Command, UP_Password, UP_User, UP_Executing

Sub UP_Event_Load
  AddChat vbCyan, "Unban by Password 1.5 by Shadow and Hero loaded"
  If GetSetting("UP", "Command") = vbNullString Then
    SetSetting "UP", "Command", "up"
  End If
  If GetSetting("UP", "Password") = vbNullString Then
    SetSetting "UP", "Password", "pass"
  End If
  UP_Command = GetSetting("UP", "Command")
  UP_Password = GetSetting("UP", "Password")
End Sub

Sub UP_Event_WhisperFromUser(User, Flags, Text)
  If Left(LCase(Text), Len(BotVars.Trigger & UP_Command)) = LCase(BotVars.Trigger & UP_Command) Then
    Args = Split(Text)
    If UBound(Args) < 1 Then
      Dsp 3, "Please provide a password", User, vbGreen
    Else
       UP_Executing = True
       UP_User = User
       Command BotVars.Username, "/unban " & User, True
    End If
  End If
End Sub
  
Sub UP_Event_ServerError(Text)
  If LCase(Text) = "that user is not banned." Then
     UP_Executing = False
     Dsp 3, "You are not banned", User, vbGreen
  End If
End Sub

Sub UP_Event_ServerInfo(Text)
  If UP_Executing Then
    If InStr(LCase(Text), LCase(UP_User & "was unbanned by")) > 0 Then
    UP_Executing = False
    Dsp 3, "You have been unbanned", User, vbGreen
    End If
  End If
End Sub

Here is how I would do it.

DSP Auto adds the * for D2 bots, you can also use AddQ "/w " & psD2 & Username & " Hai"
ServerInfo and ServerError will tell you if they were unbanned or if they were never banned
Command and password settings make it easy to change

Usage: <trigger><command> <password>
Default Example: .up pass
« Last Edit: September 26, 2008, 03:09:12 PM by Hero »
Hero
AKA: HeroAssasin and Mike
- - - - -  - - -
Visit Clan R77
- - - - -  - - -
Please do not PM me with random questions. That is what I made these forums for.

Noob ~Vector

Shadow

  • Guest
Unban By Password Help
« Reply #2 on: September 26, 2008, 03:06:39 PM »
Meh... Why version 1.5 and not 1.1? I guess this can be moved to the Moderation plugins >< Also I used UbP because I am in favor of 3 (or more) character prefixes (so I have more of a choice when naming a plugin/script). Did it take you 5 tries to get it right lol?
« Last Edit: September 26, 2008, 03:12:42 PM by Shadow »