Hey there,
I would like to share my nextmap vote system, you can freely use or modify it just use credit. You can watch a demo here:
You can config a few paramter like selectable maps, time limit and so one, add these lines to your server's cfg.
PHP Code:
set scr_nextmap "1"
set scr_nextmap_maps "mp_burgundy,mp_carentan,mp_dawnville,mp_toujane"
set scr_nextmap_time "90" //seconds
First thing first, you have to precache shaders and strings.
PHP Code:
game["timeleft"] = &"Remaining time";
game["hintleft"] = &"<-- [{+attack}]";
game["hintright"] = &"[{toggleads}], [{+speed}] -->";
game["mp_breakout"] = &"Villers-Bocage^1(^7&&1^1)";
game["mp_brecourt"] = &"Brecourt^1(^7&&1^1)";
game["mp_burgundy"] = &"Burgundy^1(^7&&1^1)";
game["mp_carentan"] = &"Carentan^1(^7&&1^1)";
game["mp_dawnville"] = &"St. Mere Eglise^1(^7&&1^1)";
game["mp_decoy"] = &"El Alamein^1(^7&&1^1)";
game["mp_downtown"] = &"Moscow^1(^7&&1^1)";
game["mp_farmhouse"] = &"Beltot^1(^7&&1^1)";
game["mp_harbor"] = &"Rostov^1(^7&&1^1)";
game["mp_leningrad"] = &"Leningrad^1(^7&&1^1)";
game["mp_matmata"] = &"Matmata^1(^7&&1^1)";
game["mp_railyard"] = &"Stalingrad^1(^7&&1^1)";
game["mp_rhine"] = &"Wallendar^1(^7&&1^1)";
game["mp_toujane"] = &"Toujane^1(^7&&1^1)";
game["mp_trainstation"] = &"Caen^1(^7&&1^1)";
PreCacheString(game["timeleft"]);
PreCacheString(game["hintleft"]);
PreCacheString(game["hintright"]);
PreCacheString(game["mp_breakout"]);
PreCacheString(game["mp_brecourt"]);
PreCacheString(game["mp_burgundy"]);
PreCacheString(game["mp_carentan"]);
PreCacheString(game["mp_dawnville"]);
PreCacheString(game["mp_decoy"]);
PreCacheString(game["mp_downtown"]);
PreCacheString(game["mp_farmhouse"]);
PreCacheString(game["mp_harbor"]);
PreCacheString(game["mp_leningrad"]);
PreCacheString(game["mp_matmata"]);
PreCacheString(game["mp_railyard"]);
PreCacheString(game["mp_rhine"]);
PreCacheString(game["mp_toujane"]);
PreCacheString(game["mp_trainstation"]);
PrecacheShader("black");
PrecacheShader("white");
PrecacheShader("loadscreen_mp_breakout");
PrecacheShader("loadscreen_mp_brecourt");
PrecacheShader("loadscreen_mp_burgundy");
PrecacheShader("loadscreen_mp_carentan");
PrecacheShader("loadscreen_mp_dawnville");
PrecacheShader("loadscreen_mp_decoy");
PrecacheShader("loadscreen_mp_downtown");
PrecacheShader("loadscreen_mp_farmhouse");
PrecacheShader("loadscreen_mp_harbor");
PrecacheShader("loadscreen_mp_leningrad");
PrecacheShader("loadscreen_mp_matmata");
PrecacheShader("loadscreen_mp_railyard");
PrecacheShader("loadscreen_mp_rhine");
PrecacheShader("loadscreen_mp_toujane");
PrecacheShader("loadscreen_mp_trainstation");
I used it after the scorebord part in the gametype/endmap function, so firstly I need to hide the scoreboard for each player. I created a menu for it.
PHP Code:
game["menu_clientcommand"] = "ClientCommand";
PrecacheMenu(game["menu_clientcommand"]);
So there is a menu file, called "ClientCommand.menu"
PHP Code:
#include "ui_mp/menudef.h"
MenuDef
{
Name "ClientCommand"
Rect 0 0 1 1
Visible 0
Fullscreen 0
OnOpen
{
exec "vstr ClientCommand";
close ClientCommand;
}
}
Finally here is the full source
PHP Code:
GetCurrenttMap(maps)
{
valid = false;
current = GetCvar("mapname");
for (i = 0; i < maps.size; i++)
{
if (maps[i] == current)
{
valid = true;
break;
}
}
if (!valid)
{
current = maps[0];
}
return current;
}
GetNextMap(maps, current)
{
id = 0;
if (!IsDefined(current))
{
current = GetCurrenttMap(maps);
}
for (i = 0; i < maps.size; i++)
{
if (maps[i] == current)
{
id = i;
break;
}
}
if (id == 0)
{
return maps[maps.size - 1];
}
else
{
return maps[id - 1];
}
}
GetPreviousMap(maps, current)
{
id = 0;
if (!IsDefined(current))
{
current = GetCurrenttMap(maps);
}
for (i = 0; i < maps.size; i++)
{
if (maps[i] == current)
{
id = i;
break;
}
}
if (id == maps.size - 1)
{
return maps[0];
}
else
{
return maps[id + 1];
}
}
NextMapVote()
{
self endon("disconnect");
self SetClientCvar("ClientCommand", "-scores");
self OpenMenu(game["menu_clientcommand"]);
self CloseMenu(game["menu_clientcommand"]);
wait level.frame;
self SetClientCvar("ClientCommand", "");
self CloseMenu();
self CloseInGameMenu();
self.nextmap = SpawnStruct();
self.nextmap.current = GetCurrenttMap();
level.nextmap[self.nextmap.current]++;
self.nextmap.linebackground = NewClientHudElem(self);
self.nextmap.linebackground.sort = 6;
self.nextmap.linebackground.horzAlign = "center";
self.nextmap.linebackground.vertAlign = "middle";
self.nextmap.linebackground.x = -427;
self.nextmap.linebackground.y = -127;
self.nextmap.linebackground.color = (1, 1, 1);
self.nextmap.linebackground.alpha = 0;
self.nextmap.linebackground SetShader("white", 854, 254);
self.nextmap.background = NewClientHudElem(self);
self.nextmap.background.sort = 7;
self.nextmap.background.horzAlign = "center";
self.nextmap.background.vertAlign = "middle";
self.nextmap.background.x = -427;
self.nextmap.background.y = -240;
self.nextmap.background.color = (0, 0, 0);
self.nextmap.background.alpha = 0;
self.nextmap.background SetShader("white", 854, 480);
self.nextmap.background FadeOverTime(1);
self.nextmap.background.alpha = 0.8;
self.nextmap.linebackground FadeOverTime(1);
self.nextmap.linebackground.alpha = 0.7;
wait 1;
self.nextmap.centerbackground = NewClientHudElem(self);
self.nextmap.centerbackground.sort = 8;
self.nextmap.centerbackground.horzAlign = "center";
self.nextmap.centerbackground.vertAlign = "middle";
self.nextmap.centerbackground.x = -224;
self.nextmap.centerbackground.y = -127;
self.nextmap.centerbackground.color = (1, 0, 0);
self.nextmap.centerbackground.alpha = 0;
self.nextmap.centerbackground SetShader("white", 448, 254);
self.nextmap.leftbackground = NewClientHudElem(self);
self.nextmap.leftbackground.sort = 8;
self.nextmap.leftbackground.horzAlign = "center";