Resxt after hacking some of your code (thanks btw) together for five minutes i got a working randomized script. Good job, keep it up
for anyone whos interested (all credit obv goes to Resxt) :
||
#include maps\mp\gametypes\_hud_util;
#include maps\mp\gametypes_zm\_hud_util;
#include common_scripts\utility;
#include maps\mp\_utility;
SetDvarIfNotInitialized(dvar, value)
{
if (!IsInitialized(dvar))
{
SetDvar(dvar, value);
}
}
IsInitialized(dvar)
{
result = GetDvar(dvar);
return result != "";
}
IsMultiplayerMode()
{
return !IsDefined(level.zombiemode) || !level.zombiemode;
}
Init()
{
replaceFunc(maps\mp\gametypes\_killcam::finalkillcamwaiter, ::OnKillcamEnd);
SetDvarIfNotInitialized("mapvote_default_rotation_maps", "Hijacked:Raid:Nuketown:Carrier:Express:Slums:Cargo:Yemen:Plaza");
SetDvarIfNotInitialized("mapvote_default_rotation_modes", "war:dom:dm:koth:ctf:onflag:sd:oic:gun:sas");
}
OnKillcamEnd()
{
if (!IsDefined(level.finalkillcam_winner))
{
if (isRoundBased() && !wasLastRound())
return false;
wait 5;
DoRotation();
return false;
}
level waittill("final_killcam_done");
if (isRoundBased() && !wasLastRound())
return true;
wait 5;
DoRotation();
return true;
}
GetRandomElementInArray(array)
{
return array[GetArrayKeys(array)[randomint(array.size)]];
}
GetMapCodeName(mapName)
{
formattedMapName = ToUpper(mapName);
if (IsMultiplayerMode())
{
switch(formattedMapName)
{
case "NUKETOWN":
return "mp_nuketown_2020";
case "HIJACKED":
return "mp_hijacked";
case "MELTDOWN":
return "mp_meltdown";
case "EXPRESS":
return "mp_express";
case "CARRIER":
return "mp_carrier";
case "OVERFLOW":
return "mp_overflow";
case "SLUMS":
return "mp_slums";
case "AFTERMATH":
return "mp_la";
case "CARGO":
return "mp_dockside";
case "TURBINE":
return "mp_turbine";
case "DRONE":
return "mp_drone";
case "RAID":
return "mp_raid";
case "STANDOFF":
return "mp_village";
case "PLAZA":
return "mp_nightclub";
case "YEMEN":
return "mp_socotra";
case "UPLINK":
return "mp_uplink";
case "DETOUR":
return "mp_bridge";
case "COVE":
return "mp_castaway";
case "RUSH":
return "mp_paintball";
case "STUDIO":
return "mp_studio";
case "MAGMA":
return "mp_magma";
case "VERTIGO":
return "mp_vertigo";
case "ENCORE":
return "mp_concert";
case "DOWNHILL":
return "mp_downhill";
case "GRIND":
return "mp_skate";
case "HYDRO":
return "mp_hydro";
case "MIRAGE":
return "mp_mirage";
case "FROST":
return "mp_frostbite";
case "TAKEOFF":
return "mp_takeoff";
case "POD":
return "mp_pod";
case "DIG":
return "mp_dig";
}
}
else
{
switch(formattedMapName)
{
case "BURIED":
return "zm_buried";
case "DIE RISE":
return "zm_highrise";
case "MOB OF THE DEAD":
return "zm_prison";
case "NUKETOWN":
return "zm_nuked";
case "ORIGINS":
return "zm_tomb";
case "TRANZIT":
case "FARM":
case "TOWN":
case "BUS DEPOT":
return "zm_transit";
case "DINER":
return "zm_transit_dr";
}
}
}
DoRotation()
{
modeCfg = GetRandomElementInArray(StrTok(GetDvar("mapvote_default_rotation_modes"), ":"));
mapName = GetMapCodeName(GetRandomElementInArray(StrTok(GetDvar("mapvote_default_rotation_maps"), ":")));
SetDvar("sv_maprotationcurrent", "execgts " + modeCfg + ".cfg map " + mapName);
SetDvar("sv_maprotation", "execgts " + modeCfg + ".cfg map " + mapName);
}
||