AutoExecConfig: Add AutoExecConfig native
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "natives.h"
|
||||
#include "debugger.h"
|
||||
#include "libraries.h"
|
||||
#include <amxmodx_version.h>
|
||||
|
||||
extern const char *no_function;
|
||||
|
||||
@@ -443,6 +444,45 @@ void CPluginMngr::CPlugin::unpausePlugin()
|
||||
}
|
||||
}
|
||||
|
||||
void CPluginMngr::CPlugin::AddConfig(bool create, const char *name, const char *folder)
|
||||
{
|
||||
// Do a check for duplicates to prevent double-execution
|
||||
for (size_t i = 0; i < m_configs.length(); ++i)
|
||||
{
|
||||
auto config = m_configs[i];
|
||||
|
||||
if (config->autocfg.compare(name) == 0 && config->folder.compare(folder) == 0 && config->create == create)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AutoConfig *c = new AutoConfig;
|
||||
|
||||
c->autocfg = name;
|
||||
c->folder = folder;
|
||||
c->create = create;
|
||||
|
||||
m_configs.append(c);
|
||||
}
|
||||
|
||||
size_t CPluginMngr::CPlugin::GetConfigCount()
|
||||
{
|
||||
return m_configs.length();
|
||||
}
|
||||
|
||||
AutoConfig *CPluginMngr::CPlugin::GetConfig(size_t i)
|
||||
{
|
||||
if (i >= GetConfigCount())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_configs[i];
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *CPluginMngr::ReadIntoOrFromCache(const char *file, size_t &bufsize)
|
||||
{
|
||||
List<plcache_entry *>::iterator iter;
|
||||
@@ -714,3 +754,5 @@ void CPluginMngr::CALMFromFile(const char *file)
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user