• Welcome to Valhalla Legends Archive.
 

How can i add a say command and a Ban command.

Started by OuTLawZ-GoSu, June 28, 2003, 11:20 AM

Previous topic - Next topic

OuTLawZ-GoSu

Sup... I need some help. I need to add a .say command and a .ban command for my bot. I dont get how to do that. Can you plz post the full code here?

Thx

L8terZ

Noodlez

I would suggest you not posting the same thing in more then one forum.

Kp

Quote from: Noodlez on June 28, 2003, 11:33 AM
I would suggest you not posting the same thing in more then one forum.
Especially when his cross-post is in an inappropriate forum. :)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Camel

#3
Assuming you're using VB, here's a start:

Call this function whenever someone says something in chat or whispers your bot (use True for the whisper paramater if it's a whisper).
Public Sub CheckCommand(UserName As String, Chat As String, Optional Whisper As Boolean = False)
   If (Chat = "?trigger") Then
       Commands.pCommand UserName, "trigger", ""
       Exit Sub
   End If

   Dim S As Long
   S = InStr(1, Chat, " ")
   
   If Left(Chat, 1) = <TRIGGER> Then
       If S = 0 Then
           pCommand UserName, Mid(Chat, 2), ""
       Else
           pCommand UserName, Mid(Chat, 2, S - 2), Mid(Chat, S + 1)
       End If
   ElseIf Whisper Then
       If S = 0 Then
           pCommand UserName, Chat, ""
       Else
           pCommand UserName, Left(Chat, S - 1), Mid(Chat, S + 1)
       End If
   End If
End Sub


Public Sub pCommand(ByVal strUser As String, ByVal strCommand As String, ByVal strValue As String)
   If (Len(strCommand) = 0) Then Exit Sub
   If (Left(strCommand, 1) = ".") Then Exit Sub 'very annoying crap like '...' will be parsed w/o this
   
   strUser = Right(strUser, Len(strUser) - InStr(1, strUser, "*")) 'charactor@realm*account@server
   strCommand = LCase(strCommand)

   Dim AuthUser As Long
   AuthUser = GetRank(strUser)
   Dim AuthRequired As String 'This should ALWAYS be a number, but lets not crash if it isn't!
   AuthRequired = "?"
'The following requests access from a databse; dont use it unless you're using a database too. Look in to the GetPrivateProfileString API call to get information out of an INI file.
   SQLStr = "SELECT access FROM cmds WHERE command=" & MkSQLStr(strCommand) & ";"
   With ExecSQL(SQLStr)
       If Not .EOF Then AuthRequired = .Fields(0)
   End With
       
   If Not IsNumeric(AuthRequired) Then
       'Addtext ColAnError, "Warning: command """ & strCommand & """ is not recognized" & vbCrLf, True
       Exit Sub
   End If
   
   If AuthUser < AuthRequired Then
       If AuthUser > 0 Then SendText "Your rank is only " & AuthUser & "; A rank of " & AuthRequired & " is required to use command """ & strCommand & """", strUser
       Addtext ColAnError, "Warning: " & strUser & " cannot use command """ & strCommand & """ (ranked " & AuthUser & "/" & AuthRequired & ")" & vbCrLf, True
   Else
       Select Case strCommand
           Case "ver"
               SendText "BNU`Bot v" & version & " by BNU-Camel", strUser
           Case "kick"
               SendText "/kick " & strValue
           Case "ban"
               SendText "/ban " & strValue
           'Add more commands here
       End Select
   End If
End Sub

OuTLawZ-GoSu

Eh... ye srry bout that. I for got that I posted this in the other forum.

gosumoo

gosu i have seen many things of your bot if you would like help i would be more than happy to help you, just aim me on GoSuMoO or e-mail me : [email protected]  8)
---
420
Smoking is bad for you.... Better light up
HEY! you only live once  :o