Valhalla Legends Forums Archive | Battle.net Bot Development | Finding

AuthorMessageTime
TriCk
How Do I find a username on a txt file or a listbox?
in Code please not Case
May 24, 2003, 11:04 AM
CrAz3D
Which one are you tryin to find it from?
Like add a name to a ListBox from (for example) users.txt?

[quote]
Public Sub FillList()
LISTBOX.Clear

s = dir$(App.Path & "\TEXT.txt")
If s = "" Then
Open (App.Path & "\TEXT.txt") For Output As #1
Close #1
End If

Open (App.Path & "\TEXT.txt") For Input As #1

On Error Resume Next
Do
Input #1, z
LISTBOX.AddItem (z)
Loop Until EOF(1)
Close #1
end sub[/quote]
May 24, 2003, 5:06 PM
TriCk
umm i know how to load from to and from a listbox

I dont really need that i wanna know how to find something in a txt file like a shitlist, if someone joins the channel and they're on it ban them...
May 24, 2003, 11:43 PM
Kp
[quote author=TriCk link=board=17;threadid=1413;start=0#msg10566 date=1053819837]
umm i know how to load from to and from a listbox
I dont really need that i wanna know how to find something in a txt file like a shitlist, if someone joins the channel and they're on it ban them...
[/quote]Setting aside that loading from a text file to test for bannables is a bad idea for efficiency reasons:[code]
int fd = open ("banlist.txt", O_RDONLY);
/* InFile(int fd, const char *sz) checks to see if any entry in the newline delimited file attached to fd matches the string in sz. Matches are literal. Use InFile_Wild() for wildcard matching.
*/
if (InFile (fd, szJoiningUser))
queuetxt ("/ban %s Autoban", szJoiningUser);
close (fd);[/code]Required headers: fcntl.h, stdio.h (iirc); see the manpage for open(2) to confirm. Remember to close the descriptor afterward with close(2), or your program will leak descriptors.
May 25, 2003, 2:29 AM
TriCk
is that vb ?
May 25, 2003, 2:40 AM
______
[quote author=TriCk link=board=17;threadid=1413;start=0#msg10585 date=1053830435]
is that vb ?
[/quote]

no
May 25, 2003, 4:26 AM
TriCk
in vb please :-\
thanx anyway ______
May 25, 2003, 7:39 AM
______
np
are you tring to find a user in your database?
or tring to load the user into the database from a text file?
May 25, 2003, 8:12 AM
TriCk
Either find the user in a listbox
Or
Find them in Users.txt


Ive got the listbox loading and saving Users.txt
to add some and shit
but i dunno how to safelist all of em...
May 25, 2003, 9:04 AM
______
either make a diffrent listbox and name it safelist check to see if there on the list if there on the list dont ban them else ban them.

or another possiblility is make a listview and give the user the tag of "S". When the user joins the channel check the tag. if the Tag is "S" then dont ban them else Ban them. hope this helps some.
May 25, 2003, 2:21 PM

Search