IPB

Welcome Guest ( Log In | Register )

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

 
Reply to this topicStart new topic
> [RESOLVED] Yet Another Script Request, Here we go again!
Sui(C)ide
post May 9 2009, 11:35 AM
Post #1


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



Hi, I've got another script request, which I think will require a fair amount of effort.
First of all, here's the list of commands.
.adddb
.remdb
.dbinfo <username>
.dbusers

Here's a list of what each command does.
.adddb - Adds a user to the database, and displays message "<username> has been added to the database by <user adding them> at time <time> on date <date>.".
.remdb - Removes a user from the database, and displays message "<username> has been removed from the database by <user removing them> at time <time> on date <date>.".
.dbinfo <username> - Displays message "<username> was added to the database by <User who listed them>, at time <time>, on date <date>.".
.dbusers - Displays a message "The WotI database currently has <amount of users in database> users in its database.


Inside the database, I would like the info of the user to be: Their username, the person who added them to the database, their access, the time and date they were added.


I understand this could take some time to do up, but I would appreciate someone making it for me.

Thanks.


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Call
post May 9 2009, 12:33 PM
Post #2


Posting God
*****

Group: Beta Testers
Posts: 1,423
Joined: 15-June 08
From: Denmark, Copenhagen
Member No.: 38,127



With This you should look in swents crs plugin and see how he used the .mdb (local sql database) witch will have this done by a few lines if i get some free time tommorow if u still didn't get any i can show some examples using local sql.


--------------------
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 9 2009, 12:35 PM
Post #3


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



QUOTE(Call @ May 10 2009, 04:33 AM) *

With This you should look in swents crs plugin and see how he used the .mdb (local sql database) witch will have this done by a few lines if i get some free time tommorow if u still didn't get any i can show some examples using local sql.


I'll check crs out, and i've got no idea on how to do it, so i'm just requesting it to be done be a more advanced scripter.

Ohh, i'd also like to add to the .dbinfo command
I would like it to display the following.
"<username> was added to the database by <User who listed them>, at time <time>, on date <date>. <username> was last online at <last time online>".


This post has been edited by WotI.Zexen: May 9 2009, 12:40 PM


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Snap
post May 9 2009, 01:52 PM
Post #4


The following post is supplementry information
*****

Group: Global Moderators
Posts: 2,922
Joined: 29-January 06
From: Eugene Oregon
Member No.: 31



This would be fairly simple with CCX - if you're interested.


--------------------
~Life is all busy and stuff right now. - Car accident, lots of dr. appointments... Other stuff too. I still <3 StealthBot.net - - I'll be around.
Thinking about PMing me? Post it instead! CCX Forums | SnapNJacks Trivia Forums
IPB Image
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 10 2009, 01:28 AM
Post #5


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



QUOTE(Snap @ May 10 2009, 05:52 AM) *

This would be fairly simple with CCX - if you're interested.


Umm... with CCX, does it store them to a database?


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Call
post May 10 2009, 05:09 AM
Post #6


Posting God
*****

Group: Beta Testers
Posts: 1,423
Joined: 15-June 08
From: Denmark, Copenhagen
Member No.: 38,127



QUOTE(WotI.Zexen @ May 9 2009, 08:35 PM) *

QUOTE(Call @ May 10 2009, 04:33 AM) *

With This you should look in swents crs plugin and see how he used the .mdb (local sql database) witch will have this done by a few lines if i get some free time tommorow if u still didn't get any i can show some examples using local sql.


I'll check crs out, and i've got no idea on how to do it, so i'm just requesting it to be done be a more advanced scripter.

Ohh, i'd also like to add to the .dbinfo command
I would like it to display the following.
"<username> was added to the database by <User who listed them>, at time <time>, on date <date>. <username> was last online at <last time online>".


did u even try..

QUOTE(WotI.Zexen @ May 10 2009, 09:28 AM) *

QUOTE(Snap @ May 10 2009, 05:52 AM) *

This would be fairly simple with CCX - if you're interested.


Umm... with CCX, does it store them to a database?


i dont think it can keep it without databases and variables/arrays.


--------------------
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 10 2009, 06:05 AM
Post #7


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



QUOTE(Call @ May 10 2009, 09:09 PM) *

QUOTE(WotI.Zexen @ May 9 2009, 08:35 PM) *

QUOTE(Call @ May 10 2009, 04:33 AM) *

