Add new public var with mapname and new constant (#687)
* Add new public var with current map name * Add a constant to define max map's name length * Reducing the maximum buffer size to store a map's name * The PLATFORM_MAX_PATH constant replaced to MAX_MAPNAME_LENGTH
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#include "debugger.h"
|
||||
#include "libraries.h"
|
||||
#include <amxmodx_version.h>
|
||||
#include "engine_strucs.h"
|
||||
|
||||
extern const char *no_function;
|
||||
|
||||
@ -154,6 +155,11 @@ int CPluginMngr::loadPluginsFromFile(const char* filename, bool warn)
|
||||
*get_amxaddr(plugin->getAMX(), addr) = gpGlobals->maxClients;
|
||||
}
|
||||
|
||||
if (amx_FindPubVar(plugin->getAMX(), "MapName", &addr) != AMX_ERR_NOTFOUND)
|
||||
{
|
||||
set_amxstring(plugin->getAMX(), addr, STRING(gpGlobals->mapname), MAX_MAPNAME_LENGTH - 1);
|
||||
}
|
||||
|
||||
if (amx_FindPubVar(plugin->getAMX(), "NULL_STRING", &addr) != AMX_ERR_NOTFOUND)
|
||||
{
|
||||
plugin->m_pNullStringOfs = get_amxaddr(plugin->getAMX(), addr);
|
||||
|
@ -29,7 +29,7 @@ static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
|
||||
char* sName = get_amxstring(amx, params[1], 0, len);
|
||||
cell ptr;
|
||||
|
||||
if (!strcmp(sName, "MaxClients") || !strcmp(sName, "NULL_STRING") || !strcmp(sName, "NULL_VECTOR"))
|
||||
if (!strcmp(sName, "MaxClients") || !strcmp(sName, "MapName") || !strcmp(sName, "NULL_STRING") || !strcmp(sName, "NULL_VECTOR"))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user