diff options
| author | aura <nw@moneybot.cc> | 2026-02-17 23:42:09 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-02-17 23:42:09 +0100 |
| commit | 5e2eb7d67ae933b7566f1944d0bb7744da03d586 (patch) | |
| tree | 054acff1113270a9cd07933df760f3768c1b6853 /source/sourcemod/scripting/include/GlobalAPI/stocks.inc | |
| parent | 341db13a008dc12bb22ceb50452d93d01476308c (diff) | |
move source stuff to its own folder
Diffstat (limited to 'source/sourcemod/scripting/include/GlobalAPI/stocks.inc')
| -rw-r--r-- | source/sourcemod/scripting/include/GlobalAPI/stocks.inc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/source/sourcemod/scripting/include/GlobalAPI/stocks.inc b/source/sourcemod/scripting/include/GlobalAPI/stocks.inc new file mode 100644 index 0000000..52596c4 --- /dev/null +++ b/source/sourcemod/scripting/include/GlobalAPI/stocks.inc @@ -0,0 +1,67 @@ +// ================== DOUBLE INCLUDE ========================= // + +#if defined _GlobalAPI_Stocks_included_ +#endinput +#endif +#define _GlobalAPI_Stocks_included_ + +// =========================================================== // + +/** + * Gets plugin's display name from its handle + * + * @param plugin Plugin handle to retrieve name from + * @return String representation of the plugin name + */ +stock char[] GetPluginDisplayName(Handle plugin) +{ + char pluginName[GlobalAPI_Max_PluginName_Length] = "Unknown"; + GetPluginInfo(plugin, PlInfo_Name, pluginName, sizeof(pluginName)); + + return pluginName; +} + +/** + * Gets plugin's version from its handle + * + * @param plugin Plugin handle to retrieve version from + * @return String representation of the plugin version + */ +stock char[] GetPluginVersion(Handle plugin) +{ + char pluginVersion[GlobalAPI_Max_PluginVersion_Length] = "Unknown"; + GetPluginInfo(plugin, PlInfo_Version, pluginVersion, sizeof(pluginVersion)); + + return pluginVersion; +} + +/** + * Gets current map's "display name" + * + * @param buffer Buffer to store the result in + * @param maxlength Max length of the buffer + * @noreturn + */ +stock void GetMapDisplay(char[] buffer, int maxlength) +{ + char map[PLATFORM_MAX_PATH]; + GetCurrentMap(map, sizeof(map)); + GetMapDisplayName(map, map, sizeof(map)); + + FormatEx(buffer, maxlength, map); +} + +/** + * Gets current map's full (game dir) path + * + * @param buffer Buffer to store result in + * @param maxlength Max length of the buffer + * @noreturn + */ +stock void GetMapFullPath(char[] buffer, int maxlength) +{ + char mapPath[PLATFORM_MAX_PATH]; + GetCurrentMap(mapPath, sizeof(mapPath)); + + Format(buffer, maxlength, "maps/%s.bsp", mapPath); +} |
