sourcemod/plugins/testsuite/mapdisplayname.sp
Ross Bemrose 10a95cfdce Add new function: GetMapDisplayName.
This function will resolve the name of a map using FindMap, then (if applicable), will turn a workshop map name into a nicely formatted name.

Currently only TF2 and CS:GO Map Workshops are supported.  More can be added at a later date.

This function returns false if a map was not found, but true in any other instance even if FindMap could not resolve the map name.

This patch also updates the following core plugins to use this GetMapDisplayName:

BaseTriggers
BaseVotes
MapChooser
NextMap
Nominations
RandomCycle
RockTheVote
2015-09-15 16:16:58 -04:00

25 lines
563 B
SourcePawn

#include <sourcemod>
public void OnPluginStart()
{
RegServerCmd("test_mapdisplayname", test_mapdisplayname);
}
public Action test_mapdisplayname( int argc )
{
char mapName[PLATFORM_MAX_PATH];
GetCmdArg(1, mapName, sizeof(mapName));
char displayName[PLATFORM_MAX_PATH];
if (GetMapDisplayName(mapName, displayName, sizeof(displayName)))
{
PrintToServer("GetMapDisplayName says \"%s\" for \"%s\"", displayName, mapName);
}
else
{
PrintToServer("GetMapDisplayName says \"%s\" was not found or not resolved", mapName);
}
return Plugin_Handled;
}