Nextmap announce lua

Discussions about ET modding (sdk code, player/weapon modeling)

Moderators: Forum moderators, developers

Post Reply
Micha!
Posts: 17
Joined: Thu Oct 23, 2008 8:01 am

Nextmap announce lua

Post by Micha! »

Hello, is it possible to make a lua which annouce the nextmap (maybe with help of a cycle.cfg)
I tried this but it didn't worked:

Code: Select all

set d1 "set g_gametype 5 ; map supply; qsay ^wNext map is: ^3Oasis; set nextmap vstr d2"
set d2 "set g_gametype 5 ; map oasis ; qsay ^wNext map is: ^3Goldrush ; set nextmap vstr d3"
set d3 "set g_gametype 5 ;map goldrush ; qsay ^wNext map is: ^3Radar ; set nextmap vstr d4"
set d4 "set g_gametype 5 ; map radar ; qsay ^wNext map is: ^3Tc Base ; set nextmap vstr d5"
set d5 "set g_gametype 5 ; map tc_base ; qsay ^wNext map is: ^3ET Beach ; set nextmap vstr d6"
set d6 "set g_gametype 5 ; map et_beach ; qsay ^wNext map is: ^3Frostbite; set nextmap vstr d7"
set d7 "set g_gametype 5 ; map frostbite ; qsay ^wNext map is: ^3Delivery ; set nextmap vstr d8"
set d8 "set g_gametype 5 ; map sp_delivery_te ; qsay ^wNext map is: ^3Adlernest ; set nextmap vstr d9"
set d9 "set g_gametype 5 ; map adlernest ; qsay ^wNext map is: ^3Bremen b2 ; set nextmap vstr d10"
set d10 "set g_gametype 5 ; map bremen_b2 ; qsay ^wNext map is: ^3Braundorf b4 ; set nextmap vstr d11"
set d11 "set g_gametype 5 ; map braundorf_b4 ; qsay ^wNext map is: ^3Et Ice ; set nextmap vstr d12"
set d12 "set g_gametype 5 ; map et_ice ; qsay ^wNext map is: ^3Goldrush-GA ; set nextmap vstr d13"
set d13 "set g_gametype 5 ; map goldrush-ga ; qsay ^wNext map is: ^3Railgun ; set nextmap vstr d14"
set d14 "set g_gametype 5 ; map railgun ; qsay ^wNext map is: ^3Dubrovnik ; set nextmap vstr d15"
set d15 "set g_gametype 5 ; map dubrovnik_final ; qsay ^wNext map is: ^3Sw Battery ; set nextmap vstr d16"
set d16 "set g_gametype 5 ; map sw_battery ; qsay ^wNext map is: ^3Village ; set nextmap vstr d17"
set d17 "set g_gametype 5 ; map et_village ; qsay ^wNext map is: ^3Supply ; set nextmap vstr d1"
vstr d1
It would be great if the lua can announce a say "Nextmap is MAPNAME" if a player callvote nextmap or if for example 2 min of the maptime left.
User avatar
X-DOS
Posts: 19
Joined: Sat May 17, 2008 8:41 pm
Location: United World
Contact:

Post by X-DOS »

Get value of nextmap, where is something like "vstr d3", then get value of d3 and search there for "; map mapname;" using regexp in lua
Micha!
Posts: 17
Joined: Thu Oct 23, 2008 8:01 am

Post by Micha! »

Solved: Nextmap.lua

Code: Select all

Version = 1.0

-------------------------------------------------

function et_InitGame(levelTime,randomSeed,restart)
	et.G_Print("[Nextmap] Version:"..Version.." Loaded\n")
   	et.RegisterModname("Nextmap Announce")
end

-------------------------------------------------

samplerate = 290000  --300000
map1 = "supply"
map2 = "oasis"
map3 = "goldrush"
map4 = "radar"
map5 = "tc_base"
map6 = "et_beach"
map7 = "frostbite"
map8 = "sp_delivery_te"
map9 = "adlernest"
map10 = "bremen_b2"
map11 = "braundorf_b4"
map12 = "et_ice"
map13 = "goldrush-ga"
map14 = "railgun"
map15 = "dubrovnik_final"
map16 = "sw_battery"
map17 = "et_village"

-------------------------------------------------

function et_RunFrame( levelTime )
	if math.mod(levelTime, samplerate) ~= 0 then return end
       mapname = et.trap_Cvar_Get( "mapname" )         
	 if mapname == map1 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map2.."\n\"" )
	 elseif mapname == map2 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map3.."\n\"" )
	 elseif mapname == map3 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map4.."\n\"" )
	 elseif mapname == map4 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map5.."\n\"" )
	 elseif mapname == map5 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map6.."\n\"" )
	 elseif mapname == map6 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map7.."\n\"" )
	 elseif mapname == map7 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map8.."\n\"" )
	 elseif mapname == map8 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map9.."\n\"" ) 
	 elseif mapname == map9 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map10.."\n\"" ) 
	 elseif mapname == map10 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map11.."\n\"" ) 
	 elseif mapname == map11 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map12.."\n\"" ) 
	 elseif mapname == map12 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map13.."\n\"" ) 
	 elseif mapname == map13 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map14.."\n\"" ) 
	 elseif mapname == map14 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map15.."\n\"" )     
	 elseif mapname == map15 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map16.."\n\"" )  
	 elseif mapname == map16 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map17.."\n\"" )  
	 elseif mapname == map17 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map1.."\n\"" )       
         end
       end

  
function et_ClientCommand(client, command)
	local 	mapname = et.trap_Cvar_Get( "mapname" ) 
  if string.lower(command) == "callvote" then
	if et.trap_Argv(1) == "nextmap" then
	 if mapname == map1 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map2.."\n\"" )
	 elseif mapname == map2 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map3.."\n\"" )
	 elseif mapname == map3 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map4.."\n\"" )
	 elseif mapname == map4 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map5.."\n\"" )
	 elseif mapname == map5 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map6.."\n\"" )
	 elseif mapname == map6 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map7.."\n\"" )
	 elseif mapname == map7 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map8.."\n\"" )
	 elseif mapname == map8 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map9.."\n\"" ) 
	 elseif mapname == map9 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map10.."\n\"" ) 
	 elseif mapname == map10 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map11.."\n\"" ) 
	 elseif mapname == map11 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map12.."\n\"" ) 
	 elseif mapname == map12 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map13.."\n\"" ) 
	 elseif mapname == map13 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map14.."\n\"" ) 
	 elseif mapname == map14 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map15.."\n\"" )     
	 elseif mapname == map15 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map16.."\n\"" )  
	 elseif mapname == map16 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map17.."\n\"" )  
	 elseif mapname == map17 then
	         et.trap_SendServerCommand(-1, "chat \"^1Nextmap: ^3"..map1.."\n\"" )        
        	    end	
     	        end
	    end
	end
Post Reply