With This you should look in swents crs plugin and see how he used the .mdb (local sql database) witch will have this done by a few lines if i get some free time tommorow if u still didn't get any i can show some examples using local sql.


I'll check crs out, and i've got no idea on how to do it, so i'm just requesting it to be done be a more advanced scripter.

Ohh, i'd also like to add to the .dbinfo command
I would like it to display the following.
"<username> was added to the database by <User who listed them>, at time <time>, on date <date>. <username> was last online at <last time online>".


did u even try..

QUOTE(WotI.Zexen @ May 10 2009, 09:28 AM) *

QUOTE(Snap @ May 10 2009, 05:52 AM) *

This would be fairly simple with CCX - if you're interested.


Umm... with CCX, does it store them to a database?


i dont think it can keep it without databases and variables/arrays.


Yes, I did try with it, but it is confusing atm.
So are you able to do it?


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Snap
post May 10 2009, 03:33 PM
Post #8


The following post is supplementry information
*****

Group: Global Moderators
Posts: 2,922
Joined: 29-January 06
From: Eugene Oregon
Member No.: 31



It will store them in a 'list'. Was what you want specific to using a mdb database?
The commands could all be accomplished.


--------------------
~Life is all busy and stuff right now. - Car accident, lots of dr. appointments... Other stuff too. I still <3 StealthBot.net - - I'll be around.
Thinking about PMing me? Post it instead! CCX Forums | SnapNJacks Trivia Forums
IPB Image
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 11 2009, 02:10 AM
Post #9


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



QUOTE(Snap @ May 11 2009, 07:33 AM) *

It will store them in a 'list'. Was what you want specific to using a mdb database?
The commands could all be accomplished.


Yeah, I wanted an .mdb database (That way I could learn how it's used aswell).


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 11 2009, 10:29 AM
Post #10


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



@Call: Are you still doing this? Let me know because if you aren't, I'll do it.

This post has been edited by The-Black-Ninja: May 11 2009, 10:29 AM


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Call
post May 12 2009, 04:33 PM
Post #11


Posting God
*****

Group: Beta Testers
Posts: 1,423
Joined: 15-June 08
From: Denmark, Copenhagen
Member No.: 38,127



QUOTE(The-Black-Ninja @ May 11 2009, 06:29 PM) *

@Call: Are you still doing this? Let me know because if you aren't, I'll do it.


im not sorry if it felt like that i would show him an example how to use local sql database only smile.gif

have fun

i have exams from tommorow so i wont be able to do anything for a while

This post has been edited by Call: May 12 2009, 04:34 PM


--------------------
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 12 2009, 06:35 PM
Post #12


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



Here you go. Default access for the commands is 200.
CODE
'memdb
'1.2
'&Clan WotI Database:The-Black-Ninja
'&adddb <user>=Adds a member to the database:remdb <user>=Removes a user from the database:dbinfo <user>=Displays the database info for the user:dbusers=Displays the amount of users in the database
'&41420
'&No important notes.


Private Const addMem_cmd = "adddb"
Private Const remMem_cmd = "remdb"
Private Const meminfo_cmd = "dbinfo"
Private Const maxUsers_cmd = "dbusers"
Private Const addMem_reqAccess = 200
Private Const remMem_reqAccess = 200
Private Const memInfo_reqAccess = 200
Private Const maxUsers_reqAccess = 200

Private memdbDB_FP, memdbConn


Sub memdb_Event_Load()

memdbDB_FP = BotPath & "plugins\WotI_database.mdb"

Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(memdbDB_FP) Then
AddChat vbYellow, "memdb - Creating member database for first-time use. (" & memdbDB_FP & ")"
memdb_MakeDB
End If
End Sub


Sub memdb_Event_PressedEnter(Text)

memdb_Command BotVars.Username, Text, 4
End Sub

Sub memdb_Event_Usertalk(Username, Flags, Message, Ping)

memdb_Command Username, Message, 1
End Sub

Sub memdb_Event_WhisperFromUser(Username, Flags, Message)

memdb_Command Username, Message, 3
End Sub


Sub memdb_Event_Userjoins(Username, Flags, Message, Ping, Product, Level, OriginalStatString)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & Username & "'")
If ns.Fields(0) <> 0 Then
memdbConn.Execute("UPDATE `Members` SET `last_online` = '" & Now & "' WHERE `name` ='" & username & "'")
memdbConn.Close
End If
End Sub


Sub memdb_Command(Username, Message, dspId)

If NOT (Left(Message, 1) = BotVars.Trigger Or Left(Message, 1) = "/") Then Exit Sub
If Len(Message) < 2 Then Exit Sub

cmd = Split(Mid(LCase(Trim(Message)), 2), " ")

GetDBEntry Username, Access, Flags

Select Case cmd(0)
Case Lcase(addMem_cmd): memdb_addMem Username, Message, dspId, Access
Case Lcase(remMem_cmd): memdb_remMem Username, Message, dspId, Access
Case Lcase(meminfo_cmd): memdb_meminfo Username, Message, dspId, Access
Case Lcase(maxUsers_cmd): memdb_maxUsers Username, Message, dspId, Access
End Select
End Sub


Sub memdb_addMem(Username, Message, dspId, Access)

If Access < addMem_reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

msg = Split(Message)

If UBound(msg) > 0 Then
user = msg(1)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & user & "'")
If ns.Fields(0) = 0 Then
GetDBEntry user, tAccess, tFlags
temp = userInChannel(user)
If temp = 1 Then
lastOnline = Now
Else
lastOnline = "N/A"
End If
memdbConn.Execute("INSERT INTO `Members` (`name`, `added_by`, `date_added`, `access`, `last_online`) VALUES ('" & user & "', '" & Username & "', '" & Now & "', " & tAccess & ", '" & lastOnline & "')")
memdbConn.Close
Dsp dspId, """" & user & """ has been added to the database by " & Username & " at time " & Time & " on date " & Date & ".", Username, vbGreen
Else
Dsp dspId, user & " is already in the database.", Username, vbGreen
End If
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & addMem_cmd & " " & Username, Username, vbGreen
End If
End Sub


Sub memdb_remMem(Username, Message, dspId, Access)

If Access < remMem_reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

msg = Split(Message)

If UBound(msg) > 0 Then
user = msg(1)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & user & "'")
If ns.Fields(0) = 1 Then
memdbConn.Execute("DELETE FROM `Members` WHERE `name` ='" & user & "'")
memdbConn.Close
Dsp dspId, """" & user & """ has been removed from the database by " & Username & " at time " & Time & " on date " & Date & ".", Username, vbGreen
Else
Dsp dspId, user & " is not in the database.", Username, vbGreen
End If
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & remMem_cmd & " " & Username, Username, vbGreen
End If
End Sub


Sub memdb_meminfo(Username, Message, dspId, Access)

If Access < memInfo_reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

msg = Split(Message)

If UBound(msg) > 0 Then
user = msg(1)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & user & "'")
If ns.Fields(0) = 1 Then
Set ns = memdbConn.Execute("SELECT * FROM `Members` WHERE `name` ='" & user & "'")
Dsp dspId, """" & user & """ was added to the database by " & ns.Fields(1) & ", at time " & Split(ns.Fields(2), " ", 2)(1) & ", on date " & Split(ns.Fields(2))(0) & ". " & user & " was last online at " & ns.Fields(4) & ".", Username, vbGreen
memdbConn.Close
Else
Dsp dspId, user & " is not in the database.", Username, vbGreen
End If
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & meminfo_cmd & " " & Username, Username, vbGreen
End If
End Sub


Sub memdb_maxUsers(Username, Message, dspId, Access)

If Access < maxUsers_reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members`")
Dsp dspId, "The WotI database currently has " & ns.Fields(0) & " users in its database.", Username, vbGreen
memdbConn.Close
End Sub


Private Function userInChannel(user)

For i = 1 To GetInternalUserCount
tUser = GetNameByPosition(i)
If LCase(tUser) = Lcase(user) Then
userInChannel = 1
Exit Function
End If
Next
userInChannel = 0
End Function


Sub memdbConnect()

Set memdbConn = CreateObject("ADODB.connection")
connStringProperty = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & memdbDB_FP
memdbConn.ConnectionString = connStringProperty
memdbConn.Open
End Sub


Sub memdb_MakeDB()

Set Catalog = CreateObject("ADOX.Catalog")
Catalog.Create "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & memdbDB_FP

memdbConnect()

memdbConn.Execute("CREATE TABLE `Members` (`name` varchar(50), `added_by` varchar(50), `date_added` varchar(30), `access` INT, `last_online` varchar(30))")
memdbConn.Close
End Sub


This post has been edited by The-Black-Ninja: May 14 2009, 03:15 PM


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 13 2009, 01:59 AM
Post #13


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



QUOTE(The-Black-Ninja @ May 13 2009, 10:35 AM) *

Here you go. Default access for the commands is 200.
CODE
'memdb
'1.0
'&Clan WotI Database:The-Black-Ninja
'&adddb <user>=Adds a member to the database:remdb <user>=Removes a user from the database:dbinfo <user>=Displays the database info for the user:dbusers=Displays the amount of users in the database
'&41420
'&No important notes.


Private Const addMem_cmd = "adddb"
Private Const remMem_cmd = "remdb"
Private Const meminfo_cmd = "dbinfo"
Private Const maxUsers_cmd = "dbusers"
Private Const reqAccess = 200

Private memdbDB_FP, memdbConn


Sub memdb_Event_Load()

memdbDB_FP = BotPath & "plugins\WotI_database.mdb"

Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(memdbDB_FP) Then
AddChat vbYellow, "memdb - Creating member database for first-time use. (" & memdbDB_FP & ")"
memdb_MakeDB
End If
End Sub


Sub memdb_Event_PressedEnter(Text)

memdb_Command BotVars.Username, Text, 4
End Sub

Sub memdb_Event_Usertalk(Username, Flags, Message, Ping)

memdb_Command Username, Message, 1
End Sub

Sub memdb_Event_WhisperFromUser(Username, Flags, Message)

memdb_Command Username, Message, 3
End Sub


Sub memdb_Event_Userjoins(Username, Flags, Message, Ping, Product, Level, OriginalStatString)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & Username & "'")
If ns.Fields(0) <> 0 Then
memdbConn.Execute("UPDATE `Members` SET `last_online` = '" & Now & "' WHERE `name` ='" & username & "'")
memdbConn.Close
End If
End Sub


Sub memdb_Command(Username, Message, dspId)

If NOT (Left(Message, 1) = BotVars.Trigger Or Left(Message, 1) = "/") Then Exit Sub
If Len(Message) < 2 Then Exit Sub

cmd = Split(Mid(LCase(Trim(Message)), 2), " ")

addchat vbGreen, cmd(0)

Select Case cmd(0)
Case Lcase(addMem_cmd): memdb_addMem Username, Message, dspId, Access
Case Lcase(remMem_cmd): memdb_remMem Username, Message, dspId, Access
Case Lcase(meminfo_cmd): memdb_meminfo Username, Message, dspId, Access
Case Lcase(maxUsers_cmd): memdb_maxUsers Username, Message, dspId, Access
End Select
End Sub


Sub memdb_addMem(Username, Message, dspId, Access)

If Access < reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

msg = Split(Message)

If UBound(msg) > 0 Then
user = msg(1)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & user & "'")
If ns.Fields(0) = 0 Then
GetDBEntry user, tAccess, tFlags
temp = userInChannel(user)
If temp = 1 Then
lastOnline = Now
Else
lastOnline = "N/A"
End If
memdbConn.Execute("INSERT INTO `Members` (`name`, `added_by`, `date_added`, `access`, `last_online`) VALUES ('" & user & "', '" & Username & "', '" & Now & "', " & tAccess & ", '" & lastOnline & "')")
memdbConn.Close
Dsp dspId, """" & user & """ has been added to the database by " & Username & " at time " & Time & " on date " & Date & ".", Username, vbGreen
Else
Dsp dspId, user & " is already in the database.", Username, vbGreen
End If
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & addMem_cmd & " " & Username, Username, vbGreen
End If
End Sub


Sub memdb_remMem(Username, Message, dspId, Access)

If Access < reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

msg = Split(Message)

If UBound(msg) > 0 Then
user = msg(1)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & user & "'")
If ns.Fields(0) = 1 Then
memdbConn.Execute("DELETE FROM `Members` WHERE `name` ='" & user & "'")
memdbConn.Close
Dsp dspId, """" & user & """ has been removed from the database by " & Username & " at time " & Time & " on date " & Date & ".", Username, vbGreen
Else
Dsp dspId, user & " is not in the database.", Username, vbGreen
End If
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & remMem_cmd & " " & Username, Username, vbGreen
End If
End Sub


Sub memdb_meminfo(Username, Message, dspId, Access)

If Access < reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

msg = Split(Message)

If UBound(msg) > 0 Then
user = msg(1)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & user & "'")
If ns.Fields(0) = 1 Then
Set ns = memdbConn.Execute("SELECT * FROM `Members` WHERE `name` ='" & user & "'")
Dsp dspId, """" & user & """ was added to the database by " & ns.Fields(1) & ", at time " & Split(ns.Fields(2), " ", 2)(1) & ", on date " & Split(ns.Fields(2))(0) & ". " & user & " was last online at " & ns.Fields(4) & ".", Username, vbGreen
memdbConn.Close
Else
Dsp dspId, user & " is not in the database.", Username, vbGreen
End If
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & meminfo_cmd & " " & Username, Username, vbGreen
End If
End Sub


Sub memdb_maxUsers(Username, Message, dspId, Access)

If Access < reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members`")
Dsp dspId, "The WotI database currently has " & ns.Fields(0) & " users in its database.", Username, vbGreen
memdbConn.Close
End Sub


