IPB

Welcome Guest ( Log In | Register )

2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

17 Pages V < 1 2 3 4 > »   
Closed TopicStart new topic
> DoTa Script, alot of code..
Swent
post Dec 16 2007, 05:11 PM
Post #31


Ultimate spammer.
********

Group: Sr. Members
Posts: 3,494
Joined: 6-February 06
From: Minneapolis, MN
Member No.: 51



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.


--------------------
IPB Image~Unreleased scripts
I can't answer every PM that I receive. For scripting help, use the forum.

IPB Image
My favorite songs
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
NameLess
post Dec 16 2007, 05:28 PM
Post #32


Jr. Member
**

Group: Members
Posts: 34
Joined: 9-August 07
Member No.: 27,435



Can anyone post the whole script with out mistakes?


--------------------
-Sorry for my bad english-
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Java-
post Dec 16 2007, 06:38 PM
Post #33


Veteran
**

Group: Members
Posts: 67
Joined: 18-November 07
Member No.: 30,637



It still has mistakes in it.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Hero.A
post Dec 16 2007, 09:22 PM
Post #34


I Read The Trash Can
*

Group: Banned
Posts: 1
Joined: 1-October 07
From: I live in my stealthbox
Member No.: 29,291



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





--------------------
~ Mike/Hero (View my other profile for more information about how to contact me)
- - - - - - - -
Take a look at my forums! (Up and running!)
- - - - - - - -
Visit Clan R77
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
leax
post Dec 17 2007, 12:11 AM
Post #35


Jr. Member
**

Group: Members
Posts: 11
Joined: 15-October 07
Member No.: 29,679



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

This post has been edited by leax: Dec 17 2007, 12:17 AM


--------------------
LainEth - Dota Ladder/League Hosting BOT
LainEthLite - Dota Hosting BOT - none ladder, non-database
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Mondster
post Dec 17 2007, 08:00 AM
Post #36


Passionate Member
***

Group: Members
Posts: 231
Joined: 16-March 07
From: I feel homeless
Member No.: 20,488



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.

This post has been edited by Mondster: Dec 17 2007, 08:06 AM


--------------------
`... * Felix, qui potuit rerum cognoscere causas * .`..`
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
FiftyToo
post Dec 17 2007, 08:53 AM
Post #37


Posting God
*****

Group: Sr. Members
Posts: 1,552
Joined: 28-September 06
From: Ohio
Member No.: 9,153



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


--------------------
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
riffruff
post Dec 17 2007, 07:10 PM
Post #38


I riffruff
********

Group: Sr. Members
Posts: 3,727
Joined: 19-February 06
From: USA
Member No.: 278



Are you sure you wrote ALL this??

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

This post has been edited by riffruff: Dec 17 2007, 07:15 PM


--------------------
What you should tell your girlfriend...
QUOTE
ALL men see in only 16 colors, like Windows default settings. Peach, for example, is a fruit, not a color. Pumpkin is also a fruit. We have no idea what mauve is.

QUOTE
Women, learn to work the toilet seat. You're a big girl. If it's up, put it down. We need it up, you need it down. You don't hear us complaining about you leaving it down.

http://riffruff.mybrute.com
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Hero.A
post Dec 17 2007, 07:25 PM
Post #39


I Read The Trash Can
*

Group: Banned
Posts: 1
Joined: 1-October 07
From: I live in my stealthbox
Member No.: 29,291



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.


--------------------
~ Mike/Hero (View my other profile for more information about how to contact me)
- - - - - - - -
Take a look at my forums! (Up and running!)
- - - - - - - -
Visit Clan R77
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Java-
post Dec 18 2007, 04:29 PM
Post #40


Veteran
**

Group: Members
Posts: 67
Joined: 18-November 07
Member No.: 30,637



Any update on this?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Hero.A
post Dec 18 2007, 05:22 PM
Post #41


I Read The Trash Can
*

Group: Banned
Posts: 1
Joined: 1-October 07
From: I live in my stealthbox
Member No.: 29,291



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


--------------------
~ Mike/Hero (View my other profile for more information about how to contact me)
- - - - - - - -
Take a look at my forums! (Up and running!)
- - - - - - - -
Visit Clan R77
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Java-
post Dec 18 2007, 05:49 PM
Post #42


Veteran
**

Group: Members
Posts: 67
Joined: 18-November 07
Member No.: 30,637



Well, hopefully it is resolved soon!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
NameLess
post Dec 18 2007, 06:45 PM
Post #43


Jr. Member
**

Group: Members
Posts: 34
Joined: 9-August 07
Member No.: 27,435






Could you post us your script?

This post has been edited by NameLess: Dec 18 2007, 06:45 PM


--------------------
-Sorry for my bad english-
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Hero.A
post Dec 18 2007, 08:18 PM
Post #44


I Read The Trash Can
*

Group: Banned
Posts: 1
Joined: 1-October 07
From: I live in my stealthbox
Member No.: 29,291



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


--------------------
~ Mike/Hero (View my other profile for more information about how to contact me)
- - - - - - - -
Take a look at my forums! (Up and running!)
- - - - - - - -
Visit Clan R77
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Java-
post Dec 19 2007, 06:02 AM
Post #45


Veteran
**

Group: Members
Posts: 67
Joined: 18-November 07
Member No.: 30,637



Gotta keep this on top, someone had to know.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
NameLess
post Dec 19 2007, 07:26 AM
Post #46


Jr. Member
**

Group: Members
Posts: 34
Joined: 9-August 07
Member No.: 27,435



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.


--------------------
-Sorry for my bad english-
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
kirill
post Dec 20 2007, 06:02 PM
Post #47


Jr. Member
**

Group: Members
Posts: 14
Joined: 20-December 06
Member No.: 14,396



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
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Hero.A
post Dec 20 2007, 06:16 PM
Post #48


I Read The Trash Can
*

Group: Banned
Posts: 1
Joined: 1-October 07
From: I live in my stealthbox
Member No.: 29,291



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.


--------------------
~ Mike/Hero (View my other profile for more information about how to contact me)
- - - - - - - -
Take a look at my forums! (Up and running!)
- - - - - - - -
Visit Clan R77
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
riffruff
post Dec 20 2007, 06:42 PM
Post #49


I riffruff
********

Group: Sr. Members
Posts: 3,727
Joined: 19-February 06
From: USA
Member No.: 278



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...


--------------------
What you should tell your girlfriend...
QUOTE
ALL men see in only 16 colors, like Windows default settings. Peach, for example, is a fruit, not a color. Pumpkin is also a fruit. We have no idea what mauve is.

QUOTE
Women, learn to work the toilet seat. You're a big girl. If it's up, put it down. We need it up, you need it down. You don't hear us complaining about you leaving it down.

http://riffruff.mybrute.com
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Hero.A
post Dec 20 2007, 06:48 PM
Post #50


I Read The Trash Can
*

Group: Banned
Posts: 1
Joined: 1-October 07
From: I live in my stealthbox
Member No.: 29,291



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


--------------------
~ Mike/Hero (View my other profile for more information about how to contact me)
- - - - - - - -
Take a look at my forums! (Up and running!)
- - - - - - - -
Visit Clan R77
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
riffruff
post Dec 20 2007, 08:12 PM
Post #51


I riffruff
********

Group: Sr. Members
Posts: 3,727
Joined: 19-February 06
From: USA
Member No.: 278



I'm glad you're writing it (I actually asked someone else to make one a week or to ago, as I knew it was a much requested script)...I started writing it, and got a bit tired of it, so I stopped...

And, as Phix said, I'm not reffruff...

This post has been edited by riffruff: Dec 20 2007, 08:13 PM


--------------------
What you should tell your girlfriend...
QUOTE
ALL men see in only 16 colors, like Windows default settings. Peach, for example, is a fruit, not a color. Pumpkin is also a fruit. We have no idea what mauve is.

QUOTE
Women, learn to work the toilet seat. You're a big girl. If it's up, put it down. We need it up, you need it down. You don't hear us complaining about you leaving it down.

http://riffruff.mybrute.com
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Hero.A
post Dec 20 2007, 11:55 PM
Post #52


I Read The Trash Can
*

Group: Banned
Posts: 1
Joined: 1-October 07
From: I live in my stealthbox
Member No.: 29,291



QUOTE(riffruff @ Dec 20 2007, 08:12 PM) *

I'm glad you're writing it (I actually asked someone else to make one a week or to ago, as I knew it was a much requested script)...I started writing it, and got a bit tired of it, so I stopped...

And, as Phix said, I'm not reffruff...


O.k. then, i will keep working on it. Could you help fix errors?
And no duh your not reffruf i am making fun of you an kirill lol


--------------------
~ Mike/Hero (View my other profile for more information about how to contact me)
- - - - - - - -
Take a look at my forums! (Up and running!)
- - - - - - - -
Visit Clan R77
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
riffruff
post Dec 21 2007, 01:54 PM
Post #53


I riffruff
********

Group: Sr. Members
Posts: 3,727
Joined: 19-February 06
From: USA
Member No.: 278



Yes I can help fix errors.

Also, I may take a look at how your database is setup later and look into making a webpage generated from it...I always wanted to do that with my dota script when I got finished with it -- just never got the time to finish it.


--------------------
What you should tell your girlfriend...
QUOTE
ALL men see in only 16 colors, like Windows default settings. Peach, for example, is a fruit, not a color. Pumpkin is also a fruit. We have no idea what mauve is.

QUOTE
Women, learn to work the toilet seat. You're a big girl. If it's up, put it down. We need it up, you need it down. You don't hear us complaining about you leaving it down.

http://riffruff.mybrute.com
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Java-
post Dec 21 2007, 09:39 PM
Post #54


Veteran
**

Group: Members
Posts: 67
Joined: 18-November 07
Member No.: 30,637



So any idea of what is wrong?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
riffruff
post Dec 21 2007, 09:55 PM
Post #55


I riffruff
********

Group: Sr. Members
Posts: 3,727
Joined: 19-February 06
From: USA
Member No.: 278



Here is your plugin fixed. The name "SignedUp" is reserved for something -- as you were receiving a name redefined error.

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 SignUp(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 SignUp(User)
Set rs = db.OpenRecordSet("SELECT * FROM Game ORDER BY Name", db_cModeReadOnly)
AddChat vbBlue, "Searching for a player ..."
rs.MoveFirst
rs.Find "Name='" & User & "'"
If Not rs.EOF Then
AddChat vbBlue, "Found player!"
SignUp = 1
Else
AddChat vbBlue, "Could not find player!"
SignUp = 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


I would suggest indenting better, and there is still 1 error, but you should be able to fix it...

Just a FYI, the beta has better error reporting, and reported the error like this..(I don't know how v2.6r3 reported it)
QUOTE
[10:42:57 PM] [10:42:57 PM] frmExample_Load
[10:42:57 PM] [10:42:57 PM] Form created: True
[10:42:57 PM] [10:42:57 PM] Scripting runtime error '500' on "uiexample_Event_Load" call in file "UIExample.plug"
[10:42:57 PM] [10:42:57 PM] Variable is undefined.
[10:43:20 PM] Scripting runtime error '1041': (line 270; column 9)
[10:43:20 PM] Name redefined.
[10:43:20 PM] Offending line: >> Function SignedUp(Username)
[10:43:20 PM] [10:43:20 PM] Name redefined
[10:43:20 PM] [10:43:20 PM] Offending file: >> C:\Program Files\StealthBot\beta\plugins\dotascript.plug
[10:43:20 PM] [10:43:20 PM] Your ngoc plugin has been temporarily blocked due to a loading error.
[10:43:20 PM] [10:43:20 PM] Loaded 4 plugins (4 enabled). Type [10:43:20 PM] /plugins [10:43:20 PM] to view them. Type [10:43:20 PM] /phelp [10:43:20 PM] for help using them.
[10:43:20 PM] [10:43:20 PM] Type [10:43:20 PM] /updates [10:43:20 PM] in the bot to view updates and new plugins that are available for download.


This post has been edited by riffruff: Dec 21 2007, 09:59 PM


--------------------
What you should tell your girlfriend...
QUOTE
ALL men see in only 16 colors, like Windows default settings. Peach, for example, is a fruit, not a color. Pumpkin is also a fruit. We have no idea what mauve is.

QUOTE
Women, learn to work the toilet seat. You're a big girl. If it's up, put it down. We need it up, you need it down. You don't hear us complaining about you leaving it down.

http://riffruff.mybrute.com
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Hero.A
post Dec 21 2007, 10:16 PM
Post #56


I Read The Trash Can
*

Group: Banned
Posts: 1
Joined: 1-October 07
From: I live in my stealthbox
Member No.: 29,291



2.6r3 reported it as a mismatch. Thats all it said

With your changes what is the error? SignedUp dang gj seeing that

Is this the new error?

[10:42:57 PM] [10:42:57 PM] Scripting runtime error '500' on "uiexample_Event_Load" call in file "UIExample.plug"

What is the uiexample?


I have this on a notepaste thing so it is easy to find lines and such.
http://rafb.net/p/Yh3gA866.html


--------------------
~ Mike/Hero (View my other profile for more information about how to contact me)
- - - - - - - -
Take a look at my forums! (Up and running!)
- - - - - - - -
Visit Clan R77
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Java-
post Dec 21 2007, 10:20 PM
Post #57


Veteran
**

Group: Members
Posts: 67
Joined: 18-November 07
Member No.: 30,637



UI is probably the name of the file he used for the plugin.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
riffruff
post Dec 21 2007, 10:38 PM
Post #58


I riffruff
********

Group: Sr. Members
Posts: 3,727
Joined: 19-February 06
From: USA
Member No.: 278



UI_example is an example plugin for creating UI forms...

QUOTE
[11:37:29 PM] Welcome to the NGOC Game Script By: Hero.A Ver: 1.0
[11:37:29 PM] Most messages in blue are this script working. (it may show messages you do not understand)
[11:37:29 PM] Error in Open('C:\Program Files\StealthBot\beta\plugins\NGOCData.mdb'): Object required
[11:37:29 PM] Database opened.
[11:37:29 PM] Deleting all records from Game ...
[11:37:29 PM] Deleted

The error is in there...Somethings wrong with opening the file?

This post has been edited by riffruff: Dec 21 2007, 10:38 PM


--------------------
What you should tell your girlfriend...
QUOTE
ALL men see in only 16 colors, like Windows default settings. Peach, for example, is a fruit, not a color. Pumpkin is also a fruit. We have no idea what mauve is.

QUOTE
Women, learn to work the toilet seat. You're a big girl. If it's up, put it down. We need it up, you need it down. You don't hear us complaining about you leaving it down.

http://riffruff.mybrute.com
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Hero.A
post Dec 22 2007, 12:59 PM
Post #59


I Read The Trash Can
*

Group: Banned
Posts: 1
Joined: 1-October 07
From: I live in my stealthbox
Member No.: 29,291



That means it is having problems opening, here's the code that opens it

CODE

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


Since it is saying Object Required do you think it isnt creating the database?

Btw it is saying the database is opened after and that it is deleting things so maybe it still is operational

Maybe i would meld my points system script with it once we get it working
http://www.stealthbot.net/board/index.php?showtopic=29078

I would redo the points system thing though and have
it more based on using this code:
CODE

Dim Data, User, PointsToAdd, CurrentPoints, NewPoints
Data = Split(Message, " ")
User = Data(1)
PointsToAdd = Data(2)

Set Rs = db.OpenRecordSet("Records" db_ModeReadOnly)
AddChat vbWhite, "[Point System] Searching for name"
rs.MoveFirst
rs.Find "user" = '" & User & ""'
If Not.EOF Then
AddChat vbWhite, "[Points System] Found!
CurrentPoints = rs("points")
NewPoints = CurrentPoints + PointsToAdd
Else
AddChat vbWhite, "[Points System] Not found!"
CurrentPoints = 0
NewPoints = PointsToAdd
End If

Set rs = db.OpenRecordSet("Records" db_cModeForUpdate)
rs.MoveFirst
rs.Find "user" = '" & User & ""'
If Not rs.EOF Then
rs("Points") = NewPoints
rs.Update
rs.Close
AddQ "Added " & PointsToAdd & " To " & User &
AddQ "He is now at " & NewPoints & " points"
Else
rs.AddNew
rs("User") = User
rs("Points") = NewPoints
rs.Update
rs.Close
End If
End Sub


I am not sure if that will work, i havnt had a chance to test it.

This post has been edited by Hero.A: Dec 22 2007, 01:00 PM


--------------------
~ Mike/Hero (View my other profile for more information about how to contact me)
- - - - - - - -
Take a look at my forums! (Up and running!)
- - - - - - - -
Visit Clan R77
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Java-
post Dec 22 2007, 04:07 PM
Post #60


Veteran
**

Group: Members
Posts: 67
Joined: 18-November 07
Member No.: 30,637



The commands still don't work for me. And it gives me this error when I first start it.

CODE
[5:00:32 PM] 10 plugins loaded. Type /plugins in the bot to view them. Type /phelp for help using them.
[5:00:32 PM] Type /updates in the bot to view updates and new plugins that are available for download.
[5:00:33 PM] Welcome to the NGOC Game Script By: Hero.A Ver: 1.0
[5:00:33 PM] Most messages in blue are this script working. (it may show messages you do not understand)
[5:00:34 PM] Error in Open('C:\Program Files\Warcraft III\Stealth Bot\plugins\NGOCData.mdb'): Object required
[5:00:34 PM] Database opened.
[5:00:34 PM] Deleting all records from Game ...
[5:00:34 PM] Deleted


Edit: I have a theory, the database is in the plugins folder, yet all my other database from like the clan rank script are in the normal stealth bot folder. Could this cause the problem?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

17 Pages V < 1 2 3 4 > » 
Closed TopicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 15th December 2019 - 03:46 PM
Skin by Andrea
Website Legal Information | Hosted by LunarPages