Help - Search - Members - Calendar
Full Version: DoTa Script
StealthBot.net > StealthBot > Scripting and Plugins > Plugin Projects
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
Mondster
Im not happy to told ya, but u did lots of small mistakes.
Why dont u test your script at yourown bevor running?

This errors i got, when starting the plugin:
QUOTE

Offending line: >> Sub NGOC_event_usertalk(Username, Flags, Message, Ping
=> Sub NGOC_event_usertalk(Username, Flags, Message, Ping)

Offending line: >> BotVars.Username Command "/disconnect"
=> Call Command(BotVars.Username, "/disconnect", True)

Offending line: >> db.ExecuteQuery("DELETE FROM Game WHERE Name = '" & Username & ""')
=> db.ExecuteQuery("DELETE FROM Game WHERE Name = '" & Username & "'")

Offending line: >> Sub NGOC_Sign(Username)
=> 'End Sub' above is missing

Offending line: >> AddQ "Use " & BotVars.Trigger "sign to sign in and " & BotVars.Trigger & "out to signout"
=> AddQ "Use " & BotVars.Trigger & "sign to sign in and " & BotVars.Trigger & "out to signout"

Offending line: >> If Teams = 5v5 Then
=> If Teams = "5v5" Then

Offending line: >> ElseIf Teams = 4v4 Then
=> ElseIf Teams = "4v4" Then

Offending line: >> AddQ "GN = " & Clan & "" & GN & " Mode = " & Mode & " Teams = " & Teams &
=> AddQ "GN = " & Clan & "" & GN & " Mode = " & Mode & " Teams = " & Teams

Offending line: >>
=> there is also one 'End' missing somewhere
Stop being retarded ferret.
CODE
Sub NGOC_Sign(Username)
forgot to End Sub 3 lines above that line, it seems to be.
Samot
QUOTE(Mondster @ Dec 16 2007, 06:52 AM) *

Im not happy to told ya, but u did lots of small mistakes.
Why dont u test your script at yourown bevor running?

This errors i got, when starting the plugin:
QUOTE

Offending line: >> Sub NGOC_event_usertalk(Username, Flags, Message, Ping
=> Sub NGOC_event_usertalk(Username, Flags, Message, Ping)

Offending line: >> BotVars.Username Command "/disconnect"
=> Call Command(BotVars.Username, "/disconnect", True)

Offending line: >> db.ExecuteQuery("DELETE FROM Game WHERE Name = '" & Username & ""')
=> db.ExecuteQuery("DELETE FROM Game WHERE Name = '" & Username & "'")

Offending line: >> Sub NGOC_Sign(Username)
=> 'End Sub' above is missing

Offending line: >> AddQ "Use " & BotVars.Trigger "sign to sign in and " & BotVars.Trigger & "out to signout"
=> AddQ "Use " & BotVars.Trigger & "sign to sign in and " & BotVars.Trigger & "out to signout"

Offending line: >> If Teams = 5v5 Then
=> If Teams = "5v5" Then

Offending line: >> ElseIf Teams = 4v4 Then
=> ElseIf Teams = "4v4" Then

Offending line: >> AddQ "GN = " & Clan & "" & GN & " Mode = " & Mode & " Teams = " & Teams &
=> AddQ "GN = " & Clan & "" & GN & " Mode = " & Mode & " Teams = " & Teams

Offending line: >>
=> there is also one 'End' missing somewhere



How do you get the offending line in stealth bot?
Java-
Hmm, Well I think part of the error is that the file isn't turning into a plug file like the rest of the plugins. It stays as a txt and isn't it supposed to turn into a plug?
Mondster
QUOTE(Samot @ Dec 15 2007, 10:27 PM) *

How do you get the offending line in stealth bot?

If u load the plugin not as plugin, but as script. Then u will see the line number, the error reason and the line with this error. Take that in mind for new scripts wink.gif


QUOTE

It is already in plugin format. I have no idea why it wants to change it. I will try changing it into a .plug

If the bot wants to change the script in plugin format, u did something wrong. Otherwise it would load a txt-file as well without that message. Check the first lines: no empty one, a prefix and a version is necessary.
Java-
What I'm saying is it usually turns into a plug form when it is working, this one stays at a txt form.

This might help, anytime some one types a command in the channel, its gives me the error. Like this:

[4:39:29 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:29 PM] Error Number: 13 Description: Type mismatch
[4:39:33 PM] <stillmissyou> hey temp
[4:39:33 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:33 PM] Error Number: 13 Description: Type mismatch
[4:39:35 PM] <tempest.x> yo
[4:39:35 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:35 PM] Error Number: 13 Description: Type mismatch
[4:39:42 PM] <stillmissyou> !traviaon
[4:39:43 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:43 PM] Error Number: 13 Description: Type mismatch
[4:39:47 PM] <stillmissyou> ?trigger
[4:39:47 PM] <CD-Info> The bot's current trigger is " ! " (Alt + 033)
[4:39:47 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:47 PM] Error Number: 13 Description: Type mismatch
[4:39:47 PM] <CD-BOT> The bot's current trigger is " - " (Alt + 045)
[4:39:47 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:47 PM] Error Number: 13 Description: Type mismatch
[4:39:50 PM] <stillmissyou> !trivial
[4:39:50 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:50 PM] Error Number: 13 Description: Type mismatch
[4:39:52 PM] <stillmissyou> w/e
[4:39:52 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:52 PM] Error Number: 13 Description: Type mismatch
[4:39:53 PM] <stillmissyou> k
[4:39:53 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:53 PM] Error Number: 13 Description: Type mismatch
[4:39:56 PM] <stillmissyou> i host?
[4:39:56 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:56 PM] Error Number: 13 Description: Type mismatch
[4:39:59 PM] <stillmissyou> dota 6.49b -arem usa/ca pro!!!
[4:39:59 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:59 PM] Error Number: 13 Description: Type mismatch
[4:39:59 PM] <stillmissyou> dota 6.49b -arem usa/ca pro!!!
[4:39:59 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:59 PM] Error Number: 13 Description: Type mismatch
[4:39:59 PM] <stillmissyou> dota 6.49b -arem usa/ca pro!!!
[4:39:59 PM] UserTalk Call Error On File> C:\Program Files\Warcraft III\Stealth Bot\plugins\SignCommand.plug
[4:39:59 PM] Error Number: 13 Description: Type mismatch
Hero.A
Try changing commands section to
CODE

'************
'**Commands**
'************

Sub ngoc_event_usertalk(Username, Flags, Message, Ping)

If Left(Message, 1) = BotVars.Trigger Then
    GetDBEntry Username, myAccess, myFlags
    If myAccess >= 20 Then
        If lcase(left(message, 5)) = BotVars.Trigger & "sign" Then
            ngoc_Sign Username
        ElseIf lcase(left(message, 4)) = BotVars.Trigger & "out" Then
            ngoc_Out Username
        ElseIf lcase(left(message, 10)) = BotVars.Trigger & "startgame " Then
            ngoc_startgame Username, Message
        ElseIf lcase(left(message, 8)) = BotVars.Trigger & "confirm" Then
            ngoc_Confirm
        ElseIf lcase(left(message, 11)) = BotVars.Trigger & "cancelgame" Then
            ngoc_Cancel
        End If
    End If
Else
    Exit Sub
End If

End Sub


This removes the security but who cares about that. It could be causing the error. I know the else is not neccesary but i am putting it as a precaution
Mondster
I found the mistake:
CODE

Private Sub Class_Initialize()
path_ = BotPath() & "plugins\NGOCData.mdb"
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub
Private Sub Class_Terminate()
Close()
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub

End Class

Delete this and fix this error:

Offending line: >> AddQ "Use " & BotVars.Trigger "sign to sign in and " & BotVars.Trigger & "out to signout"
=> AddQ "Use " & BotVars.Trigger & "sign to sign in and " & BotVars.Trigger & "out to signout"
Java-
Yay the mistake was found. Now hopefully it will work!
Mondster
I mean: u have to End the Class first bevor open the next sub:
CODE

End Class

Private Sub Class_Initialize()
path_ = BotPath() & "plugins\NGOCData.mdb"
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub

Private Sub Class_Terminate()
Close()
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub
Hero.A
LOL j3m messed up on that first one!!

Still getting this
[3:55:04 PM] UserTalk Call Error On File> C:\Documents and Settings\Michael\Desktop\Michaels Area\Bot\SB\plugins\NGOC SCRIPT.txt
[3:55:04 PM] Error Number: 13 Description: Type mismatch

CODE

'ngoc
'1.0

'By Hero.A ~
'Set Clan to your clan and security to the number i give you!
Public Clan, Security
Clan = "You Clan Tag Here"
Security = "10" 'Put the number from me here!

'************************
'*******Variables*********
'**For Database and Code**
'*************************

Private Const db_cTypeBoolean = 11
Private Const db_cTypeCurrency = 6
Private Const db_cTypeDate = 7
Private Const db_cTypeDouble = 5
Private Const db_cTypeInteger = 3
Private Const db_cTypeText = 202

Private Const db_cModeReadOnly = 1
Private Const db_cModeForUpdate = 2


Public Compare, Confirm, GameOn, SignedUp, SignedAmnt, Data, Teams, Mode



Sub ngoc_Event_Load()

AddChat vbBlue, "Welcome to the NGOC Game Script By: Hero.A Ver: 1.0"
AddChat vbBlue, "Most messages in blue are this script working. (it may show messages you do not understand)"


TimerInterval "ngoc", "StartGame", 5
TimerEnabled "ngoc", "StartGame", FALSE

Dim db, t, db_path, rs, l

Set db = New db_clsDatabase
db_path = BotPath() & "plugins\NGOCData.mdb"


'***************************
'**Setting Up the Database**
'***************************

If not db.Exists(db_path) Then
If Not db.Create(db_path) Then
AddChat vbRed, "Unable to Create Database!"
Exit Sub
End If
Else
If Not db.Open(db_path) Then
AddChat vbRed, "Unable to Open Database!"
Exit Sub
End If
End If

If db.IsOpen() Then
AddChat vbBlue, "Database opened."
Else
Exit Sub
End If

If Not db.TableExists("Game") Then
If db.CreateTable("Game") Then
AddChat vbBlue, "Created Table Game"
Else
AddChat vbRed, "Could not create Table Game"
Exit Sub
End If
End If


Set t = db.Table("Players")
If Not db.ColumnExists(t.Name, "Name") Then
t.Columns.Append "Name", db_cTypeText, 32
AddChat vbBlue, "Created Column Name"
End If
AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

End Sub

'************
'**Commands**
'************

Sub ngoc_event_usertalk(Username, Flags, Message, Ping)

If Left(Message, 1) = BotVars.Trigger Then
GetDBEntry Username, myAccess, myFlags
If myAccess >= 20 Then
If lcase(left(message, 5)) = BotVars.Trigger & "sign" Then
ngoc_Sign Username
ElseIf lcase(left(message, 4)) = BotVars.Trigger & "out" Then
ngoc_Out Username
ElseIf lcase(left(message, 10)) = BotVars.Trigger & "startgame " Then
ngoc_startgame Username, Message
ElseIf lcase(left(message, 8)) = BotVars.Trigger & "confirm" Then
ngoc_Confirm
ElseIf lcase(left(message, 11)) = BotVars.Trigger & "cancelgame" Then
ngoc_Cancel
End If
End If
Else
Exit Sub
End If

End Sub

'**************
'***Sign Sub***
'**************

Sub ngoc_Sign(Username)

If GameOn = 0 Then
Exit Sub
End If

If SignedUp(Username) = 0 Then
AddQ "/me " & Username & " has signed into the game"
Set rs = db.OPenRecordSet("Game", db_cModeForUpdate)
rs.AddNew
rs("Name") = Username
rs.Update
rs.Close
SignedAmnt = SignedAmnt + 1
Else
Exit Sub
End If

End Sub


'*****************
'****Out Sub******
'*****************


Sub ngoc_Out(Username)

If GameOn = 0 Then
Exit Sub
End If

If SignedUp(Username) = 1 Then
AddQ "/me " & Username & " has signed out of the game"
db.ExecuteQuery("DELETE FROM Game WHERE Name = '" & Username & "'")
SignedAmnt = SignedAmnt - 1
Else
Exit Sub
End If

End Sub


'******************
'**Start Game Sub**
'******************

Sub ngoc_startgame(Username, Message)

If GameOn = 0 Then
AddQ "Please Wait"
Exit Sub
End If

Data = Split(Message, " ")
Mode = Data(1)
Teams = Data(2)

AddChat vbBlue, "Checking Data..."
AddChat vbBlue, "Teams = " & Teams & " Mode = " & Mode

If lcase(Teams) <> "5v5" Then
If lcase(Teams) <> "4v4" Then
AddQ "Only 5v5 or 4v4 teams allowed"
Exit Sub
End If
End If

GameOn = 1
AddQ "Dota " & Mode & " game created by " & Username
AddQ "Use " & BotVars.Trigger & "sign to sign in and " & BotVars.Trigger & "out to signout"
TimerEnabled "ngoc", "StartGame", TRUE

End Sub

'********************
'**Start Game Timer**
'********************

Sub ngoc_StartGame_Timer()

If Teams = "5v5" Then
Compare = 10
ElseIf Teams = "4v4" Then
Compare = 8
End If

If Compare > SignedAmnt Then
TimerEnabled "NGOC", "StartGame", FALSE
AddChat vbBlue, "Lol we passed it"
AddQ "The game is full!!"
AddQ "Please type " & BotVars.Trigger & "confirm to start the game"
ElseIf Compare = SignedAmnt Then
TimerEnabled "NGOC", "StartGame", FALSE
AddQ "The game is full!!"
AddQ "Please type " & BotVars.Trigger & "confirm to start the game"
End If

End Sub

'************
'**Confirm***
'************

Sub ngoc_Confirm

If GameOn = 0 Then
Exit Sub
End If

GN = GN + 1
AddQ "Confirmed"
AddQ "GN = " & Clan & "" & GN & " Mode = " & Mode & " Teams = " & Teams

AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

GameOn = 0
Teams = 0
Mode = 0

End Sub

'*****************
'***Cancel Game***
'*****************

Sub ngoc_Cancel

If GameOn = 0 Then
Exit Sub
End If

AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

GameOn = 0
Teams = 0
Mode = 0

End Sub




'*****************
'**Signed Up Func*
'*****************

Function SignedUp(Username)
Set rs = db.OpenRecordSet("SELECT * FROM Game ORDER BY Name", db_cModeReadOnly)
AddChat vbBlue, "Searching for a player ..."
rs.MoveFirst
rs.Find "Name='" & Username & "'"
If Not rs.EOF Then
AddChat vbBlue, "Found player!"
SignedUp = 1
Else
AddChat vbBlue, "Could not find player!"
SignedUp = 0
End If
End Function



'******************
'**J3M's CLass*****
'******************


Class db_clsDatabase

Private path_, conn_, xconn_

Public Function Exists(path)
Dim fso
Exists = False
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(path) Then
Exists = True
End If
Set fso = Nothing
End Function

Public Function Close()
If Not conn_ Is Nothing Then
If IsOpen() Then
conn_.Close
End If
Set conn_ = Nothing
End If
Close = True
End Function

Public Function IsOpen()
IsOpen = False
If Not conn_ Is Nothing Then
If conn_.State = 1 Then
IsOpen = True
End If
End If
End Function

Public Function Open(path)
On Error Resume Next
Close()
Open = False
path_ = path
Set conn_ = CreateObject("ADODB.Connection")
conn_.Provider = "Microsoft.Jet.OLEDB.4.0"
conn_.Open path_
If IsOpen() Then
Set xconn_ = CreateObject("ADOX.Catalog")
xconn_.ActiveConnection = conn_
Open = True
End If
If Err.Number <> 0 Then
AddChat vbRed, "Error in Open('" & path & "'): " & Err.Description
Err.Clear
End If
End Function

Public Function Create(path)
On Error Resume Next
Dim obj_
Close()
Set obj_ = CreateObject("ADOX.Catalog")
obj_.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB:Engine Type=5;Data Source=" & path
Set obj_ = Nothing
Create = Open(path)
If Err.Number <> 0 Then
AddChat vbRed, "Error in Create('" & path & "'): " & Err.Description
Err.Clear
End If
End Function

Public Function TableExists(tabname)
Dim i
TableExists = False
If Not IsOpen() Then Exit Function
If xconn_.Tables.Count = 0 Then Exit Function
For i = 0 To xconn_.Tables.Count - 1
If UCase(tabname) = UCase(xconn_.Tables(i).Name) Then
TableExists = True
Exit Function
End If
Next
End Function

Public Function ColumnExists(tabname, colname)
Dim i, t
ColumnExists = False
If Not IsOpen() Then Exit Function
If Not TableExists(tabname) Then Exit Function
Set t = xconn_.Tables(tabname)
If t.Columns.Count = 0 Then Exit Function
For i = 0 To t.Columns.Count - 1
If UCase(colname) = UCase(t.Columns(i).Name) Then
ColumnExists = True
Exit Function
End If
Next
End Function

Public Function CreateTable(tabname)
On Error Resume Next
Dim tbl_
If Not IsOpen() Then Exit Function
If TableExists(tabname) Then Exit Function
Set tbl_ = CreateObject("ADOX.Table")
tbl_.Name = tabname
xconn_.Tables.Append tbl_
CreateTable = True
If Err.Number <> 0 Then
AddChat vbRed, "Error in CreateTable('" & tabname & "'): " & _
Err.Description
Err.Clear
End If
End Function

Public Property Get Table(tabname)
On Error Resume Next
Dim tbl_
Set tbl_ = Nothing
If IsOpen() Then
Set tbl_ = xconn_.Tables(tabname)
End If
Set Table = tbl_
If Err.Number <> 0 Then
AddChat vbRed, "Error in Table('" & tabname & "'): " & Err.Description
Err.Clear
End If
End Property

Public Function OpenRecordset(sql, mode)
On Error Resume Next
Dim rs_
Set OpenRecordset = Nothing
If Not IsOpen() Then Exit Function
Set rs_ = CreateObject("ADODB.Recordset")
rs_.ActiveConnection = conn_
Select Case mode
Case db_cModeReadOnly
rs_.CursorType = 2 ' adOpenStatic
rs_.LockType = 1 ' adLockReadOnly
Case db_cModeForUpdate
rs_.CursorType = 1 ' adOpenKeyset
rs_.LockType = 3 ' adLockOptimistic
Case Else
rs_.CursorType = 0 ' adOpenForwardOnly
rs_.LockType = 1 ' adLockReadOnly
End Select
rs_.Source = sql
rs_.Open
If Err.Number <> 0 Then
AddChat vbRed, "Error in OpenRecordSet('" & sql & "', " & _
mode & "): " & Err.Description
Err.Clear
Exit Function
End If
Set OpenRecordset = rs_
End Function

Public Function ExecuteQuery(sql)
On Error Resume Next
Dim rs_, rows_affected
ExecuteQuery = 0
If Not IsOpen() Then Exit Function
Set rs_ = conn_.Execute(sql, rows_affected)
ExecuteQuery = rows_affected
If Err.Number <> 0 Then
AddChat vbRed, "Error in ExecuteQuery('" & sql & "'): " & Err.Description
Err.Clear
End If
End Function

End Class

Private Sub Class_Initialize()
path_ = BotPath() & "plugins\NGOCData.mdb"
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub

Private Sub Class_Terminate()
Close()
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub




EDIT Geeting this also
[3:57:32 PM] Load Call Error On File> C:\Documents and Settings\Michael\Desktop\Michaels Area\Bot\SB\plugins\NGOC SCRIPT.txt
[3:57:32 PM] Error Number: 13 Description: Type mismatch
Java-
I still get an error mismatch.
Mondster
Sorry, i explained wrong... read edited post plz wink.gif
Java-
Can you list the whole edited script please Mondster? I don't think I edited it right.
Hero.A
I did read that. I have it set up like that and it is erroring

RELOAD SCRIPT
[4:02:01 PM] Load Call Error On File> C:\Documents and Settings\Michael\Desktop\Michaels Area\Bot\SB\plugins\NGOC SCRIPT.txt
[4:02:01 PM] Error Number: 13 Description: Type mismatch
[4:02:08 PM] <[email protected]> lol
[4:02:08 PM] UserTalk Call Error On File> C:\Documents and Settings\Michael\Desktop\Michaels Area\Bot\SB\plugins\NGOC SCRIPT.txt
[4:02:08 PM] Error Number: 13 Description: Type mismatch
Mondster
QUOTE
[23:05:54] Welcome to the NGOC Game Script By: Hero.A Ver: 1.0
[23:05:54] Most messages in blue are this script working. (it may show messages you do not understand)
[23:05:57] Error in Open('C:\Stealthbot\Bot einMysterium\plugins\NGOCData.mdb'): Objekt erforderlich
[23:05:57] Database opened.
[23:05:57] Created Table Game
[23:05:57] Error in Table('Players'): Ein Objekt, das dem angeforderten Namen oder dem Ordinalverweis entspricht, kann nicht gefunden werden.
[23:05:57] Scripting runtime error '424': (line 57; column 0)
[23:05:57] Objekt erforderlich: 't'.
[23:05:57] Offending line: >>

That means: the Database cannot be opened, and the Tables cant be created. The object 't' is missing.
Overwrite the script, alone the load sub isnt working fine.
Java-
Well good luck to Hero
Hero.A
O.k. Why is that in german.

I am still having errors when users talk and on load. Mondster what did you change to get it to the point where it is displaying the AddChat vbBlue at the beggining

Oh wow i found one of the errrors. i wrote 2 versions of this. One had tabel game and another has table players...

Change the load sub to
CODE

Sub ngoc_Event_Load()

AddChat vbBlue, "Welcome to the NGOC Game Script By: Hero.A Ver: 1.0"
AddChat vbBlue, "Most messages in blue are this script working. (it may show messages you do not understand)"


TimerInterval "ngoc", "StartGame", 5
TimerEnabled "ngoc", "StartGame", FALSE

Dim db, t, db_path, rs, l

Set db = New db_clsDatabase
db_path = BotPath() & "plugins\NGOCData.mdb"


'***************************
'**Setting Up the Database**
'***************************

If not db.Exists(db_path) Then
    If Not db.Create(db_path) Then
             AddChat vbRed, "Unable to Create Database!"
        Exit Sub
    End If
Else
    If Not db.Open(db_path) Then
             AddChat vbRed, "Unable to Open Database!"
             Exit Sub
    End If
End If

If db.IsOpen() Then
    AddChat vbBlue, "Database opened."
Else
    Exit Sub
End If

If Not db.TableExists("Game") Then
    If db.CreateTable("Game") Then
        AddChat vbBlue, "Created Table Game"
    Else
             AddChat vbRed, "Could not create Table Game"
             Exit Sub
    End If
End If


Set t = db.Table("Game")
If Not db.ColumnExists(t.Name, "Name") Then
    t.Columns.Append "Name", db_cTypeText, 32
    AddChat vbBlue, "Created Column Name"
End If
AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

End Sub



Whole Script
CODE

'ngoc
'1.0

'By Hero.A ~
'Set Clan to your clan and security to the number i give you!
Public Clan, Security
Clan = "You Clan Tag Here"
Security = "10" 'Put the number from me here!

'************************
'*******Variables*********
'**For Database and Code**
'*************************

Private Const db_cTypeBoolean = 11
Private Const db_cTypeCurrency = 6
Private Const db_cTypeDate = 7
Private Const db_cTypeDouble = 5
Private Const db_cTypeInteger = 3
Private Const db_cTypeText = 202

Private Const db_cModeReadOnly = 1
Private Const db_cModeForUpdate = 2


Public Compare, Confirm, GameOn, SignedUp, SignedAmnt, Data, Teams, Mode



Sub ngoc_Event_Load()

AddChat vbBlue, "Welcome to the NGOC Game Script By: Hero.A Ver: 1.0"
AddChat vbBlue, "Most messages in blue are this script working. (it may show messages you do not understand)"


TimerInterval "ngoc", "StartGame", 5
TimerEnabled "ngoc", "StartGame", FALSE

Dim db, t, db_path, rs, l

Set db = New db_clsDatabase
db_path = BotPath() & "plugins\NGOCData.mdb"


'***************************
'**Setting Up the Database**
'***************************

If not db.Exists(db_path) Then
If Not db.Create(db_path) Then
AddChat vbRed, "Unable to Create Database!"
Exit Sub
End If
Else
If Not db.Open(db_path) Then
AddChat vbRed, "Unable to Open Database!"
Exit Sub
End If
End If

If db.IsOpen() Then
AddChat vbBlue, "Database opened."
Else
Exit Sub
End If

If Not db.TableExists("Game") Then
If db.CreateTable("Game") Then
AddChat vbBlue, "Created Table Game"
Else
AddChat vbRed, "Could not create Table Game"
Exit Sub
End If
End If


Set t = db.Table("Game")
If Not db.ColumnExists(t.Name, "Name") Then
t.Columns.Append "Name", db_cTypeText, 32
AddChat vbBlue, "Created Column Name"
End If
AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

End Sub

'************
'**Commands**
'************

Sub ngoc_event_usertalk(Username, Flags, Message, Ping)

If Left(Message, 1) = BotVars.Trigger Then
GetDBEntry Username, myAccess, myFlags
If myAccess >= 20 Then
If lcase(left(message, 5)) = BotVars.Trigger & "sign" Then
ngoc_Sign Username
ElseIf lcase(left(message, 4)) = BotVars.Trigger & "out" Then
ngoc_Out Username
ElseIf lcase(left(message, 10)) = BotVars.Trigger & "startgame " Then
ngoc_startgame Username, Message
ElseIf lcase(left(message, 8)) = BotVars.Trigger & "confirm" Then
ngoc_Confirm
ElseIf lcase(left(message, 11)) = BotVars.Trigger & "cancelgame" Then
ngoc_Cancel
End If
End If
Else
Exit Sub
End If

End Sub

'**************
'***Sign Sub***
'**************

Sub ngoc_Sign(Username)

If GameOn = 0 Then
Exit Sub
End If

If SignedUp(Username) = 0 Then
AddQ "/me " & Username & " has signed into the game"
Set rs = db.OPenRecordSet("Game", db_cModeForUpdate)
rs.AddNew
rs("Name") = Username
rs.Update
rs.Close
SignedAmnt = SignedAmnt + 1
Else
Exit Sub
End If

End Sub


'*****************
'****Out Sub******
'*****************


Sub ngoc_Out(Username)

If GameOn = 0 Then
Exit Sub
End If

If SignedUp(Username) = 1 Then
AddQ "/me " & Username & " has signed out of the game"
db.ExecuteQuery("DELETE FROM Game WHERE Name = '" & Username & "'")
SignedAmnt = SignedAmnt - 1
Else
Exit Sub
End If

End Sub


'******************
'**Start Game Sub**
'******************

Sub ngoc_startgame(Username, Message)

If GameOn = 0 Then
AddQ "Please Wait"
Exit Sub
End If

Data = Split(Message, " ")
Mode = Data(1)
Teams = Data(2)

AddChat vbBlue, "Checking Data..."
AddChat vbBlue, "Teams = " & Teams & " Mode = " & Mode

If lcase(Teams) <> "5v5" Then
If lcase(Teams) <> "4v4" Then
AddQ "Only 5v5 or 4v4 teams allowed"
Exit Sub
End If
End If

GameOn = 1
AddQ "Dota " & Mode & " game created by " & Username
AddQ "Use " & BotVars.Trigger & "sign to sign in and " & BotVars.Trigger & "out to signout"
TimerEnabled "ngoc", "StartGame", TRUE

End Sub

'********************
'**Start Game Timer**
'********************

Sub ngoc_StartGame_Timer()

If Teams = "5v5" Then
Compare = 10
ElseIf Teams = "4v4" Then
Compare = 8
End If

If Compare > SignedAmnt Then
TimerEnabled "NGOC", "StartGame", FALSE
AddChat vbBlue, "Lol we passed it"
AddQ "The game is full!!"
AddQ "Please type " & BotVars.Trigger & "confirm to start the game"
ElseIf Compare = SignedAmnt Then
TimerEnabled "NGOC", "StartGame", FALSE
AddQ "The game is full!!"
AddQ "Please type " & BotVars.Trigger & "confirm to start the game"
End If

End Sub

'************
'**Confirm***
'************

Sub ngoc_Confirm

If GameOn = 0 Then
Exit Sub
End If

GN = GN + 1
AddQ "Confirmed"
AddQ "GN = " & Clan & "" & GN & " Mode = " & Mode & " Teams = " & Teams

AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

GameOn = 0
Teams = 0
Mode = 0

End Sub

'*****************
'***Cancel Game***
'*****************

Sub ngoc_Cancel

If GameOn = 0 Then
Exit Sub
End If

AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

GameOn = 0
Teams = 0
Mode = 0

End Sub




'*****************
'**Signed Up Func*
'*****************

Function SignedUp(Username)
Set rs = db.OpenRecordSet("SELECT * FROM Game ORDER BY Name", db_cModeReadOnly)
AddChat vbBlue, "Searching for a player ..."
rs.MoveFirst
rs.Find "Name='" & Username & "'"
If Not rs.EOF Then
AddChat vbBlue, "Found player!"
SignedUp = 1
Else
AddChat vbBlue, "Could not find player!"
SignedUp = 0
End If
End Function



'******************
'**J3M's CLass*****
'******************


Class db_clsDatabase

Private path_, conn_, xconn_

Public Function Exists(path)
Dim fso
Exists = False
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(path) Then
Exists = True
End If
Set fso = Nothing
End Function

Public Function Close()
If Not conn_ Is Nothing Then
If IsOpen() Then
conn_.Close
End If
Set conn_ = Nothing
End If
Close = True
End Function

Public Function IsOpen()
IsOpen = False
If Not conn_ Is Nothing Then
If conn_.State = 1 Then
IsOpen = True
End If
End If
End Function

Public Function Open(path)
On Error Resume Next
Close()
Open = False
path_ = path
Set conn_ = CreateObject("ADODB.Connection")
conn_.Provider = "Microsoft.Jet.OLEDB.4.0"
conn_.Open path_
If IsOpen() Then
Set xconn_ = CreateObject("ADOX.Catalog")
xconn_.ActiveConnection = conn_
Open = True
End If
If Err.Number <> 0 Then
AddChat vbRed, "Error in Open('" & path & "'): " & Err.Description
Err.Clear
End If
End Function

Public Function Create(path)
On Error Resume Next
Dim obj_
Close()
Set obj_ = CreateObject("ADOX.Catalog")
obj_.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB:Engine Type=5;Data Source=" & path
Set obj_ = Nothing
Create = Open(path)
If Err.Number <> 0 Then
AddChat vbRed, "Error in Create('" & path & "'): " & Err.Description
Err.Clear
End If
End Function

Public Function TableExists(tabname)
Dim i
TableExists = False
If Not IsOpen() Then Exit Function
If xconn_.Tables.Count = 0 Then Exit Function
For i = 0 To xconn_.Tables.Count - 1
If UCase(tabname) = UCase(xconn_.Tables(i).Name) Then
TableExists = True
Exit Function
End If
Next
End Function

Public Function ColumnExists(tabname, colname)
Dim i, t
ColumnExists = False
If Not IsOpen() Then Exit Function
If Not TableExists(tabname) Then Exit Function
Set t = xconn_.Tables(tabname)
If t.Columns.Count = 0 Then Exit Function
For i = 0 To t.Columns.Count - 1
If UCase(colname) = UCase(t.Columns(i).Name) Then
ColumnExists = True
Exit Function
End If
Next
End Function

Public Function CreateTable(tabname)
On Error Resume Next
Dim tbl_
If Not IsOpen() Then Exit Function
If TableExists(tabname) Then Exit Function
Set tbl_ = CreateObject("ADOX.Table")
tbl_.Name = tabname
xconn_.Tables.Append tbl_
CreateTable = True
If Err.Number <> 0 Then
AddChat vbRed, "Error in CreateTable('" & tabname & "'): " & _
Err.Description
Err.Clear
End If
End Function

Public Property Get Table(tabname)
On Error Resume Next
Dim tbl_
Set tbl_ = Nothing
If IsOpen() Then
Set tbl_ = xconn_.Tables(tabname)
End If
Set Table = tbl_
If Err.Number <> 0 Then
AddChat vbRed, "Error in Table('" & tabname & "'): " & Err.Description
Err.Clear
End If
End Property

Public Function OpenRecordset(sql, mode)
On Error Resume Next
Dim rs_
Set OpenRecordset = Nothing
If Not IsOpen() Then Exit Function
Set rs_ = CreateObject("ADODB.Recordset")
rs_.ActiveConnection = conn_
Select Case mode
Case db_cModeReadOnly
rs_.CursorType = 2 ' adOpenStatic
rs_.LockType = 1 ' adLockReadOnly
Case db_cModeForUpdate
rs_.CursorType = 1 ' adOpenKeyset
rs_.LockType = 3 ' adLockOptimistic
Case Else
rs_.CursorType = 0 ' adOpenForwardOnly
rs_.LockType = 1 ' adLockReadOnly
End Select
rs_.Source = sql
rs_.Open
If Err.Number <> 0 Then
AddChat vbRed, "Error in OpenRecordSet('" & sql & "', " & _
mode & "): " & Err.Description
Err.Clear
Exit Function
End If
Set OpenRecordset = rs_
End Function

Public Function ExecuteQuery(sql)
On Error Resume Next
Dim rs_, rows_affected
ExecuteQuery = 0
If Not IsOpen() Then Exit Function
Set rs_ = conn_.Execute(sql, rows_affected)
ExecuteQuery = rows_affected
If Err.Number <> 0 Then
AddChat vbRed, "Error in ExecuteQuery('" & sql & "'): " & Err.Description
Err.Clear
End If
End Function

End Class

Private Sub Class_Initialize()
path_ = BotPath() & "plugins\NGOCData.mdb"
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub
Private Sub Class_Terminate()
Close()
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub


Java-
I think he made it load as a script and not as a plugin.

And yea I'm still getting the Error Mismatch.
Hero.A
It shouldnt matter if it loads as a script or a plugin..
If it loads as a script it will ask if you want it converted to plugin. Which simply adds the lines

'ngoc
'1.0

then adds ngoc before all subs such as
ngoc_event_usertalk
Mondster
QUOTE(Hero.A @ Dec 16 2007, 04:39 AM) *

It shouldnt matter if it loads as a script or a plugin..
If it loads as a script it will ask if you want it converted to plugin. Which simply adds the lines

No, i mean with loading as script: u have to put it in the stealthbot ordner directly as script.txt and not in the plugin folder. But its a bit difficult: u have to delete the prefix befor all Event Subs and u cant use the timer in that way u do in plugins. And after it, overwrite the script with ur old script-file! Its just to see the error reasons and the blue messages from load sub.
I changed nothing more and Im german, thats why my messages are in german too wink.gif
Java-
Is there any reason why its not working though?
Hero.A
QUOTE(Pawleys-Island @ Dec 16 2007, 09:44 AM) *

Is there any reason why its not working though?

I see no reason why it is not working.

It is not working though.

Mondster when you put it into the script.txt change this line of the the load sub

Before
CODE

Set t = db.Table("Players")


After
CODE

Set t = db.Table("Game")


Tell me if it works then.
Java-
Oh and the anti-spam thing wasn't working cause of the script, its fixed now though. So it wasn't a conflicting thing.
Hero.A
Yes i noticed that in your post. Thanks for confirming it though
Swent
QUOTE(Mondster @ Dec 15 2007, 04:36 PM) *

QUOTE(Samot @ Dec 15 2007, 10:27 PM) *

How do you get the offending line in stealth bot?

If u load the plugin not as plugin, but as script. Then u will see the line number, the error reason and the line with this error. Take that in mind for new scripts wink.gif


For now that is correct, but messing for your script.txt can damage the operation of the Plugin System if you don't know what you're doing. I would also suggest executing scripts your debugging inside .vbs files.

You can look forward to StealthBot 2.7, when neither or these methods will be necessary. Plugin errors will show offending lines, as well as the correct line and column number.
NameLess
Can anyone post the whole script with out mistakes?
Java-
It still has mistakes in it.
Hero.A
It is sadly still having errors.
Here is the current version though .06
CODE

'ngoc
'0.06

'By Hero.A ~
'Set Clan to your clan and security to the number i give you!
Public Clan, Security
Clan = "You Clan Tag Here"
Security = "10" 'Put the number from me here!

'************************
'*******Variables*********
'**For Database and Code**
'*************************

Private Const db_cTypeBoolean = 11
Private Const db_cTypeCurrency = 6
Private Const db_cTypeDate = 7
Private Const db_cTypeDouble = 5
Private Const db_cTypeInteger = 3
Private Const db_cTypeText = 202

Private Const db_cModeReadOnly = 1
Private Const db_cModeForUpdate = 2


Public Compare, Confirm, GameOn, SignedUp, SignedAmnt, Data, Teams, Mode



Sub ngoc_Event_Load()

AddChat vbBlue, "Welcome to the NGOC Game Script By: Hero.A Ver: 1.0"
AddChat vbBlue, "Most messages in blue are this script working. (it may show messages you do not understand)"


TimerInterval "ngoc", "StartGame", 5
TimerEnabled "ngoc", "StartGame", FALSE

Dim db, t, db_path, rs, l

Set db = New db_clsDatabase
db_path = BotPath() & "plugins\NGOCData.mdb"


'***************************
'**Setting Up the Database**
'***************************

If not db.Exists(db_path) Then
If Not db.Create(db_path) Then
AddChat vbRed, "Unable to Create Database!"
Exit Sub
End If
Else
If Not db.Open(db_path) Then
AddChat vbRed, "Unable to Open Database!"
Exit Sub
End If
End If

If db.IsOpen() Then
AddChat vbBlue, "Database opened."
Else
Exit Sub
End If

If Not db.TableExists("Game") Then
If db.CreateTable("Game") Then
AddChat vbBlue, "Created Table Game"
Else
AddChat vbRed, "Could not create Table Game"
Exit Sub
End If
End If


Set t = db.Table("Game")
If Not db.ColumnExists(t.Name, "Name") Then
t.Columns.Append "Name", db_cTypeText, 32
AddChat vbBlue, "Created Column Name"
End If
AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

End Sub

'************
'**Commands**
'************

Sub ngoc_event_usertalk(Username, Flags, Message, Ping)

If Left(Message, 1) = BotVars.Trigger Then
GetDBEntry Username, myAccess, myFlags
If myAccess >= 20 Then
If lcase(left(message, 5)) = BotVars.Trigger & "sign" Then
ngoc_Sign Username
ElseIf lcase(left(message, 4)) = BotVars.Trigger & "out" Then
ngoc_Out Username
ElseIf lcase(left(message, 10)) = BotVars.Trigger & "startgame " Then
ngoc_startgame Username, Message
ElseIf lcase(left(message, 8)) = BotVars.Trigger & "confirm" Then
ngoc_Confirm
ElseIf lcase(left(message, 11)) = BotVars.Trigger & "cancelgame" Then
ngoc_Cancel
End If
End If
Else
Exit Sub
End If

End Sub

'**************
'***Sign Sub***
'**************

Sub ngoc_Sign(Username)

If GameOn = 0 Then
Exit Sub
End If

If SignedUp(Username) = 0 Then
AddQ "/me " & Username & " has signed into the game"
Set rs = db.OPenRecordSet("Game", db_cModeForUpdate)
rs.AddNew
rs("Name") = Username
rs.Update
rs.Close
SignedAmnt = SignedAmnt + 1
Else
Exit Sub
End If

End Sub


'*****************
'****Out Sub******
'*****************


Sub ngoc_Out(Username)

If GameOn = 0 Then
Exit Sub
End If

If SignedUp(Username) = 1 Then
AddQ "/me " & Username & " has signed out of the game"
db.ExecuteQuery("DELETE FROM Game WHERE Name = '" & Username & "'")
SignedAmnt = SignedAmnt - 1
Else
Exit Sub
End If

End Sub


'******************
'**Start Game Sub**
'******************

Sub ngoc_startgame(Username, Message)

If GameOn = 0 Then
AddQ "Please Wait"
Exit Sub
End If

Data = Split(Message, " ")
Mode = Data(1)
Teams = Data(2)

AddChat vbBlue, "Checking Data..."
AddChat vbBlue, "Teams = " & Teams & " Mode = " & Mode

If lcase(Teams) <> "5v5" Then
If lcase(Teams) <> "4v4" Then
AddQ "Only 5v5 or 4v4 teams allowed"
Exit Sub
End If
End If

GameOn = 1
AddQ "Dota " & Mode & " game created by " & Username
AddQ "Use " & BotVars.Trigger & "sign to sign in and " & BotVars.Trigger & "out to signout"
TimerEnabled "ngoc", "StartGame", TRUE

End Sub

'********************
'**Start Game Timer**
'********************

Sub ngoc_StartGame_Timer()

If Teams = "5v5" Then
Compare = 10
ElseIf Teams = "4v4" Then
Compare = 8
End If

If Compare > SignedAmnt Then
TimerEnabled "NGOC", "StartGame", FALSE
AddChat vbBlue, "Lol we passed it"
AddQ "The game is full!!"
AddQ "Please type " & BotVars.Trigger & "confirm to start the game"
ElseIf Compare = SignedAmnt Then
TimerEnabled "NGOC", "StartGame", FALSE
AddQ "The game is full!!"
AddQ "Please type " & BotVars.Trigger & "confirm to start the game"
End If

End Sub

'************
'**Confirm***
'************

Sub ngoc_Confirm

If GameOn = 0 Then
Exit Sub
End If

GN = GN + 1
AddQ "Confirmed"
AddQ "GN = " & Clan & "" & GN & " Mode = " & Mode & " Teams = " & Teams

AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

GameOn = 0
Teams = 0
Mode = 0

End Sub

'*****************
'***Cancel Game***
'*****************

Sub ngoc_Cancel

If GameOn = 0 Then
Exit Sub
End If

AddChat vbBlue, "Deleting all records from Game ..."
l = db.ExecuteQuery("DELETE FROM Game")
AddChat vbBlue, "Deleted "

GameOn = 0
Teams = 0
Mode = 0

End Sub




'*****************
'**Signed Up Func*
'*****************

Function SignedUp(Username)
Set rs = db.OpenRecordSet("SELECT * FROM Game ORDER BY Name", db_cModeReadOnly)
AddChat vbBlue, "Searching for a player ..."
rs.MoveFirst
rs.Find "Name='" & Username & "'"
If Not rs.EOF Then
AddChat vbBlue, "Found player!"
SignedUp = 1
Else
AddChat vbBlue, "Could not find player!"
SignedUp = 0
End If
End Function



'******************
'**J3M's CLass*****
'******************


Class db_clsDatabase

Private path_, conn_, xconn_

Public Function Exists(path)
Dim fso
Exists = False
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(path) Then
Exists = True
End If
Set fso = Nothing
End Function

Public Function Close()
If Not conn_ Is Nothing Then
If IsOpen() Then
conn_.Close
End If
Set conn_ = Nothing
End If
Close = True
End Function

Public Function IsOpen()
IsOpen = False
If Not conn_ Is Nothing Then
If conn_.State = 1 Then
IsOpen = True
End If
End If
End Function

Public Function Open(path)
On Error Resume Next
Close()
Open = False
path_ = path
Set conn_ = CreateObject("ADODB.Connection")
conn_.Provider = "Microsoft.Jet.OLEDB.4.0"
conn_.Open path_
If IsOpen() Then
Set xconn_ = CreateObject("ADOX.Catalog")
xconn_.ActiveConnection = conn_
Open = True
End If
If Err.Number <> 0 Then
AddChat vbRed, "Error in Open('" & path & "'): " & Err.Description
Err.Clear
End If
End Function

Public Function Create(path)
On Error Resume Next
Dim obj_
Close()
Set obj_ = CreateObject("ADOX.Catalog")
obj_.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB:Engine Type=5;Data Source=" & path
Set obj_ = Nothing
Create = Open(path)
If Err.Number <> 0 Then
AddChat vbRed, "Error in Create('" & path & "'): " & Err.Description
Err.Clear
End If
End Function

Public Function TableExists(tabname)
Dim i
TableExists = False
If Not IsOpen() Then Exit Function
If xconn_.Tables.Count = 0 Then Exit Function
For i = 0 To xconn_.Tables.Count - 1
If UCase(tabname) = UCase(xconn_.Tables(i).Name) Then
TableExists = True
Exit Function
End If
Next
End Function

Public Function ColumnExists(tabname, colname)
Dim i, t
ColumnExists = False
If Not IsOpen() Then Exit Function
If Not TableExists(tabname) Then Exit Function
Set t = xconn_.Tables(tabname)
If t.Columns.Count = 0 Then Exit Function
For i = 0 To t.Columns.Count - 1
If UCase(colname) = UCase(t.Columns(i).Name) Then
ColumnExists = True
Exit Function
End If
Next
End Function

Public Function CreateTable(tabname)
On Error Resume Next
Dim tbl_
If Not IsOpen() Then Exit Function
If TableExists(tabname) Then Exit Function
Set tbl_ = CreateObject("ADOX.Table")
tbl_.Name = tabname
xconn_.Tables.Append tbl_
CreateTable = True
If Err.Number <> 0 Then
AddChat vbRed, "Error in CreateTable('" & tabname & "'): " & _
Err.Description
Err.Clear
End If
End Function

Public Property Get Table(tabname)
On Error Resume Next
Dim tbl_
Set tbl_ = Nothing
If IsOpen() Then
Set tbl_ = xconn_.Tables(tabname)
End If
Set Table = tbl_
If Err.Number <> 0 Then
AddChat vbRed, "Error in Table('" & tabname & "'): " & Err.Description
Err.Clear
End If
End Property

Public Function OpenRecordset(sql, mode)
On Error Resume Next
Dim rs_
Set OpenRecordset = Nothing
If Not IsOpen() Then Exit Function
Set rs_ = CreateObject("ADODB.Recordset")
rs_.ActiveConnection = conn_
Select Case mode
Case db_cModeReadOnly
rs_.CursorType = 2 ' adOpenStatic
rs_.LockType = 1 ' adLockReadOnly
Case db_cModeForUpdate
rs_.CursorType = 1 ' adOpenKeyset
rs_.LockType = 3 ' adLockOptimistic
Case Else
rs_.CursorType = 0 ' adOpenForwardOnly
rs_.LockType = 1 ' adLockReadOnly
End Select
rs_.Source = sql
rs_.Open
If Err.Number <> 0 Then
AddChat vbRed, "Error in OpenRecordSet('" & sql & "', " & _
mode & "): " & Err.Description
Err.Clear
Exit Function
End If
Set OpenRecordset = rs_
End Function

Public Function ExecuteQuery(sql)
On Error Resume Next
Dim rs_, rows_affected
ExecuteQuery = 0
If Not IsOpen() Then Exit Function
Set rs_ = conn_.Execute(sql, rows_affected)
ExecuteQuery = rows_affected
If Err.Number <> 0 Then
AddChat vbRed, "Error in ExecuteQuery('" & sql & "'): " & Err.Description
Err.Clear
End If
End Function

End Class

Private Sub Class_Initialize()
path_ = BotPath() & "plugins\NGOCData.mdb"
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub
Private Sub Class_Terminate()
Close()
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub



leax
this function seems to have syntax error in it
at least it shows up as such in vb studio 2008 express IDE

CODE

Public Property Get Table(tabname)
On Error Resume Next
Dim tbl_
Set tbl_ = Nothing
If IsOpen() Then
Set tbl_ = xconn_.Tables(tabname)
End If
Set Table = tbl_
If Err.Number <> 0 Then
AddChat vbRed, "Error in Table('" & tabname & "'): " & Err.Description
Err.Clear
End If
End Property


oh also i think its much easier to debug if u declear variable datatypes, at least the type mismatch would show up on ur compiler
Mondster
QUOTE(Hero.A @ Dec 16 2007, 08:34 PM) *

Tell me if it works then.

I can tell u that 'db.Open(db_path)' gives this Error:
QUOTE
Error in Open('C:\Stealthbot\plugins\NGOCData.mdb'): Object required

I did some plugins with Databes too, but quit another way. So i cant tell u how to fix.
FiftyToo
QUOTE(leax @ Dec 17 2007, 01:11 AM) *

oh also i think its much easier to debug if u declear variable datatypes, at least the type mismatch would show up on ur compiler


You cannot declare the datatypes in vbs, nor is it compiled.

52
riffruff
Are you sure you wrote ALL this??

I've scanned through most of it, and a lot of it looks like my dota script...
Hero.A
I wrote all of this code. I used some dota script for reference since i am starting but then i used many other things for reference.

If you did write one and i did use it for reference it did not have your name on it. Sorry if i did.

But yes i wrote all this. I wrote it into a notebook then typed it up.
Java-
Any update on this?
Hero.A
QUOTE(Mondster @ Dec 17 2007, 08:00 AM) *

QUOTE(Hero.A @ Dec 16 2007, 08:34 PM) *

Tell me if it works then.

I can tell u that 'db.Open(db_path)' gives this Error:
QUOTE
Error in Open('C:\Stealthbot\plugins\NGOCData.mdb'): Object required

I did some plugins with Databes too, but quit another way. So i cant tell u how to fix.


Wouldn't that mean it isnt making the database?



I have looked into the usertalk sub and i dont see a reason it should be erroring.
Since i have it using subs like so
CODE

        If lcase(left(message, 5)) = BotVars.Trigger & "sign" Then            ngoc_Sign Username


Does that mean that if there is an error in that sub it will say the error is in usertalk?


@Pawley - No updates yet sorry
Java-
Well, hopefully it is resolved soon!
NameLess



Could you post us your script?
Hero.A
QUOTE(NameLess @ Dec 18 2007, 06:45 PM) *

Could you post us your script?

Be specific... Who post what script? ~ If your not going to help with the code in this topic please don't post on it
Java-
Gotta keep this on top, someone had to know.
NameLess
QUOTE(Hero.A @ Dec 18 2007, 08:18 PM) *

QUOTE(NameLess @ Dec 18 2007, 06:45 PM) *

Could you post us your script?

Be specific... Who post what script? ~ If your not going to help with the code in this topic please don't post on it


Sorry Hero.A my bad.

QUOTE(riffruff @ Dec 17 2007, 07:10 PM) *

Are you sure you wrote ALL this??

I've scanned through most of it, and a lot of it looks like my dota script...


if he could post his script.
kirill
CODE
'dotaclan
'1.0

Private Const db_cTypeBoolean = 11
Private Const db_cTypeCurrency = 6
Private Const db_cTypeDate = 7
Private Const db_cTypeDouble = 5
Private Const db_cTypeInteger = 3
Private Const db_cTypeText = 202
Private Const db_cModeReadOnly = 1
Private Const db_cModeForUpdate = 2
Public pGameStatus
Public pChallenger
Public pChallenged
Public pTeams
Public pMode
Public runme
const forReading = 1
const forWriting = 2
const forAppending = 8
dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
dim db
Set db = New db_clsDatabase
dim db_path
db_path = BotPath() & "plugins\dotaclan.mdb"

Sub dotaclan_event_load()
TimerInterval "dotaclan", "enoughppl", 5
TimerEnabled "dotaclan", "enoughppl", False
Dim t, rs, l
pGameStatus = 0
If Not db.Exists(db_path) Then
If Not db.Create(db_path) Then
AddChat vbRed, "Could not create database!"
Exit Sub
End If
Else
If Not db.Open(db_path) Then
AddChat vbRed, "Could not open database!"
Exit Sub
End If
End If
If db.IsOpen() Then
AddChat vbGreen, "Database opened."
Else
Exit Sub
End If

If Not db.TableExists("Players") Then
If db.CreateTable("Players") Then
AddChat vbGreen, "Created Table Players"
Else
AddChat vbRed, "Could not create Table Players"
Exit Sub
End If
End If

If Not db.TableExists("Captains") Then
If db.CreateTable("Captains") Then
AddChat vbGreen, "Created Table Captains"
Else
AddChat vbRed, "Could not create Table Captains"
Exit Sub
End If
End If

If Not db.TableExists("Records") Then
If db.CreateTable("Records") Then
AddChat vbGreen, "Created Table Records"
Else
AddChat vbRed, "Could not create Table Records"
Exit Sub
End If
End If

Set t = db.Table("Players")
If Not db.ColumnExists(t.Name, "Name") Then
t.Columns.Append "Name", db_cTypeText, 40
AddChat vbGreen, "Created Column Name in Table Players"
End If
If Not db.ColumnExists(t.Name, "Captain") Then
t.Columns.Append "Captain", db_cTypeText, 40
AddChat vbGreen, "Created Column Captain in Table Players"
End If

Set t = db.Table("Captains")
If Not db.ColumnExists(t.Name, "Name") Then
t.Columns.Append "Name", db_cTypeText, 40
AddChat vbGreen, "Created Column Name in Table Captains"
End If

Set t = db.Table("Records")
If Not db.ColumnExists(t.Name, "Name") Then
t.Columns.Append "Name", db_cTypeText, 40
AddChat vbGreen, "Created Column Name in Table Records"
End If
If Not db.ColumnExists(t.Name, "Experience") Then
t.Columns.Append "Experience", db_cTypeText, 40
AddChat vbGreen, "Created Column Experience in Table Records"
End If
If Not db.ColumnExists(t.Name, "Wins") Then
t.Columns.Append "Wins", db_cTypeText, 40
AddChat vbGreen, "Created Column Wins in Table Records"
End If
If Not db.ColumnExists(t.Name, "Losses") Then
t.Columns.Append "Losses", db_cTypeText, 40
AddChat vbGreen, "Created Column Losses in Table Records"
End If

AddChat vbWhite, "Deleting all records from Captains ..."
l = db.ExecuteQuery("DELETE FROM Captains")
AddChat vbWhite, "Deleted " & l & " records."
AddChat vbWhite, "Deleting all records from Players ..."
l = db.ExecuteQuery("DELETE FROM Players")
AddChat vbWhite, "Deleted " & l & " records."


set File = fso.OpenTextFile("users.txt", ForReading, 1)
x = 0
Do Until File.AtEndOfStream
Data = File.ReadLine
Data = Split(Data, " ", 2)

If lcase(Data(1)) = "q" Then
AddChat vbWhite, "Inserting Captain " & Data(0) & " ..."
l = db.ExecuteQuery("INSERT INTO Captains (Name) VALUES ('" & Data(0) & "')")
x = x + 1
End If
If InStr(Data(1), " ") > 0 Then
Datb = Split(Data(1), " ", 2)
AddChat vbWhite, "Inserting Captain " & Data(0) & " ..."
l = db.ExecuteQuery("INSERT INTO Captains (Name) VALUES ('" & Data(0) & "')")
x = x + 1
End If
Loop
File.Close
AddChat vbRed, "I have added " & x & " Captain(s) to my list."
End Sub

Sub dotaclan_Event_WhisperFromUser(Username, Flags, Message)
dotaclan_Command Username, Message, 3
End Sub
Sub dotaclan_Event_usertalk(Username, Flags, Message, Ping)
dotaclan_Command Username, Message, 1
End Sub

Sub dotaclan_Command(Username, Message, From)
if left(message, 1) = BotVars.Trigger Then
getdbentry Username, myAccess, myFlags
if IsCaptain(Username) = 1 Then
if lcase(left(message, 11)) = BotVars.Trigger & "challenge " Then
dotaclan_challenge Username, Message
elseif lcase(left(message, 8)) = BotVars.Trigger & "result " Then
dotaclan_result Username, Message
elseif lcase(left(message, 7)) = BotVars.Trigger & "accept" Then
dotaclan_accept Username
elseif lcase(left(message, 5)) = BotVars.Trigger & "deny" Then
dotaclan_deny Username
elseif lcase(left(message, 6)) = BotVars.Trigger & "teams" Then
dotaclan_teams From, Username
elseif lcase(left(message, 8)) = BotVars.Trigger & "players" Then
dotaclan_players Username
elseif lcase(left(message, 8)) = BotVars.Trigger & "leaver " Then
dotaclan_leaver Message
elseif lcase(left(message, 5)) = BotVars.Trigger & "pool" Then
dotaclan_pool
elseif lcase(left(message, 6)) = BotVars.Trigger & "pick " Then
dotaclan_pick Username, Message
elseif lcase(left(message, 7)) = BotVars.Trigger & "cancel" Then
dotaclan_cancel Username
end if
End If
If myAccess > 9 Then
if lcase(left(message, 5)) = BotVars.Trigger & "host" Then
dotaclan_host Username
elseif lcase(left(message, 6)) = BotVars.Trigger & "top10" Then
dotaclan_top10
elseif lcase(left(message, 6)) = BotVars.Trigger & "rank " Then
dotaclan_rankother Message
end if
End If
If lcase(left(message, 7)) = BotVars.Trigger & "signin" Then
dotaclan_signin Username
Elseif lcase(left(message, 8)) = BotVars.Trigger & "signout" Then
dotaclan_signout Username
Elseif lcase(message) = BotVars.Trigger & "rank" Then
dotaclan_rank Username
End If
Else
Exit Sub
End If
End Sub

Sub dotaclan_challenge(Challenger, Message)
Data = Split(Message, " ")
Challenged = Data(1)
Teams = Data(2)
Mode = Data(3)
AddChat vbWhite, "Challenged = " & Challenged
AddChat vbWhite, "Challenger = " & Challenger
If GameStatus = 1 Then
AddQ "Sorry, but I am already in charge of a game. Please wait for it to finish."
End If
If lcase(Challenged) = lcase(Challenger) Then
AddQ "Can't challenge yourself!!"
Exit Sub
Else
Addchat vbwhite, "Not Challenging self, continue."
End If
If IsCaptain(Challenged) = 1 Then
AddChat vbWhite, Challenged & " is a captain, and is challengable."
If lcase(Teams) <> "4v4" Then
If lcase(Teams) <> "5v5" Then
If lcase(Teams) <> "8" Then
If lcase(Teams) <> "10" Then
AddQ "Only 5v5 or 4v4 teams are allowed!"
Exit Sub
End If
End If
End If
End If
If lcase(Mode) <> "ap" Then
If lcase(Mode) <> "ar" Then
If lcase(Mode) <> "mr" Then
If lcase(Mode) <> "tr" Then
If lcase(Mode) <> "lm" Then
If lcase(Mode) <> "rd" Then
AddQ "Only the following modes are allowed...ap, ar, mr, tr, lm, rd"
Exit Sub
End if
End If
End If
End If
End If
End If
If InChannel(Challenged) = 1 Then
AddChat vbwhite, "In Channel"
Else
AddQ "Challenged captain must be in the channel!"
Exit Sub
End If
pGameStatus = 1
pChallenger = Challenger
pChallenged = Challenged
pTeams = Teams
pMode = Mode
AddQ "/me " & pChallenger & " has challenged " & pChallenged & " for a Gather game " & pTeams & " Mode -" & pMode
AddQ "/w " & pChallenged & " " & pChallenger & " has challenge YOU for a Gather Game " & pTeams & " Mode -" & pMode & ", Type " & BotVars.Trigger & "accept to accept the challenge or " & BotVars.Trigger & "deny to cancel the challenge."
Else
AddChat vbRed, "Not a captain, canceling request."
AddQ Challenged & " is not a captain, and may not be challenged."
Exit Sub
End If
End Sub

Sub dotaclan_result(Username, Message)
If pGameStatus = 0 Then
AddQ "There is no game to report on!"
Exit Sub
End If
End Sub

Sub dotaclan_accept(Username)
If pGameStatus = 0 Then
AddQ "You have not been challenged!"
Exit Sub
End If
If lcase(Username) = lcase(pChallenged) Then
AddChat vbWhite, "Inserting 2 captains via recordset ..."
Set rs = db.OpenRecordSet("Players", db_cModeForUpdate)
rs.AddNew
rs("Name") = pChallenger
rs("Captain") = "Self"
rs.Update
rs.AddNew
rs("Name") = pChallenged
rs("Captain") = "Self"
rs.Update
rs.Close()
AddChat vbWhite, "2 Captains inserted, Done!"
TimerEnabled "dotaclan", "enoughppl", True
AddQ "/me " & pchallenged & " has accepted " & pchallenger & "'s challenge for a Gather Game " & pTeams & " Mode -" & pMode & ", Type " & BotVars.Trigger & "signin to sign in the Gather Game or " & BotVars.Trigger & "signout to sign out of the Gather Game."
End If
End Sub

Sub dotaclan_deny(Username)
If pGameStatus = 0 Then
AddQ "You have not been challenged!"
Exit Sub
End If
If lcase(Username) = lcase(pChallenged) Then
AddQ "/me " & pchallenged & " has declined " & pchallenger &"'s challenge for a Gather Game."
pGameStatus = 0
pChallenger = 0
pChallenged = 0
pTeams = 0
pMode = 0
TimerEnabled "dotaclan", "enoughppl", False
End If
End Sub

Sub dotaclan_teams(Whispered, Username)
If pGameStatus = 0 Then
AddQ "There are no teams to report!"
Exit Sub
End If
x = "Players on " & pChallenger & "'s team: "
Set rs = db.OpenRecordSet("SELECT * FROM Players ORDER BY Captain", db_cModeReadOnly)
Do While Not rs.EOF
If rs("Captain") = pChallenger Then
x = x & rs("Name") & ", "
End If
rs.MoveNext
Loop
DSP Whispered, x, Username, vbWhite
x = "Players on " & pChallenged & "'s team: "
Set rs = db.OpenRecordSet("SELECT * FROM Players ORDER BY Captain", db_cModeReadOnly)
Do While Not rs.EOF
If rs("Captain") = pChallenged Then
x = x & rs("Name") & ", "
End If
rs.MoveNext
Loop
DSP Whispered, x, Username, vbWhite
x = "Players on no team: "
Set rs = db.OpenRecordSet("SELECT * FROM Players ORDER BY Captain", db_cModeReadOnly)
Do While Not rs.EOF
If rs("Captain") = "None" Then
x = x & rs("Name") & ", "
End If
rs.MoveNext
Loop
DSP Whispered, x, Username, vbWhite
End Sub

Sub dotaclan_players(Username)
If pGameStatus = 0 Then
AddQ "There are no players to report!"
Exit Sub
End If
x = "Players on your team: "
Set rs = db.OpenRecordSet("SELECT * FROM Players ORDER BY Captain", db_cModeReadOnly)
Do While Not rs.EOF
If rs("Captain") = Username Then
x = x & rs("Name") & ", "
End If
rs.MoveNext
Loop
DSP 1, x, Username, vbWhite
End Sub

Sub dotaclan_leaver(Message)
If pGameStatus = 0 Then
AddQ "There are no leavers to report!"
Exit Sub
End If
End Sub

Sub dotaclan_pool()
If pGameStatus = 0 Then
AddQ "There are no players to report!"
Exit Sub
End If
x = "Players: "
Set rs = db.OpenRecordSet("SELECT * FROM Players ORDER BY Name", db_cModeReadOnly)
Do While Not rs.EOF
if rs("Captain") = "None" Then
x = x & rs("Name") & ", "
End If
rs.MoveNext
Loop
DSP 1, x, pChallenger, vbWhite
End Sub

Sub dotaclan_pick(Username, Message)
If pGameStatus = 0 Then
AddQ "There is no game to pick for!"
Exit Sub
End If
' If runme = 1 Then
' Exit Sub
' End If
' If lcase(Username) <> lcase(pChallenged) Then
' If lcase(Username) <> lcase(pChallenger) Then
' Exit Sub
' End If
' End If
Msg = Split(Message, " ")
If SignedUp(Msg(1)) = 1 Then

db.ExecuteQuery("DELETE FROM Players WHERE Name='" & capUsernames(Msg(1)) & "'")
Set rs = db.OpenRecordSet("Players", db_cModeForUpdate)
rs.AddNew
rs("Name") = capUsernames(Msg(1))
rs("Captain") = Username
rs.Update
rs.Close()
Exit Sub
AddQ "/me " & Username & " has picked " & Msg(1)
End If
End Sub

Sub dotaclan_cancel(Username)
If pGameStatus = 0 Then
AddQ "There is nothing to cancel!"
Exit Sub
End If
If lcase(Username) <> lcase(pChallenger) Then
If lcase(Username) <> lcase(pChallenged) Then
Exit Sub
End If
End If
AddChat vbWhite, "Deleting all records from Players ..."
l = db.ExecuteQuery("DELETE FROM Players")
AddChat vbWhite, "Deleted " & l & " records."
AddQ "/me " & Username & " has CANCELED the Gather Game."
pGameStatus = 0
pChallenger = 0
pChallenged = 0
pTeams = 0
pMode = 0
TimerEnabled "dotaclan", "enoughppl", False
End Sub

Sub dotaclan_host(Username)
If pGameStatus = 0 Then
AddQ "There is nothing to host!"
Exit Sub
End If
End Sub

Sub dotaclan_top10()
AddQ "Top 10"
End Sub

Sub dotaclan_rankother(Message)
AddQ "Checking the rank of another user"
End Sub

Sub dotaclan_signin(Username)
If pGameStatus = 0 Then
AddQ "There is nothing to signin to!"
Exit Sub
End If
If SignedUp(Username) = 0 Then
AddQ "/me " & Username & " has signed into the Gather Game."
Set rs = db.OpenRecordSet("Players", db_cModeForUpdate)
rs.AddNew
rs("Name") = Username
rs("Captain") = "None"
rs.Update
rs.Close
Else
Exit Sub
End If
End Sub

Sub dotaclan_signout(Username)
If pGameStatus = 0 Then
AddQ "There is nothing to sign out of!"
Exit Sub
End If
If SignedUp(Username) = 1 Then
AddQ "/me " & Username & " has signed out of the Gather Game."
db.ExecuteQuery("DELETE FROM Players WHERE Name='" & Username & "'")
Else
Exit Sub
End If
End Sub

Sub dotaclan_rank(Username)
AddQ "Checking the rank of self"
End Sub














Sub dotaclan_enoughppl_Timer()
runme = 0
' Set rs = db.OpenRecordSet("SELECT * FROM Players ORDER BY Name", db_cModeReadOnly)
' x = 0
' Do While Not rs.EOF
' AddChat vbWhite, rs("Name") & " " & rs("Captain")
' x = x + 1
' rs.MoveNext
' Loop
' If pTeams = "5v5" Then
' TeamsToCompare = "10"
' Elseif pTeams = "4v4" Then
' TeamsToCompare = "8"
' Else
' TeamsToCompare = pTeams
' End If
' x = x + 1
' If TeamsToCompare < x Then
' addchat vbred, "passed teamstocompare < x"
' If runme = 1 Then
' AddQ "/me Enough players have signed up, picking teams has been allowed!"
' runme = 0
' Addchat vbred, "runme = 0, passed runme = 1"
' End If
' ElseIf runme = 0 Then
' addchat vbred, "passed runme = 0 and teamstocompare > x"
' AddQ "/me Until " & TeamsToCompare & " people have signed up, picking teams has been disallowed!"
' runme = 1
' End If
End Sub

'Sub dotaclan_teamfull_Timer()









Function capUsernames(User) '// make sure capitalizaton of usernames in message matches usernames in channel list

For i = 1 to GetInternalUserCount()
nameInChan = GetNameByPosition(i)
If LCase(User) = LCase(nameInChan) Then
capUsernames = nameInChan
End If
Next
End Function

Function UserExists(Username)
Set rs = db.OpenRecordSet("SELECT * FROM Records ORDER BY Name", dbc_ModeReadOnly)
AddChat vbWhite, "Searching for a player ..."
rs.MoveFirst
rs.Find "Name='" & Username & "'"
If Not rs.EOF Then
AddChat vbWhite, "Found player!"
UserExists = 1
Else
AddChat vbRed, "Could not find player!"
UserExists = 0
End If
End Function


Function SignedUp(Username)
Set rs = db.OpenRecordSet("SELECT * FROM Players ORDER BY Name", db_cModeReadOnly)
AddChat vbWhite, "Searching for a player ..."
rs.MoveFirst
rs.Find "Name='" & Username & "'"
If Not rs.EOF Then
AddChat vbWhite, "Found player!"
SignedUp = 1
Else
AddChat vbRed, "Could not find player!"
SignedUp = 0
End If
End Function

Function InChannel(Username)
Addchat vbwhite, "Searching for a user in the channel ..."
State = GetInternalDataByUsername(Username, 0)
If State = -5 Then
addchat vbwhite, "Could not find user!"
InChannel = 0
Else
addchat vbwhite, "User found!"
InChannel = 1
End If
End Function


Function IsCaptain(Username)
Set rs = db.OpenRecordSet("SELECT * FROM Captains ORDER BY Name", db_cModeReadOnly)
AddChat vbWhite, "Searching for a captain ..."
rs.MoveFirst
rs.Find "Name='" & Username & "'"
If Not rs.EOF Then
AddChat vbWhite, "Found captain!"
IsCaptain = 1
Else
AddChat vbRed, "Could not find captain!"
IsCaptain = 0
End If
End Function

Class db_clsDatabase

Private path_, conn_, xconn_

Public Function Exists(path)
Dim fso
Exists = False
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(path) Then
Exists = True
End If
Set fso = Nothing
End Function

Public Function Close()
If Not conn_ Is Nothing Then
If IsOpen() Then
conn_.Close
End If
Set conn_ = Nothing
End If
Close = True
End Function

Public Function IsOpen()
IsOpen = False
If Not conn_ Is Nothing Then
If conn_.State = 1 Then
IsOpen = True
End If
End If
End Function

Public Function Open(path)
On Error Resume Next
Close()
Open = False
path_ = path
Set conn_ = CreateObject("ADODB.Connection")
conn_.Provider = "Microsoft.Jet.OLEDB.4.0"
conn_.Open path_
If IsOpen() Then
Set xconn_ = CreateObject("ADOX.Catalog")
xconn_.ActiveConnection = conn_
Open = True
End If
If Err.Number <> 0 Then
AddChat vbRed, "Error in Open('" & path & "'): " & Err.Description
Err.Clear
End If
End Function

Public Function Create(path)
On Error Resume Next
Dim obj_
Close()
Set obj_ = CreateObject("ADOX.Catalog")
obj_.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB:Engine Type=5;Data Source=" & path
Set obj_ = Nothing
Create = Open(path)
If Err.Number <> 0 Then
AddChat vbRed, "Error in Create('" & path & "'): " & Err.Description
Err.Clear
End If
End Function

Public Function TableExists(tabname)
Dim i
TableExists = False
If Not IsOpen() Then Exit Function
If xconn_.Tables.Count = 0 Then Exit Function
For i = 0 To xconn_.Tables.Count - 1
If UCase(tabname) = UCase(xconn_.Tables(i).Name) Then
TableExists = True
Exit Function
End If
Next
End Function

Public Function ColumnExists(tabname, colname)
Dim i, t
ColumnExists = False
If Not IsOpen() Then Exit Function
If Not TableExists(tabname) Then Exit Function
Set t = xconn_.Tables(tabname)
If t.Columns.Count = 0 Then Exit Function
For i = 0 To t.Columns.Count - 1
If UCase(colname) = UCase(t.Columns(i).Name) Then
ColumnExists = True
Exit Function
End If
Next
End Function

Public Function CreateTable(tabname)
On Error Resume Next
Dim tbl_
If Not IsOpen() Then Exit Function
If TableExists(tabname) Then Exit Function
Set tbl_ = CreateObject("ADOX.Table")
tbl_.Name = tabname
xconn_.Tables.Append tbl_
CreateTable = True
If Err.Number <> 0 Then
AddChat vbRed, "Error in CreateTable('" & tabname & "'): " & _
Err.Description
Err.Clear
End If
End Function

Public Property Get Table(tabname)
On Error Resume Next
Dim tbl_
Set tbl_ = Nothing
If IsOpen() Then
Set tbl_ = xconn_.Tables(tabname)
End If
Set Table = tbl_
If Err.Number <> 0 Then
AddChat vbRed, "Error in Table('" & tabname & "'): " & Err.Description
Err.Clear
End If
End Property

Public Function OpenRecordset(sql, mode)
On Error Resume Next
Dim rs_
Set OpenRecordset = Nothing
If Not IsOpen() Then Exit Function
Set rs_ = CreateObject("ADODB.Recordset")
rs_.ActiveConnection = conn_
Select Case mode
Case db_cModeReadOnly
rs_.CursorType = 2 ' adOpenStatic
rs_.LockType = 1 ' adLockReadOnly
Case db_cModeForUpdate
rs_.CursorType = 1 ' adOpenKeyset
rs_.LockType = 3 ' adLockOptimistic
Case Else
rs_.CursorType = 0 ' adOpenForwardOnly
rs_.LockType = 1 ' adLockReadOnly
End Select
rs_.Source = sql
rs_.Open
If Err.Number <> 0 Then
AddChat vbRed, "Error in OpenRecordSet('" & sql & "', " & _
mode & "): " & Err.Description
Err.Clear
Exit Function
End If
Set OpenRecordset = rs_
End Function

Public Function ExecuteQuery(sql)
On Error Resume Next
Dim rs_, rows_affected
ExecuteQuery = 0
If Not IsOpen() Then Exit Function
Set rs_ = conn_.Execute(sql, rows_affected)
ExecuteQuery = rows_affected
If Err.Number <> 0 Then
AddChat vbRed, "Error in ExecuteQuery('" & sql & "'): " & Err.Description
Err.Clear
End If
End Function

Private Sub Class_Initialize()
path_ = BotPath() & "plugins\dotaclan.mdb"
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub
Private Sub Class_Terminate()
Close()
Set conn_ = Nothing
Set xconn_ = Nothing
End Sub

End Class


This is original reffuf....
but when we remove - '
its stil didnt work... couse he have troubls with timer - Sub dotaclan_enoughppl_Timer()
and confirm - Sub dotaclan_teamfull_Timer()
but in ur script with timers and confirm all ok.... just place ur timer and confirm code to his script and TATATADADADAM - FINISH !!!!!

Edit: Changed code to codebox tags. Oh, and his name is RiffRuff, not "reffuf". -PhiX
Hero.A
Lol mine is different, i guess the genereal people could use that.
That script is still not finished.. Has no ranks or anything even though it has commands for it.
I guess you could slap my timer in there and it would work for purposes.

I might also put a pool command into mine. But mine uses no captains.
riffruff
QUOTE(Hero.A @ Dec 20 2007, 07:16 PM) *

Lol mine is different, i guess the genereal people could use that.
That script is still not finished.. Has no ranks or anything even though it has commands for it.
I guess you could slap my timer in there and it would work for purposes.

I might also put a pool command into mine. But mine uses no captains.

I know it's not finished -- If the person who posted it (which has been pming me and getting annoying) would read the post where he got it from, he would notice I said I'M NOT FINISHING IT, and IT'S NOT FINISHED.

But, if you look at the coding, a lot of it is similar to yours...
Hero.A
Yeah i used that for ideas. it is what possessed me to write this for my clan in the first place. The only thing i accually took was the signup function.

But i can acknoledge u reffuf - rofl reffuf
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2019 Invision Power Services, Inc.