English Load maps in a lua Menu

7 replies
Goto Page
To the start Previous 1 Next To the start
09.09.11 08:35:37 pm
Up
DragonAwper
User
Offline Off
Script that loads all maps that i have in
map folder (cs2d/maps/) in a menu

i tried to made but i don't know how to list the names in a menu

1.Is it possible?
2.How to Make it?

Thanks a lot.
09.09.11 08:36:33 pm
Up
Yates
Reviewer
Offline Off
Lua command to change a map would be.
Code:
1
parse("Changemap <mapname>")
09.09.11 10:58:12 pm
Up
Tajifun
User
Offline Off
Quote:
Script that loads all maps that i have in
map folder (cs2d/maps/) in a menu


Are you serious?
Tajifun yay.
09.09.11 10:59:11 pm
Up
Yates
Reviewer
Offline Off
Oh. Wait, am I reading this correctly now? He wants a lua that checks all his maps and puts them into a menu?!
09.09.11 11:02:48 pm
Up
Jela331
User
Offline Off
Do you want lua which checks every map and puts it in map vote menu?
09.09.11 11:20:34 pm
Up
PyKemis
User
Offline Off
Here you go. Organizing from table/array to menu/gui is up to you.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
os.execute('dir "maps" > tmp') --windows
os.execute('ls -a1 "maps" > tmpmap') --unix

maps={}
for file in io.lines("tmp") do
     if file:sub(-4) == ".map" then
          table.insert(maps,string.sub(file,40,-5))
     end
end

os.execute('del tmp') --windows
os.execute('rm tmp') --unix

for _,map in ipairs(maps) do
     msg(map) --showing that it works
end
09.09.11 11:34:43 pm
Up
DragonAwper
User
Offline Off
no, if i want a vote menu i create other lua file with the maps , it's only a test for other script i'm making
10.09.11 01:06:04 am
Up
PyKemis
User
Offline Off
So you want to list a large number of items and have a less and more button to navigate through the items? Your last post was really bad at explaining that.
To the start Previous 1 Next To the start