Forum

> > CS2D > Scripts > Mapchange every 60minute
Forums overviewCS2D overview Scripts overviewLog in to reply

English Mapchange every 60minute

15 replies
To the start Previous 1 Next To the start

old Mapchange every 60minute

Rygna
User Off Offline

Quote
Hello,
Can you give me some Scripts about Mapchange Every 60minute?

i mean,
Map will changed every 60minute (LOOP)

Thanks.

old Re: Mapchange every 60minute

THEMUD
User Off Offline

Quote
Here, try this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mapChange = true;

maps = {
	[1] = "MAP1_NAME";
	[2] = "MAP2_NAME";
	[3] = "MAP3_NAME";
}

function _changeMap()
	mapChange = true;
	parse("changemap "..maps[math.random(1, #maps)]);
end

while mapChange do
	mapChange = false;
	timer(60000*60, "_changeMap");
end

You have to fill up your desired maps names in the table's elements.

old Re: Mapchange every 60minute

Rygna
User Off Offline

Quote
@user Hajt: Thanks!, but i just want like IRAN TOWN CountDown Restart.
@user Rainoth: Yes, but the big problem is, i don't know where to start make it

and, now i want the HUD Count Down Number Every 60minute

old Re: Mapchange every 60minute

Rygna
User Off Offline

Quote
Like this?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
times = 3600

addhook("second","me")
function me()
	if times and times > 0 then
		parse('hudtxt 1 "MapChange in : '..timer..' " 40 40 0")
	elseif times == 0 then
		parse('hutxt 1 "" 0 0 0')
		timer = nil
	end
end

addhook("startround" , "_mes")
function _mes()
	timer = 3600
end

old Re: Mapchange every 60minute

GeoB99
Moderator Off Offline

Quote
Both 6, 9 and 15 line will cause a bug because timer is not recognized at all inside the code. Try with this snippet:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
minute = 60 
second = 59
PosX =  -- Position X here
PosY =  -- Position Y here

maps = {
     [1] = "MAP1_NAME",
     [2] = "MAP2_NAME",
     [3] = "MAP3_NAME",
}


function CountTimeHUD()
	second = second - 1
	if second >= 59 then
		minute = minute - 1
		if minute == 00 then
			parse("changemap " .. maps[math.random(1, #maps)])
		end
	end
	parse('hudtxt 0 "\169255255255Changemap till: " .. minute .. ":" .. second .. " " .. PosX .. " " .. PosY .. " 0')
end


function startround_()
	minute = 60
	second = 59
end

addhook("startround","startround_")
addhook("second","CountTimeHUD")
Just change the X and Y axis position in 3 and 4 line in your wish. I cannot guarantee 100% that this script will work perfectly. In case if you see any unexpected behaviour, post it here.

old Re: Mapchange every 60minute

DC
Admin Off Offline

Quote
You don't need any Lua for that at all! This functionality is built in in CS2D.
Just use cs2d cmd mp_timelimit 60! The list of maps has to be saved in sys/mapcycle.cfg. Done.

old Re: Mapchange every 60minute

Rygna
User Off Offline

Quote
Scripts From ZxC not Work.

but i re-edit it then it work.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
minute = 60 
second = 59
PosX =  40
PosY =  40

maps = {
     [1] = "rp_amstria_v0.4",
     [2] = "MAP2_NAME",
     [3] = "MAP3_NAME",
}


function CountTimeHUD()
     second = second - 1
     if second >= 59 then
          minute = minute - 1
          if minute == 00 then
               parse("changemap " .. maps[math.random(1, #maps)])
          end
     end
     parse('hudtxt 0 "\169255255255Changemap till: '..minute..' '..second..'" 40 40 0')
end


function startround_()
     minute = 60
     second = 59
end

addhook("startround","startround_")
addhook("second","CountTimeHUD")

But this Scripts is BUG!, the minute going negative number
i mean like this ( -30 / -31 / -32 )
edited 1×, last 08.04.16 02:11:56 pm

old Re: Mapchange every 60minute

GeoB99
Moderator Off Offline

Quote
Oops, I forgot to assign the second table as 59 every time when second is equal to 0. I edited the code now. It should work actually. The 3 and 4 line are also removed since you already added the positions inside the cs2d cmd hudtxt parameters.
The Code >
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview