Im wondering is it possible to write such lua:
Code: Select all
when the intermission stars then:
exec some cmds
elseif intermission time - 5 seconds then
exec some cmds
thx for any help, regards
Moderators: Forum moderators, developers
Code: Select all
when the intermission stars then:
exec some cmds
elseif intermission time - 5 seconds then
exec some cmds
Code: Select all
log("Timelimit: $timelimit")
( $line eq "Exit: Wolf EndRound." || $line eq "Exit: Timelimit hit." )
Code: Select all
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec commands.txt")
Code: Select all
intermission_time = <put_yours_here> * 1000
endofmap = false
function et_Print(text)
if text == "Exit: Timelimit hit.\n" or text == "Exit: Wolf EndRound.\n" then
endofmap = true
next_exec = levelTime + (intermission_time - 5000)
-- do something here
end
end
function et_RunFrame(lvltime)
levelTime = lvltime
if endofmap then
if next_exec <= levelTime then
endofmap = false
-- do something else here
end
end
end
@ReyalPinter.lua wrote: intermission_time = 60 * 1000
endofmap = false
function et_Print(text)
if text == "Exit: Timelimit hit.\n" or text == "Exit: Wolf EndRound.\n" then
endofmap = true
next_exec = levelTime + (intermission_time - 5000)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_on.cfg")
end
end
function et_RunFrame(lvltime)
levelTime = lvltime
if endofmap then
if next_exec <= levelTime then
endofmap = false
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_off.cfg")
end
end
end
Code: Select all
// NERVE - SMF - wolf server/game states
typedef enum {
GS_INITIALIZE = -1,
GS_PLAYING,
GS_WARMUP_COUNTDOWN,
GS_WARMUP,
GS_INTERMISSION,
GS_WAITING_FOR_PLAYERS,
GS_RESET
} gamestate_t;
Code: Select all
function et_InitGame( levelTime, randomSeed, restart )
gamestate = tonumber(et.trap_Cvar_Get( "gamestate" ))
if gamestate == 0 then -- GS_PLAYING
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_off.cfg \n")
elseif gamestate == 1 then -- GS_WARMUP_COUNTDOWN
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_on.cfg \n")
elseif gamestate == 2 then -- GS_WARMUP
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_on.cfg \n")
end
end
Code: Select all
function et_InitGame( levelTime, randomSeed, restart )
gamestate = tonumber(et.trap_Cvar_Get( "gamestate" ))
wuptime=0
if gamestate == 2 then -- GS_WARMUP
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_on.cfg \n")
repeat
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cpmsay \"^3FUN MODE ^2ON ^8(only for warmup)\n\"")
wuptime=wuptime+5000
until wuptime==55000
if (wuptime==55000) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_off.cfg \n")
end
end
end
Code: Select all
function et_InitGame( levelTime, randomSeed, restart )
notify = 0
local gamestate = tonumber(et.trap_Cvar_Get( "gamestate" ))
if gamestate == 0 then -- GS_PLAYING
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_off.cfg \n")
notify = 1
elseif gamestate == 1 then -- GS_WARMUP_COUNTDOWN
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_on.cfg \n")
elseif gamestate == 2 then -- GS_WARMUP
et.trap_SendConsoleCommand(et.EXEC_APPEND, "exec fun_on.cfg \n")
end
end
function et_RunFrame(leveltime)
if notify == 1 then return end
if math.mod(leveltime, 5000) ~= 0 then return end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "qsay \"^3FUN MODE ^2ON ^8(only for warmup)\"\n")
end