Private Function userInChannel(user)

For i = 1 To GetInternalUserCount
tUser = GetNameByPosition(i)
If LCase(tUser) = Lcase(user) Then
userInChannel = 1
Exit Function
End If
Next
userInChannel = 0
End Function


Sub memdbConnect()

Set memdbConn = CreateObject("ADODB.connection")
connStringProperty = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & memdbDB_FP
memdbConn.ConnectionString = connStringProperty
memdbConn.Open
End Sub


Sub memdb_MakeDB()

Set Catalog = CreateObject("ADOX.Catalog")
Catalog.Create "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & memdbDB_FP

memdbConnect()

memdbConn.Execute("CREATE TABLE `Members` (`name` varchar(50), `added_by` varchar(50), `date_added` varchar(30), `access` INT, `last_online` varchar(30))")
memdbConn.Close
End Sub




Wow, thank-you very much... But is it possible to make the commands .dbinfo <username> and .dbusers available for anyone to use?
I've looked at it, and I could think of a way that could possibly do it.
The first would be to add "Private Const NoAccessRequired = -1", and change where the...
CODE
   If Access < reqAccess AND Username <> BotVars.Username Then Exit Sub

is, to this...
CODE
   If Access < NoAccessRequired AND Username <> BotVars.Username Then Exit Sub


Either that or removing the If Access part for them, but I think if I did that, i'd have to remove the access part from the
CODE
   Select Case cmd(0)
     Case Lcase(addMem_cmd):   memdb_addMem Username, Message, dspId, Access
     Case Lcase(remMem_cmd):   memdb_remMem Username, Message, dspId, Access
     Case Lcase(meminfo_cmd):   memdb_meminfo Username, Message, dspId, Access
     Case Lcase(maxUsers_cmd):   memdb_maxUsers Username, Message, dspId, Access
   End Select

section, and the
CODE
Sub memdb_meminfo(Username, Message, dspId, Access)

would have to be modified, just like the
CODE
Sub memdb_maxUsers(Username, Message, dspId, Access)

section. Am I right?

Thanks.

This post has been edited by WotI.Zexen: May 13 2009, 02:01 AM


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PhiX
post May 13 2009, 05:00 AM
Post #14


Notice the ownage.
********

Group: Global Moderators
Posts: 10,862
Joined: 15-January 07
From: GeRmAnY (GMT +1:00)
Member No.: 16,204



The cleanest way would be adding reqAccess variables for all commands and replace them with the original variable where the access for the respective command is checked.


--------------------
PhiX
--------------------
I do not provide support via PM or IM, please use the forums.
SBs Help Tool - Please only double click my name if I told you to do so.
--------------------

Whore of Clan BoT

JBLS: phix.no-ip.org (click for stats) IPB Image
--------------------
QUOTE(Clan BoT)
[20:33:50.063] <SlamBliss@Azeroth> I'm not showing any respect to a bunch of script kiddie faggots.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 13 2009, 04:05 PM
Post #15


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



QUOTE(PhiX @ May 13 2009, 07:00 AM) *
The cleanest way would be adding reqAccess variables for all commands and replace them with the original variable where the access for the respective command is checked.
Exactly. I'll edit it for you.


Done.


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 14 2009, 12:38 AM
Post #16


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



First of all, thank-you very much.
Secondly, only 2 of the commands work.
The .adddb WotI.Zexen
and the .remdb WotI.Zexen
don't seem to work...

QUOTE(WotI.Zexen @ May 14 2009, 04:27 PM) *

First of all, thank-you very much.
Secondly, only 2 of the commands work.
The .adddb WotI.Zexen
and the .remdb WotI.Zexen
don't seem to work...


