Forum

> > CS2D > Scripts > Listing a particular files in a table!
Forums overviewCS2D overview Scripts overviewLog in to reply

English Listing a particular files in a table!

6 replies
To the start Previous 1 Next To the start

old Listing a particular files in a table!

Ajmin
User Off Offline

Quote
I cant explain this without a example!
Heres a table of mapvoting script:
1
listmaps = {de_dust,aim_shotgun)
-- this is a list of particular maps which is in maps folder and this is considered in map voting list!
But i need to do something like this:
1
listmaps= {..all .map files in maps folder..)

Thanks in advance!

old Re: Listing a particular files in a table!

_Yank
User Off Offline

Quote
I made a much more simpler version of the kemines one for my dayz project but unfortunately, I was developing it with cs2dusers service and I did no backups, so I lost the script

Anyway, I've been wondering, why dont you just use the CS2D maps or maplist (cant remember) commamd ?

old Re: Listing a particular files in a table!

MikuAuahDark
User Off Offline

Quote
based from user _Yank, it's better to use cs2d cmd maps
because it's cross platform.

something like this in pseudo-code
1
2
3
4
5
6
7
8
9
10
function capture_log(msg) hooked to log hook
	if capture_mode is true and msg isn't "----- Maps -----"
		-- capture map list here(like inserting "msg" contents into table)
	endif
endfunc

.. somewhere in your code
capture_mode=true
parse("maps")
capture_mode=false

old Re: Listing a particular files in a table!

Flacko
User Off Offline

Quote
That's a good idea, using the cs2d lua hook log hook and the cs2d cmd maps command as suggested before isn't too hard:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
maps = {}

addhook("log", "onLog")
function onLog (txt)
	table.insert(maps, txt)
end
parse("maps")
freehook("log","onLog")

print("--")
for i = 2, #maps do
	print(maps[i])
end
print("--")
edited 2×, last 05.01.15 07:39:12 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview