Forum

> > CS2D > Scripts > Restart When Reach Round Limit
Forums overviewCS2D overview Scripts overviewLog in to reply

English Restart When Reach Round Limit

11 replies
To the start Previous 1 Next To the start

old Re: Restart When Reach Round Limit

Joni And Friends
User Off Offline

Quote
This you mean?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
round_limit=0
maxround=5 ----- limited of round_limit

addhook("endround","_end")
function _end(mode)
if mode>0 then
if round_limit<maxround and mode~=5 or mode~=4  then
round_limit=round_limit+1
end
end
end

addhook("startround","_str")
function _str()
if round_limit==maxround then
parse("restart 0")
round_limit=0
end
end

old Re: Restart When Reach Round Limit

Joni And Friends
User Off Offline

Quote
add this for show hudtxt: "auto restart"

Spoiler >

old Re: Restart When Reach Round Limit

deadlox995
User Off Offline

Quote
JAF one more thing can you help fix this i'm need it hide cmds

if not kr then kr = {} end

function totable(t,match)
     local cmd = {}
     if not match then
          match = "[^%s]+"
     else
          match = "[^"..match.."]+"
     end
     for word in string.gmatch(t,match) do
          table.insert(cmd,word)
     end
     return cmd
end

function kr.f_exists(file)
     f = io.open(file)
     if (f) then
          f:close()
          return true
     end
     return false
end

addhook("say","kr.say")
function kr.say(id,txt)
     txt = totable(txt)
     local info = ""
     if(txt[1] == "@report") then
	  if(txt[2]) then
               txt[2] = tonumber(txt[2])
               if(player(txt[2],"exists")) then
                    if(txt[2] ~= id) then
                         for i,v in ipairs(txt) do
                              if(i > 2) then
                                   info = info.." "..v
                              end
                         end
                    else
                         msg2(id,"©255000000You can't report yourself!")
                         return 1
                    end
                    if(info) then
                         local fn = 1
                         while true do 
                              if not(kr.f_exists("sys/lua/report/report"..fn..".txt")) then
                                   return 1
				   break
                              end
                              fn = fn+1
                         end
                         f = io.open("sys/lua/report/report"..fn..".txt","w+")
                         if(f) then
                              f:write("Name : "..player(txt[2],"name").."\nUsgn : "..player(txt[2],"usgn").."\nInformation : "..info.."\nDate : "..os.date("%x - %H:%M:%S").."\n\nReported by : "..player(id,"name").."\nUsgn : "..player(id,"usgn"))
                              f:close()
                              msg2(id,"©000255000Your report has been sent!")
                              return 1
                         else
                              print("Attempt to open the report file failed")
                         end
                    else
                         return 1
                    end
               else
                    msg2(id,"Player does not exist!")
                    return 1
               end
          end
     end
end
edited 1×, last 06.06.14 01:53:17 pm

old Re: Restart When Reach Round Limit

TopNotch
User Off Offline

Quote
user Joni And Friends has written
add this for show hudtxt: "auto restart"

Spoiler >

Why would you update that HUD every 100 milliseconds?

old Re: Restart When Reach Round Limit

RedizGaming
GAME BANNED Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
maxround = 5
round = {}

addhook("endround","a")
function a()
	if round <= maxround then
		round = round + 1
	end
	if round == maxround then
		parse('restart 5')
		msg('©255255255Server Restart In 5 Seconds@C')
	end
end

old Re: Restart When Reach Round Limit

Dousea
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
currentround = 0
roundlimit = 50

addhook ("endround", "endroundhook")
addhook ("startround", "startroundhook")
addhook ("always", "alwayshook")

function endroundhook (mode)
	if (mode ~= 5) then
		currentround = (currentround + 1)
	end
end

function startroundhook ()
	if (currentround == roundlimit) then
		msg ("Reach the round limit")
		parse ("restart")
	end
end

function alwayshook ()
	parse ("hudtxt 0 \"Round: " .. currentround .. " / " .. roundlimit .. "\" 320 410 1")
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview