diff --git a/addons/sourcemod/configs/mapchooser_extended/map_names/csgo.txt b/addons/sourcemod/configs/mapchooser_extended/map_names/csgo.txt new file mode 100644 index 0000000..485d936 --- /dev/null +++ b/addons/sourcemod/configs/mapchooser_extended/map_names/csgo.txt @@ -0,0 +1,58 @@ +"Map Names" +{ + "ar_baggage" "Baggage" + "ar_monastery" "Monsatery" + "ar_shoots" "Shoots" + "cs_agency" "Agency" + "cs_assault" "Assault" + "cs_backalley" "Back Alley" + "cs_cruise" "Cruise" + "cs_downtown" "Downtown" + "cs_insertion" "Insertion" + "cs_italy" "Italy" + "cs_militia" "Militia" + "cs_motel" "Motel" + "cs_office" "Office" + "cs_rush" "Rush" + "cs_thunder" "Thunder" + "cs_workout" "Workout" + "de_ali" "Ali" + "de_aztec" "Aztec" + "de_bank" "Bank" + "de_bazaar" "Bazaar" + "de_blackgold" "BlackGold" + "de_cache" "Cache" + "de_castle" "Castle" + "de_cbble" "Cobble" + "de_coast" "Coast" + "de_dust" "Dust" + "de_dust2" "Dust II" + "de_empire" "Empire" + "de_facade" "Facade" + "de_favela" "Favela" + "de_inferno" "Inferno" + "de_lake" "Lake" + "de_log" "Log" + "de_marquis" "Marquis" + "de_mikla" "Mikla" + "de_mirage" "Mirage" + "de_mist" "Mist" + "de_nuke" "Nuke" + "de_overgrown" "Overgrown" + "de_overpass" "Overpass" + "de_rails" "Rails" + "de_resort" "Resort" + "de_royal" "Royal" + "de_safehouse" "Safe House" + "de_santorini" "Santorini" + "de_seaside" "Seaside" + "de_season" "Season" + "de_shortdust" "Short Dust" + "de_shorttrain" "Short Train" + "de_stmarc" "St. Marc" + "de_sugarcane" "Sugar Cane" + "de_train" "Train" + "de_tulip" "Tulip" + "de_vertigo" "Veritgo" + "de_zoo" "Zoo" +} \ No newline at end of file diff --git a/addons/sourcemod/configs/mapchooser_extended/map_names/cstrike.txt b/addons/sourcemod/configs/mapchooser_extended/map_names/cstrike.txt new file mode 100644 index 0000000..34c07fb --- /dev/null +++ b/addons/sourcemod/configs/mapchooser_extended/map_names/cstrike.txt @@ -0,0 +1,31 @@ +"Map Names" +{ + "as_oilrig" "Oilrig" + "cs_747" "747" + "cs_assault" "Assault" + "cs_backalley" "Backalley" + "cs_compound" "Compound" + "cs_estate" "Estate" + "cs_havana" "Havana" + "cs_italy" "Italy" + "cs_militia" "Militia" + "cs_office" "Office" + "cs_siege" "Siege" + "de_airstrip" "Airstrip" + "de_aztec" "Aztec" + "de_cbble" "Cobble" + "de_chateau" "Chateau" + "de_dust2" "Dust II" + "de_dust" "Dust" + "de_inferno" "Inferno" + "de_nuke" "Nuke" + "de_piranesi" "Piranesi" + "de_port" "Port" + "de_prodigy" "Prodigy" + "de_storm" "Storm" + "de_survivor" "Survivor" + "de_tides" "Tides" + "de_torn" "Torn" + "de_train" "Train" + "de_vertigo" "Vertigo" +} \ No newline at end of file diff --git a/addons/sourcemod/configs/mapchooser_extended/map_names/dods.txt b/addons/sourcemod/configs/mapchooser_extended/map_names/dods.txt new file mode 100644 index 0000000..055bb48 --- /dev/null +++ b/addons/sourcemod/configs/mapchooser_extended/map_names/dods.txt @@ -0,0 +1,12 @@ +"Map Names" +{ + "dod_anzio" "Anzio" + "dod_argentan" "Argentan" + "dod_avalanche" "Avalanche" + "dod_colmar" "Colmar" + "dod_donner" "Donner" + "dod_flash" "Flash" + "dod_jagd" "Jagd" + "dod_kalt" "Kalt" + "dod_palermo" "Palermo" +} \ No newline at end of file diff --git a/addons/sourcemod/configs/mapchooser_extended/map_names/hl2mp.txt b/addons/sourcemod/configs/mapchooser_extended/map_names/hl2mp.txt new file mode 100644 index 0000000..3fded17 --- /dev/null +++ b/addons/sourcemod/configs/mapchooser_extended/map_names/hl2mp.txt @@ -0,0 +1,10 @@ +"Map Names" +{ + "dm_lockdown" "Lockdown" + "dm_overwatch" "Overwatch" + "dm_runoff" "Runoff" + "dm_steamlab" "Steamlab" + "dm_underpass" "Underpass" + "dm_resistance" "Resistance" + "dm_powerhouse" "Powerhouse" +} \ No newline at end of file diff --git a/addons/sourcemod/configs/mapchooser_extended/map_names/tf.txt b/addons/sourcemod/configs/mapchooser_extended/map_names/tf.txt new file mode 100644 index 0000000..8fb566e --- /dev/null +++ b/addons/sourcemod/configs/mapchooser_extended/map_names/tf.txt @@ -0,0 +1,74 @@ +"Map Names" +{ + "tc_hydro" "Hydro" + "cp_well" "Well" + "cp_granary" "Granary" + "cp_dustbowl" "Dustbowl" + "cp_gravelpit" "Gravelpit" + "ctf_2fort" "2 Fort" + "ctf_well" "Wall" + "cp_badlands" "Badlands" + "pl_goldrush" "Goldrush" + "cp_fastlane" "Fastlane" + "ctf_turbine" "Turbine" + "pl_badwater" "Badwater" + "cp_steel" "Steel" + "arena_badlands" "Badlands" + "arena_granary" "Granary" + "arena_lumberyard" "Lumberyard" + "arena_ravine" "Ravine" + "arena_well" "Well" + "cp_egypt_final" "Egypt" + "cp_junction_final" "Junction" + "arena_watchtower" "Watchtower" + "plr_pipeline" "Pipeline" + "arena_sawmill" "Sawmill" + "arena_nucleus" "Nucleus" + "pl_hoodoo_final" "Hoodoo" + "koth_sawmill" "Sawmill" + "koth_nucleus" "Nucleus" + "koth_viaduct" "Viaduct" + "ctf_sawmill" "Sawmill" + "arena_offblast_final" "Offblast" + "cp_yukon_final" "Yukon" + "koth_harvest_final" "Harvest" + "koth_harvest_event" "Harvest Event" + "ctf_doublecross" "Doublecross" + "cp_gorge" "Gorge" + "cp_freight_final1" "Freight" + "pl_upward" "Upward" + "plr_hightower" "Hightower" + "pl_thundermountain" "Thunder Mountain" + "cp_coldfront" "Coldfront" + "cp_mountainlab" "Mountain Lab" + "cp_manor_event" "Manor" + "cp_degrootkeep" "Degrootkeep" + "cp_5gorge" "5Gorge" + "pl_frontier_final" "Frontier" + "plr_nightfall_final" "Nightfall" + "koth_lakeside_final" "Lakeside" + "koth_badlands" "Badlands" + "pl_barnblitz" "Barnblitz" + "cp_gullywash_final1" "Gullywash" + "koth_viaduct_event" "Viaduct" + "cp_foundry" "Foundry" + "sd_doomsday" "Doomsday" + "koth_king" "King" + "mvm_mannworks" "Mannworks" + "mvm_coaltown" "Coaltown" + "mvm_decoy" "Decoy" + "koth_lakeside_event" "Lakeide Event" + "mvm_bigrock" "Bigrock" + "cp_process_final" "Process" + "cp_standin_final" "Standin" + "plr_hightower_event" "Hightower Event" + "cp_snakewater_final1" "Snakewater" + "mvm_mannhattan" "Mannhattan" + "mvm_rottenburg" "Rottenburg" + "pl_cactuscanyon" "Cactus Canyon" + "rd_asteroid" "Asteroid" + "sd_doomsday_event" "Doomsday Event" + "ctf_foundry" "Foundry" + "ctf_gorge" "Gorge" + "ctf_thundermountain" "Thunder Mountain" +} \ No newline at end of file diff --git a/addons/sourcemod/configs/mapchooser_extended/map_names/universal.txt b/addons/sourcemod/configs/mapchooser_extended/map_names/universal.txt new file mode 100644 index 0000000..d1c00db --- /dev/null +++ b/addons/sourcemod/configs/mapchooser_extended/map_names/universal.txt @@ -0,0 +1,16 @@ +"Map Name Replacements" +{ //This file contains universal replacement of map names, so instead of display 'de_dust2', it will show 'dust2' this is used if the map is not found in the game files + "aim_" "" + "ar_" "" + "awp_" "" + "cs_" "" + "de_" "" + "dm_" "" + "fun_" "" + "mg_" "" + "pb_" "" + "surf_" "" + "ze_" "" + "zm_" "" + "_" " " //Replaces under scores with spaces +} \ No newline at end of file diff --git a/addons/sourcemod/scripting/include/mapchooser_extended.inc b/addons/sourcemod/scripting/include/mapchooser_extended.inc index fbdbf2f..f21d543 100644 --- a/addons/sourcemod/scripting/include/mapchooser_extended.inc +++ b/addons/sourcemod/scripting/include/mapchooser_extended.inc @@ -94,6 +94,16 @@ native bool:IsMapOfficial(const String:map[]); */ native CanNominateResult:CanNominate(); +/** + * Retrieves the Display Name of the issued map. + * + * @param map Abolsute name of the map to lookup + * @param mapName The buffer of which the Map Name is stored + * @param size The mapName buffer size + * @return True if the map name was returned, flase if the map name was not resolved. + */ +native bool:GetMapName(const String:map[], String:mapName[], size); + public SharedPlugin:__pl_mapchooser_extended = { name = "mapchooser", diff --git a/addons/sourcemod/scripting/mapchooser_extended.sp b/addons/sourcemod/scripting/mapchooser_extended.sp index b815e56..13d8b49 100644 --- a/addons/sourcemod/scripting/mapchooser_extended.sp +++ b/addons/sourcemod/scripting/mapchooser_extended.sp @@ -126,6 +126,9 @@ new Handle:g_NominateOwners = INVALID_HANDLE; new Handle:g_OldMapList = INVALID_HANDLE; new Handle:g_NextMapList = INVALID_HANDLE; new Handle:g_VoteMenu = INVALID_HANDLE; +new Handle:g_MapNames = INVALID_HANDLE; +new Handle:g_MapNameUFilter = INVALID_HANDLE; +new Handle:g_MapNameUReplace = INVALID_HANDLE; new g_Extends; new g_TotalRounds; @@ -223,6 +226,9 @@ public OnPluginStart() g_OldMapList = CreateArray(arraySize); g_NextMapList = CreateArray(arraySize); g_OfficialList = CreateArray(arraySize); + g_MapNames = CreateTrie(); + g_MapNameUFilter = CreateArray(arraySize); + g_MapNameUReplace = CreateArray(arraySize); GetGameFolderName(g_GameModName, sizeof(g_GameModName)); @@ -242,7 +248,7 @@ public OnPluginStart() g_Cvar_VoteDuration = CreateConVar("mce_voteduration", "20", "Specifies how long the mapvote should be available for.", _, true, 5.0); // MapChooser Extended cvars - CreateConVar("mce_version", MCE_VERSION, "MapChooser Extended Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); + CreateConVar("mce_version", MCE_VERSION, "MapChooser Extended Version", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); g_Cvar_RunOff = CreateConVar("mce_runoff", "1", "Hold run off votes if winning choice has less than a certain percentage of votes", _, true, 0.0, true, 1.0); g_Cvar_RunOffPercent = CreateConVar("mce_runoffpercent", "50", "If winning choice has less than this percent of votes, hold a runoff", _, true, 0.0, true, 100.0); @@ -398,6 +404,7 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) // MapChooser Extended natives CreateNative("IsMapOfficial", Native_IsMapOfficial); CreateNative("CanNominate", Native_CanNominate); + CreateNative("GetMapName", Native_GetMapName); return APLRes_Success; } @@ -494,6 +501,7 @@ public OnConfigsExecuted() } InitializeOfficialMapList(); + InitializeMapNames(); } public OnMapEnd() @@ -569,6 +577,7 @@ public Action:Command_SetNextmap(client, args) public Action:Command_ReloadMaps(client, args) { InitializeOfficialMapList(); + InitializeMapNames(); } public OnMapTimeLeftChanged() @@ -1411,7 +1420,9 @@ public Handler_VoteFinishedGeneric(Handle:menu, g_HasVoteStarted = false; g_MapVoteCompleted = true; - CPrintToChatAll("[MCE] %t", "Nextmap Voting Finished", map, RoundToFloor(float(item_info[0][VOTEINFO_ITEM_VOTES])/float(num_votes)*100), num_votes); + decl String:mapName[PLATFORM_MAX_PATH]; + getMapName(map, mapName, sizeof(mapName)); + CPrintToChatAll("[MCE] %t", "Nextmap Voting Finished", mapName, RoundToFloor(float(item_info[0][VOTEINFO_ITEM_VOTES])/float(num_votes)*100), num_votes); LogAction(-1, -1, "Voting for next map has finished. Nextmap: %s.", map); } } @@ -2064,6 +2075,60 @@ stock SetupWarningTimer(WarningType:type, MapChange:when=MapChange_MapEnd, Handl ResetPack(data); } +new g_tempMapFile = 0; +stock InitializeMapNames() +{ + ClearTrie(g_MapNames); + ClearArray(g_MapNameUFilter); + ClearArray(g_MapNameUReplace); + g_tempMapFile = 0; + decl String:mapNamesPath[PLATFORM_MAX_PATH]; + new Handle:SMC = SMC_CreateParser(); + SMC_SetReaders(SMC, NewSection, KeyValue, EndSection); + SMC_ParseFile(SMC, mapNamesPath); + BuildPath(Path_SM, mapNamesPath, PLATFORM_MAX_PATH, "configs/mapchooser_extended/map_names/%s.txt", g_GameModName); + if (!FileExists(mapNamesPath)) + { + LogMessage("Unable to find map name aliases for %s.", g_GameModName); + } + else + { + SMC_ParseFile(SMC, mapNamesPath); + } + + g_tempMapFile = 1; + SMC = SMC_CreateParser(); + SMC_SetReaders(SMC, NewSection, KeyValue, EndSection); + BuildPath(Path_SM, mapNamesPath, PLATFORM_MAX_PATH, "configs/mapchooser_extended/map_names/universal.txt"); + if (!FileExists(mapNamesPath)) + { + LogMessage("Unable to find universal map name replacement"); + } + else + { + SMC_ParseFile(SMC, mapNamesPath); + } + CloseHandle(SMC); +} + +public SMCResult:NewSection(Handle:smc, const String:name[], bool:opt_quotes) { } +public SMCResult:EndSection(Handle:smc) { } +public SMCResult:KeyValue(Handle:smc, const String:key[], const String:value[], bool:key_quotes, bool:value_quotes) +{ + if (g_tempMapFile == 0) + { + if (!SetTrieString(g_MapNames, key, value, false)) + { + LogMessage("A Map name for %s already exists!", key); + } + } + if (g_tempMapFile == 1) + { + PushArrayString(g_MapNameUFilter, key); + PushArrayString(g_MapNameUReplace, value); + } +} + stock InitializeOfficialMapList() { // If this fails, we want it to have an empty adt_array @@ -2141,16 +2206,66 @@ public Native_CanNominate(Handle:plugin, numParams) return _:CanNominate_Yes; } +public Native_GetMapName(Handle:plugin, numParams) +{ + new len; + GetNativeStringLength(1, len); + + if (len <= 0) + { + return false; + } + + new String:map[len+1]; + GetNativeString(1, map, len+1); + len = GetNativeCell(3); + new String:mapName[len+1]; + new bool:returnValue = getMapName(map, mapName, len); + SetNativeString(2, mapName, len); + return returnValue; +} + +stock bool:getMapName(const String:map[], String:mapName[], size) +{ + if (GetTrieSize(g_MapNames) > 0 && GetTrieString(g_MapNames, map, mapName, size)) + { + return true; + } + int arraySize = GetArraySize(g_MapNameUFilter); + if (arraySize > 0) + { + decl String:tempMapName[PLATFORM_MAX_PATH]; + strcopy(tempMapName, size, map); + decl String:tempFilter[PLATFORM_MAX_PATH]; + decl String:tempReplacment[PLATFORM_MAX_PATH]; + for (int i = 0; i < arraySize; i++) + { + GetArrayString(g_MapNameUFilter, i, tempFilter, sizeof(tempFilter)); + if (StrContains(tempMapName, tempFilter, false) >= 0) + { + GetArrayString(g_MapNameUReplace, i, tempReplacment, sizeof(tempReplacment)); + ReplaceString(tempMapName, sizeof(tempMapName), tempFilter, tempReplacment, false); + } + } + strcopy(mapName, size, tempMapName); + return true; + } + //Map Name not found or trie is empty. + strcopy(mapName, size, map); + return false; +} stock AddMapItem(const String:map[]) { + decl String:mapName[PLATFORM_MAX_PATH]; + getMapName(map, mapName, sizeof(mapName)); if (g_NativeVotes) { - NativeVotes_AddItem(g_VoteMenu, map, map); + NativeVotes_AddItem(g_VoteMenu, map, mapName); } else { - AddMenuItem(g_VoteMenu, map, map); + AddMenuItem(g_VoteMenu, map, mapName); } } diff --git a/addons/sourcemod/scripting/nominations_extended.sp b/addons/sourcemod/scripting/nominations_extended.sp index 5b7719e..ee0626c 100644 --- a/addons/sourcemod/scripting/nominations_extended.sp +++ b/addons/sourcemod/scripting/nominations_extended.sp @@ -51,6 +51,7 @@ public Plugin:myinfo = new Handle:g_Cvar_ExcludeOld = INVALID_HANDLE; new Handle:g_Cvar_ExcludeCurrent = INVALID_HANDLE; +new Handle:g_Cvar_DisplayName = INVALID_HANDLE; new Handle:g_MapList = INVALID_HANDLE; new Handle:g_MapMenu = INVALID_HANDLE; @@ -79,6 +80,7 @@ public OnPluginStart() g_Cvar_ExcludeOld = CreateConVar("sm_nominate_excludeold", "1", "Specifies if the current map should be excluded from the Nominations list", 0, true, 0.00, true, 1.0); g_Cvar_ExcludeCurrent = CreateConVar("sm_nominate_excludecurrent", "1", "Specifies if the MapChooser excluded maps should also be excluded from Nominations", 0, true, 0.00, true, 1.0); + g_Cvar_DisplayName = CreateConVar("sm_nominate_displayname", "1", "Use custom Display Names instead of the raw map name", 0, true, 0.00, true, 1.0); RegConsoleCmd("say", Command_Say); RegConsoleCmd("say_team", Command_Say); @@ -88,7 +90,7 @@ public OnPluginStart() RegAdminCmd("sm_nominate_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate_addmap - Forces a map to be on the next mapvote."); // Nominations Extended cvars - CreateConVar("ne_version", MCE_VERSION, "Nominations Extended Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); + CreateConVar("ne_version", MCE_VERSION, "Nominations Extended Version", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); g_mapTrie = CreateTrie(); @@ -136,6 +138,16 @@ public OnNominationRemoved(const String:map[], owner) SetTrieValue(g_mapTrie, map, MAPSTATUS_ENABLED); } +stock getMapName(const String:map[], String:mapName[], size) +{ + if (GetConVarBool(g_Cvar_DisplayName)) + { + GetMapName(map, mapName, size); + return; + } + strcopy(mapName, size, map); +} + public Action:Command_Addmap(client, args) { if (args < 1) @@ -147,11 +159,13 @@ public Action:Command_Addmap(client, args) decl String:mapname[PLATFORM_MAX_PATH]; GetCmdArg(1, mapname, sizeof(mapname)); + decl String:mapName[PLATFORM_MAX_PATH]; + getMapName(mapname, mapName, sizeof(mapName)); new status; if (!GetTrieValue(g_mapTrie, mapname, status)) { - CReplyToCommand(client, "%t", "Map was not found", mapname); + CReplyToCommand(client, "%t", "Map was not found", mapName); return Plugin_Handled; } @@ -160,7 +174,7 @@ public Action:Command_Addmap(client, args) if (result > Nominate_Replaced) { /* We assume already in vote is the casue because the maplist does a Map Validity check and we forced, so it can't be full */ - CReplyToCommand(client, "%t", "Map Already In Vote", mapname); + CReplyToCommand(client, "%t", "Map Already In Vote", mapName); return Plugin_Handled; } @@ -169,7 +183,7 @@ public Action:Command_Addmap(client, args) SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED); - CReplyToCommand(client, "%t", "Map Inserted", mapname); + CReplyToCommand(client, "%t", "Map Inserted", mapName); LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname); return Plugin_Handled; @@ -273,9 +287,11 @@ public Action:Command_Nominate(client, args) SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED); + decl String:mapName[PLATFORM_MAX_PATH]; + getMapName(mapname, mapName, sizeof(mapName)); decl String:name[MAX_NAME_LENGTH]; GetClientName(client, name, sizeof(name)); - PrintToChatAll("[NE] %t", "Map Nominated", name, mapname); + PrintToChatAll("[NE] %t", "Map Nominated", name, mapName); LogMessage("%s nominated %s", name, mapname); return Plugin_Continue; @@ -317,7 +333,7 @@ BuildMapMenu() GetCurrentMap(currentMap, sizeof(currentMap)); } - + new bool:DisplayName = GetConVarBool(g_Cvar_DisplayName); for (new i = 0; i < GetArraySize(g_MapList); i++) { new status = MAPSTATUS_ENABLED; @@ -341,7 +357,16 @@ BuildMapMenu() } } - AddMenuItem(g_MapMenu, map, map); + if (DisplayName) + { + decl String:mapName[PLATFORM_MAX_PATH]; + GetMapName(map, mapName, sizeof(mapName)); + AddMenuItem(g_MapMenu, map, mapName); + } + else + { + AddMenuItem(g_MapMenu, map, map); + } SetTrieValue(g_mapTrie, map, status); } @@ -362,6 +387,9 @@ public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2) decl String:map[PLATFORM_MAX_PATH], String:name[MAX_NAME_LENGTH]; GetMenuItem(menu, param2, map, sizeof(map)); + decl String:mapName[PLATFORM_MAX_PATH]; + getMapName(map, mapName, sizeof(mapName)); + GetClientName(param1, name, MAX_NAME_LENGTH); new NominateResult:result = NominateMap(map, false, param1); @@ -382,11 +410,11 @@ public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2) if (result == Nominate_Replaced) { - PrintToChatAll("[NE] %t", "Map Nomination Changed", name, map); + PrintToChatAll("[NE] %t", "Map Nomination Changed", name, mapName); return 0; } - PrintToChatAll("[NE] %t", "Map Nominated", name, map); + PrintToChatAll("[NE] %t", "Map Nominated", name, mapName); LogMessage("%s nominated %s", name, map); } @@ -453,7 +481,7 @@ public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2) } else { - strcopy(buffer, sizeof(buffer), map); + getMapName(map, buffer, sizeof(buffer)); } if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED) diff --git a/addons/sourcemod/scripting/rockthevote_extended.sp b/addons/sourcemod/scripting/rockthevote_extended.sp index 68133cb..8b119b2 100644 --- a/addons/sourcemod/scripting/rockthevote_extended.sp +++ b/addons/sourcemod/scripting/rockthevote_extended.sp @@ -57,6 +57,7 @@ new Handle:g_Cvar_InitialDelay = INVALID_HANDLE; new Handle:g_Cvar_Interval = INVALID_HANDLE; new Handle:g_Cvar_ChangeTime = INVALID_HANDLE; new Handle:g_Cvar_RTVPostVoteAction = INVALID_HANDLE; +new Handle:g_Cvar_DisplayName = INVALID_HANDLE; new bool:g_CanRTV = false; // True if RTV loaded maps and is active. new bool:g_RTVAllowed = false; // True if RTV is available to players. Used to delay rtv votes. @@ -79,6 +80,7 @@ public OnPluginStart() g_Cvar_Interval = CreateConVar("sm_rtv_interval", "240.0", "Time (in seconds) after a failed RTV before another can be held", 0, true, 0.00); g_Cvar_ChangeTime = CreateConVar("sm_rtv_changetime", "0", "When to change the map after a succesful RTV: 0 - Instant, 1 - RoundEnd, 2 - MapEnd", _, true, 0.0, true, 2.0); g_Cvar_RTVPostVoteAction = CreateConVar("sm_rtv_postvoteaction", "0", "What to do with RTV's after a mapvote has completed. 0 - Allow, success = instant change, 1 - Deny", _, true, 0.0, true, 1.0); + g_Cvar_DisplayName = CreateConVar("sm_rtv_displayname", "1", "Display the Map's custom name, instead of the raw map name", _, true, 0.0, true, 1.0); RegConsoleCmd("say", Command_Say); RegConsoleCmd("say_team", Command_Say); @@ -89,7 +91,7 @@ public OnPluginStart() RegAdminCmd("mce_forcertv", Command_ForceRTV, ADMFLAG_CHANGEMAP, "Force an RTV vote"); // Rock The Vote Extended cvars - CreateConVar("rtve_version", MCE_VERSION, "Rock The Vote Extended Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); + CreateConVar("rtve_version", MCE_VERSION, "Rock The Vote Extended Version", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD); AutoExecConfig(true, "rtv"); } @@ -272,7 +274,16 @@ StartRTV() new String:map[PLATFORM_MAX_PATH]; if (GetNextMap(map, sizeof(map))) { - CPrintToChatAll("[SM] %t", "Changing Maps", map); + if (GetConVarBool(g_Cvar_DisplayName)) + { + new String:mapName[PLATFORM_MAX_PATH]; + GetMapName(map, mapName, sizeof(mapName)); + CPrintToChatAll("[SM] %t", "Changing Maps", mapName); + } + else + { + CPrintToChatAll("[SM] %t", "Changing Maps", map); + } CreateTimer(5.0, Timer_ChangeMap, _, TIMER_FLAG_NO_MAPCHANGE); g_InChange = true;