1
2
3
2
3
file = io.open("File.txt","w")
file:write("text")
file:close()
Scripts
Lua Scripts/Questions/Helpfile = io.open("File.txt","w")
file:write("text")
file:close()
file = io.open("File.txt","w")
file:write("text")
file:close()
writeFile("[i]*filename.extention*[/i], "[i]what to write[/i]", "[i]*mode[/i]*)
fileWrite(path,data)
	local file = io.open(path,"w")
	if type(data) == "table" then
		for i,v in ipairs(data) do file:write(v) end
	else
		file:write(data)
	end
	file:close()
end
fileWrite("my_epic_file.txt","hi")
fileWrite("my_second_file.txt",{"Hi ","I'm ","Writing ","To ","a ","text ","file"})
I'm slow at answering, sorry.
addhook("walkover", "wo")
addhook("menu", "_menu")
function wo (i, item)
	if ( item == 64 ) then
		menu(id, "Pickup Item?, Medkit|(1)")
		return 1
	elseif ( item == 65 ) then
		menu(id, "Pickup Item ?, Bandage|(1)")
		return 1
	else
		return 0
	end
end
function _menu(i, title, b)
	if ( title == "Pickup Item?") then
		if b == 1 then
			parse("equip "..i.." 64")
		end
	elseif ( title == "Pickup Item ?") then
		if b == 1 then
			parse("equip "..i.." 65")
		end
	end
end
plt=player(0,"table")
function ritem()
	pli=playerweapons(i)
	for i=1,plt and w=1,pli and ii=1,90 do
		if item(ii,"exists") then
	parse("strip "..plt[i].." "..pli[w])
	parse("equip "..plt[i].." "..pli[w])
	end
	break
end
addhook("second","ritem2")
rnum = math.random(2,6)
sec = 0
rsec = math.random(1,rnum)
function ritem2()
	sec = sec + 1
	if sec == 7 then
		sec = 0
	end
	if sec = rsec then
		ritem()
	end
end
I got bored so i made this
plt=player(0,"table") [b]-- plt will always be {} as there are no players at Lua init[/b]
function ritem()
	pli=playerweapons(i) -- [b]i is nil[/b]
	for i=1,plt and w=1,pli and ii=1,90 do -- [b]incorect syntax: for pointer, max, step do[/b]
		if item(ii,"exists") then
	parse("strip "..plt[i].." "..pli[w])
	parse("equip "..plt[i].." "..pli[w])
	end [b]-- You're missing an end for the for loop[/b]
	break
end
addhook("second","ritem2")
rnum = math.random(2,6) [b]-- You must seed the random generator first
--[[--
math.randomseed(os.time());math.random()
--]]--[/b]
sec = 0
rsec = math.random(1,rnum)
function ritem2()
	sec = sec + 1
	if sec == 7 then
		sec = 0
	end
	if sec = rsec then
		ritem()
	end
end
timer(1000,'print','test') ... after some time timer(3000,'print','hi')
test ... after some time test hi