Exemplo n.º 1
0
static cell AMX_NATIVE_CALL csdm_reload_cfg(AMX *amx, cell *params)
{
	char file[255];

	file[0] = '\0';

	if  (params[0] / sizeof(cell) != 0)
	{
		int len;
		char *str = MF_GetAmxString(amx, params[1], 0, &len);
		if (str[0] != '\0')
		{
			MF_BuildPathnameR(file, sizeof(file)-1, "%s/%s", LOCALINFO("amxx_configsdir"), str);
		}
	}

	if (file[0] == '\0')
	{
		MF_BuildPathnameR(file, sizeof(file)-1, "%s/csdm.cfg", LOCALINFO("amxx_configsdir"));
	}

	if (g_Config.ReadConfig(file) != Config_Ok)
	{
		MF_Log("Could not read config file: %s", file);
		return 0;
	}

	return 1;
}
Exemplo n.º 2
0
const char* get_localinfo( const char* name , const char* def = 0 )
{
	const char* b = LOCALINFO( (char*)name );
	if (((b==0)||(*b==0)) && def )
		SET_LOCALINFO((char*)name,(char*)(b = def) );
	return b;
}
Exemplo n.º 3
0
const char*	get_localinfo(const char* name, const char* def)
{
	const char* b = LOCALINFO((char*)name);

	if (b == 0 || *b == 0)
	{
		SET_LOCALINFO((char*)name, (char*)(b = def));
	}

	return b;
}
Exemplo n.º 4
0
const char*	get_localinfo_r(const char *name, const char *def, char buffer[], size_t maxlength)
{
	const char* b = LOCALINFO((char*)name);

	if (b == 0 || *b == 0)
	{
		SET_LOCALINFO((char*)name, (char*)(b = def));
	}

	ke::SafeSprintf(buffer, maxlength, "%s", b);

	return buffer;
}