Exemple #1
0
bool RankSystem::loadCalc(const char* filename, char* error, size_t maxLength)
{
	if ((MF_LoadAmxScriptEx(&calc.amx,&calc.code,filename, error, maxLength, 0)!=AMX_ERR_NONE)||
		(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
		(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
		(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
		LOG_CONSOLE( PLID, "Couldn't load plugin (file \"%s\")",filename);
		MF_UnloadAmxScript(&calc.amx, &calc.code);
		return false;
	}
	return true;
}
// Import Score Calculator Routine
bool RankSystem::loadCalc(const char* filename)
{
	static char error[128];
	if((MF_LoadAmxScript(&calc.amx, &calc.code, filename, error, 0) != AMX_ERR_NONE)
		|| (MF_AmxAllot(&calc.amx, 11, &calc.amxAddr1, &calc.physAddr1) != AMX_ERR_NONE)
		|| (MF_AmxAllot(&calc.amx, 8, &calc.amxAddr2, &calc.physAddr2) != AMX_ERR_NONE)
		|| (MF_AmxFindPublic(&calc.amx, "get_score", &calc.func) != AMX_ERR_NONE))
	{
		MF_SyncLogError(&calc.amx, AMX_ERR_NATIVE, "loadCalc: Couldn't load function \"get_score\" from \"%s\"", filename);
		MF_UnloadAmxScript(&calc.amx, &calc.code);
		return false;
	}
	return true;
}
Exemple #3
0
void RankSystem::unloadCalc()
{
	MF_UnloadAmxScript(&calc.amx , &calc.code);
}