// 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; }
/** * Scans an amxx plugin for a public * returns whether or not that public exists */ BOOL UTIL_CheckForPublic(const char *publicname) { AMX *amx; char blah[64]; int FunctionIndex; int i=0; strncpy(blah,publicname,63); // Loop through all running scripts while((amx=MF_GetScriptAmx(i++))!=NULL) { // Scan for public if (MF_AmxFindPublic(amx, blah, &FunctionIndex) == AMX_ERR_NONE) { // Public was found. return TRUE; } } return FALSE; // no public found in any loaded script }