EDIT: When adding / removing someone, it ONLY works when I type it IN the bot..


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
AwaKening
post May 14 2009, 11:53 AM
Post #17


Don't u know who I am
***

Group: Sr. Members
Posts: 764
Joined: 19-February 06
From: Utah
Member No.: 275



Because it's passing 0 to all the functions for access. Ninja left that part out. "Test your scripts right?"

Anyway, this is the quickest way to fix it, although I personally wouldn't have passed the access argument to each one, but instead check the access in the functions themselves. Whatever, this will work.
CODE

'memdb
'1.0
'&Clan WotI Database:The-Black-Ninja
'&adddb <user>=Adds a member to the database:remdb <user>=Removes a user from the database:dbinfo <user>=Displays the database info for the user:dbusers=Displays the amount of users in the database
'&41420
'&No important notes.


Private Const addMem_cmd = "adddb"
Private Const remMem_cmd = "remdb"
Private Const meminfo_cmd = "dbinfo"
Private Const maxUsers_cmd = "dbusers"
Private Const reqAccess = 200

Private memdbDB_FP, memdbConn


Sub memdb_Event_Load()

memdbDB_FP = BotPath & "plugins\WotI_database.mdb"

Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(memdbDB_FP) Then
AddChat vbYellow, "memdb - Creating member database for first-time use. (" & memdbDB_FP & ")"
memdb_MakeDB
End If
End Sub


Sub memdb_Event_PressedEnter(Text)

memdb_Command BotVars.Username, Text, 4
End Sub

Sub memdb_Event_Usertalk(Username, Flags, Message, Ping)

memdb_Command Username, Message, 1
End Sub

Sub memdb_Event_WhisperFromUser(Username, Flags, Message)

memdb_Command Username, Message, 3
End Sub


Sub memdb_Event_Userjoins(Username, Flags, Message, Ping, Product, Level, OriginalStatString)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & Username & "'")
If ns.Fields(0) <> 0 Then
memdbConn.Execute("UPDATE `Members` SET `last_online` = '" & Now & "' WHERE `name` ='" & username & "'")
memdbConn.Close
End If
End Sub


Sub memdb_Command(Username, Message, dspId)

If NOT (Left(Message, 1) = BotVars.Trigger Or Left(Message, 1) = "/") Then Exit Sub
If Len(Message) < 2 Then Exit Sub

cmd = Split(Mid(LCase(Trim(Message)), 2), " ")

addchat vbGreen, cmd(0)

GetDBEntry Username, Access, F

Select Case cmd(0)
Case Lcase(addMem_cmd): memdb_addMem Username, Message, dspId, Access
Case Lcase(remMem_cmd): memdb_remMem Username, Message, dspId, Access
Case Lcase(meminfo_cmd): memdb_meminfo Username, Message, dspId, Access
Case Lcase(maxUsers_cmd): memdb_maxUsers Username, Message, dspId, Access
End Select
End Sub


Sub memdb_addMem(Username, Message, dspId, Access)

If Access < reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

msg = Split(Message)

If UBound(msg) > 0 Then
user = msg(1)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & user & "'")
If ns.Fields(0) = 0 Then
GetDBEntry user, tAccess, tFlags
temp = userInChannel(user)
If temp = 1 Then
lastOnline = Now
Else
lastOnline = "N/A"
End If
memdbConn.Execute("INSERT INTO `Members` (`name`, `added_by`, `date_added`, `access`, `last_online`) VALUES ('" & user & "', '" & Username & "', '" & Now & "', " & tAccess & ", '" & lastOnline & "')")
memdbConn.Close
Dsp dspId, """" & user & """ has been added to the database by " & Username & " at time " & Time & " on date " & Date & ".", Username, vbGreen
Else
Dsp dspId, user & " is already in the database.", Username, vbGreen
End If
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & addMem_cmd & " " & Username, Username, vbGreen
End If
End Sub


Sub memdb_remMem(Username, Message, dspId, Access)

If Access < reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

msg = Split(Message)

If UBound(msg) > 0 Then
user = msg(1)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & user & "'")
If ns.Fields(0) = 1 Then
memdbConn.Execute("DELETE FROM `Members` WHERE `name` ='" & user & "'")
memdbConn.Close
Dsp dspId, """" & user & """ has been removed from the database by " & Username & " at time " & Time & " on date " & Date & ".", Username, vbGreen
Else
Dsp dspId, user & " is not in the database.", Username, vbGreen
End If
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & remMem_cmd & " " & Username, Username, vbGreen
End If
End Sub


