Skrip Posted April 8, 2007 Posted April 8, 2007 $Input7 = GUICtrlCreateInput("shared.lua", 160, 216, 121, 21) $Input32 = GUICtrlCreateInput("Garry's Mod", 160, 192, 433, 21) $Input33 = GUICtrlCreateInput("", 160, 224, 433, 21) ;PreVars $path = RegRead("HKEY_CURRENT_USER\Software\Valve\Steam", "SteamPath") GUICtrlSetData($Input32, $path) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $path = GUICtrlRead($Input32) $name = GUICtrlRead($Input33) $file = FileOpen($path & "\" & $name & ".lua", 2) Sleep(100) FileWrite($file, "if (SERVER) then" & @CRLF) FileWrite($file, "AddCSLuaFile(""" & $input7 & """)") FileWrite($file, "SWEP.Weight = " & $input7) EndSwitch WEnd I think that's all you need to figure it out. If you need the whole code. PM me. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
Skrip Posted April 8, 2007 Author Posted April 8, 2007 Well, I do not know if that's the problem. It creates the file. It just doesn't write the lines. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
Obi-w00t Posted April 8, 2007 Posted April 8, 2007 OK, it works for me fine when creating files. The lines are written OK too, here is the code in case I have the concept wrong: $Input7 = "shared.lua" ;PreVars $path = RegRead("HKEY_CURRENT_USER\Software\Valve\Steam", "SteamPath") $name = "Hello" MsgBox(0,"",$path & "\" & $name & ".lua") $file = FileOpen($path & "\" & $name & ".lua", 2) Sleep(100) FileWrite($file, "if (SERVER) then" & @CRLF) FileWrite($file, "AddCSLuaFile(""" & $input7 & """)") FileWrite($file, "SWEP.Weight = " & $input7) FileClose($file) And the file looks like: if (SERVER) then AddCSLuaFile("shared.lua")SWEP.Weight = shared.lua
Uten Posted April 8, 2007 Posted April 8, 2007 You forgot FileClose and error checking. At least in the provided sample. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now