Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: TriCk on May 24, 2003, 06:04 AM

Title: Finding
Post by: TriCk on May 24, 2003, 06:04 AM
How Do I find a username on a txt file or a listbox?
in Code please not Case
Title: Re:Finding
Post by: CrAz3D on May 24, 2003, 12:06 PM
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
Title: Re:Finding
Post by: TriCk on May 24, 2003, 06:43 PM
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...
Title: Banlist from a file:
Post by: Kp on May 24, 2003, 09:29 PM
Quote from: TriCk on May 24, 2003, 06:43 PM
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...
Setting aside that loading from a text file to test for bannables is a bad idea for efficiency reasons:
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);
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.
Title: Re:Finding
Post by: TriCk on May 24, 2003, 09:40 PM
is that vb ?
Title: Re:Finding
Post by: ______ on May 24, 2003, 11:26 PM
Quote from: TriCk on May 24, 2003, 09:40 PM
is that vb ?

no
Title: Re:Finding
Post by: TriCk on May 25, 2003, 02:39 AM
in vb please  :-\
thanx anyway  ______
Title: Re:Finding
Post by: ______ on May 25, 2003, 03:12 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?
Title: Re:Finding
Post by: TriCk on May 25, 2003, 04:04 AM
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...
Title: Re:Finding
Post by: ______ on May 25, 2003, 09:21 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.