Sub memdb_meminfo(Username, Message, dspId, Access)

If Access < reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

msg = Split(Message)

If UBound(msg) > 0 Then
user = msg(1)

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members` WHERE `name` = '" & user & "'")
If ns.Fields(0) = 1 Then
Set ns = memdbConn.Execute("SELECT * FROM `Members` WHERE `name` ='" & user & "'")
Dsp dspId, """" & user & """ was added to the database by " & ns.Fields(1) & ", at time " & Split(ns.Fields(2), " ", 2)(1) & ", on date " & Split(ns.Fields(2))(0) & ". " & user & " was last online at " & ns.Fields(4) & ".", Username, vbGreen
memdbConn.Close
Else
Dsp dspId, user & " is not in the database.", Username, vbGreen
End If
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & meminfo_cmd & " " & Username, Username, vbGreen
End If
End Sub


Sub memdb_maxUsers(Username, Message, dspId, Access)

If Access < reqAccess AND Username <> BotVars.Username Then Exit Sub
If Username = BotVars.Username Then VetoThisMessage

memdbConnect()

Set ns = memdbConn.Execute("SELECT COUNT(*) FROM `Members`")
Dsp dspId, "The WotI database currently has " & ns.Fields(0) & " users in its database.", Username, vbGreen
memdbConn.Close
End Sub


Private Function userInChannel(user)

For i = 1 To GetInternalUserCount
tUser = GetNameByPosition(i)
If LCase(tUser) = Lcase(user) Then
userInChannel = 1
Exit Function
End If
Next
userInChannel = 0
End Function


Sub memdbConnect()

Set memdbConn = CreateObject("ADODB.connection")
connStringProperty = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & memdbDB_FP
memdbConn.ConnectionString = connStringProperty
memdbConn.Open
End Sub


Sub memdb_MakeDB()

Set Catalog = CreateObject("ADOX.Catalog")
Catalog.Create "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & memdbDB_FP

memdbConnect()

memdbConn.Execute("CREATE TABLE `Members` (`name` varchar(50), `added_by` varchar(50), `date_added` varchar(30), `access` INT, `last_online` varchar(30))")
memdbConn.Close
End Sub


This post has been edited by AwaKening: May 14 2009, 11:54 AM


--------------------
Rival Nations Reborn Map Creator

Clan RnR.com
If you're looking for a "REAL" dota league script, aim or pm me.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 14 2009, 03:15 PM
Post #18


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



Updated. http://www.stealthbot.net/board/index.php?...st&p=332793


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
AwaKening
post May 14 2009, 04:58 PM
Post #19


Don't u know who I am
***

Group: Sr. Members
Posts: 764
Joined: 19-February 06
From: Utah
Member No.: 275



Might want to take another look at your code wink.gif

GetDBEntry user, tAccess, tFlags

not sure who (user) is supposed to be. Not set anywhere.


--------------------
Rival Nations Reborn Map Creator

Clan RnR.com
If you're looking for a "REAL" dota league script, aim or pm me.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 14 2009, 05:52 PM
Post #20


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



CODE
user = msg(1)


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
AwaKening
post May 14 2009, 07:52 PM
Post #21


Don't u know who I am
***

Group: Sr. Members
Posts: 764
Joined: 19-February 06
From: Utah
Member No.: 275



QUOTE(The-Black-Ninja @ May 14 2009, 05:52 PM) *

CODE
user = msg(1)



Wtf, did you just add that. Don't know how I missed it.


--------------------
Rival Nations Reborn Map Creator

Clan RnR.com
If you're looking for a "REAL" dota league script, aim or pm me.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 14 2009, 07:58 PM
Post #22


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



It's always been there lol But no worries smile.gif It's good that you're at least proofreading it for me cause you might find bugs that I, or someone else, hasn't caught yet.

This post has been edited by The-Black-Ninja: May 14 2009, 07:59 PM


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 15 2009, 08:14 PM
Post #23


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



Thank-you very much.
This topic can be marked as resolved.


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 15 2009, 08:30 PM
Post #24


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



I have marked this topic as resolved. If you did not receive a satisfactory response, please reply and provide as much detail as possible.


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 20th October 2014 - 02:09 AM
Skin by Andrea
Website Legal Information | Hosted by LunarPages