-
Apr 25th, 2006, 03:30 PM
#1
Thread Starter
New Member
program wont write to file
im attempting to make a program that will examine each line from a server log on my counter strike source server, and write to another text file everything an admin does...
here is an example of a server log:
Code:
L 04/23/2006 - 16:51:18: [SBSRC] Player with ID was checked recently, ignoring.
L 04/23/2006 - 16:51:19: "†AiDeN†<304><STEAM_0:0:8268692><Unassigned>" joined team "CT"
L 04/23/2006 - 16:51:19: Admin [-'TbC| Bang.] [STEAM_0:1:8215145] Executed : ma_givecash : Player [-'TbC| Bang.] [STEAM_0:1:8215145] had [800] cash, now has [16000] cash
L 04/23/2006 - 16:51:19: [MANI_ADMIN_PLUGIN] Admin [-'TbC| Bang.] [STEAM_0:1:8215145] Executed : ma_givecash : Player [|TAG|=>Ownerer Noobe^[Owners]] [STEAM_0:1:397838] had [30] cash, now has [16000] cash
the 4th line is an example of what i want written, in this case, the admin gave everyone $16000, the line is identified as an admin command by the program by detecting the"[MANI_ADMIN_PLUGIN]" text heild within... but for some reason, with the code ive made, it will not print to the second file
VB Code:
Private Sub Form_Load()
Dim tmp() As String
Dim splittmp As String
Dim printtofile1 As String
End Sub
Private Sub command1_Click()
Dim tmp() As String
Open "c:\L0423004.txt" For Input As #1
Open "c:\l0423004-admin.txt" For Output As #2
tmp = Split(Input(LOF(1), 1), vbCrLf)
Close #1
For x = 0 To UBound(tmp)
splittmp = Split(tmp(x), " ")
If Manicheck1 = True Then
If splittmp(4) = "[MANI_ADMIN_PLUGIN]" Then
printtofile1 = tmp(x) & vbNewLine
Print #2, printtofile1
printtofile1 = ""
End If
End If
Close #2
Next
MsgBox " Finished. "
End Sub
any idea whats wrong?
-
Apr 25th, 2006, 03:34 PM
#2
Re: program wont write to file
try this:
you had some things out of order...
VB Code:
Dim tmp() As String
Open "c:\L0423004.txt" For Input As #1
tmp = Split(Input(LOF(1), 1), vbCrLf)
Close #1
Open "c:\l0423004-admin.txt" For Output As #2
For x = 0 To UBound(tmp)
splittmp = Split(tmp(x), " ")
If Manicheck1 = True Then
If splittmp(4) = "[MANI_ADMIN_PLUGIN]" Then
printtofile1 = tmp(x) & vbNewLine
Print #2, printtofile1
printtofile1 = ""
End If
End If
Next
Close #2
MsgBox " Finished. "
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Apr 25th, 2006, 03:48 PM
#3
Thread Starter
New Member
Re: program wont write to file
Tried your code, l0423004-admin.txt was empty
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|