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
This commit is contained in:
@@ -82,6 +82,14 @@ static cell_t FindMap(IPluginContext *pContext, const cell_t *params)
|
||||
return static_cast<cell_t>(g_HL2.FindMap(pMapname, pDestMap, params[3]));
|
||||
}
|
||||
|
||||
static cell_t GetMapDisplayName(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *pMapname, *pDisplayname;
|
||||
pContext->LocalToString(params[1], &pMapname);
|
||||
pContext->LocalToString(params[2], &pDisplayname);
|
||||
return static_cast<cell_t>(g_HL2.GetMapDisplayName(pMapname, pDisplayname, params[3]));
|
||||
}
|
||||
|
||||
static cell_t IsDedicatedServer(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return engine->IsDedicatedServer();
|
||||
@@ -642,6 +650,7 @@ REGISTER_NATIVES(halflifeNatives)
|
||||
{"IsDedicatedServer", IsDedicatedServer},
|
||||
{"IsMapValid", IsMapValid},
|
||||
{"FindMap", FindMap},
|
||||
{"GetMapDisplayName", GetMapDisplayName},
|
||||
{"SetFakeClientConVar", SetFakeClientConVar},
|
||||
{"SetRandomSeed", SetRandomSeed},
|
||||
{"PrecacheModel", PrecacheModel},
|
||||
|
||||
Reference in New Issue
Block a user