Forum

> > CS2D > Scripts > information about the file
Forums overviewCS2D overview Scripts overviewLog in to reply

English information about the file

3 replies
To the start Previous 1 Next To the start

old information about the file

Mr Jack1e
User Off Offline

Quote
hello. for example I have a file sss.txt in cs2d/sys directory. anybody know how to make a script that would count how much lines are there in sss.txt on every spawn and show a message with that number.

or how much strings "number" there

old Re: information about the file

Alistaire
User Off Offline

Quote
1
2
3
4
5
6
local count = 0
while true do
	local line = io.read()
	if line == nil then break end
	count = count + 1
end

or

1
2
3
4
5
6
local count = 0
while true do
	if string.find(io.read(), 'number') then
		count = count + 1
	end
end

old Re: information about the file

MikuAuahDark
User Off Offline

Quote
1
2
3
4
5
6
7
8
addhook("spawn","ssstxt")
function ssstxt(id)
	count=0
	for line in io.lines("sys/sss.txt") do
		count=count+1
	end
	msg2(id,count)
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview