void CGamemodeManager::Unload()
{
	for( _PlayerID playerid = 0; playerid < MAX_PLAYERS; playerid ++ )
	{
		if( __NetGame->playerPool->GetSlotState( playerid ) )
		{
			__NetGame->playerPool->GetPlayer( playerid )->GetKeyBinder()->OnGameModeUnloaded();
		}
	}

	int tmp;
	if (!amx_FindPublic(&this->gmAMX, "OnGameModeExit", &tmp))
		amx_Exec(&this->gmAMX, (cell*)&tmp, tmp);

	__NetGame->filterscriptsManager->OnGameModeExit();
	if(__NetGame->scriptTimerManager) 
		__NetGame->scriptTimerManager->DeleteForMode(&this->gmAMX);

	if (this->gmIsInit)
	{

		aux_FreeProgram(&this->gmAMX);
		__Plugins->DoAmxUnload(&this->gmAMX);
		amx_sampDbCleanup(&this->gmAMX);
		//amx_DGramCleanup(&this->gmAMX);
		amx_TimeCleanup(&this->gmAMX);
		amx_FileCleanup(&this->gmAMX);
		amx_StringCleanup(&this->gmAMX);
		amx_FloatCleanup(&this->gmAMX);
		amx_CoreCleanup(&this->gmAMX);
	}

	this->gmIsInit = false;
	this->gmIsSleeping = false;
}
void CNetwork::UnloadScript() {
	int val;
	if (!amx_FindPublic(&inimod_amx, "OnGameModeExit", &val))
		amx_Exec(&inimod_amx, (cell*)&val, val);

	if (GMLoaded) {
		aux_FreeProgram(&inimod_amx);
		amx_TimeCleanup(&inimod_amx);
		//amx_FileCleanup(&inimod_amx);
		amx_StringCleanup(&inimod_amx);
		amx_FloatCleanup(&inimod_amx);
		amx_CoreCleanup(&inimod_amx);
	}
	GMLoaded = false;
}
Exemple #3
0
void cleanup_pawn_machine (pawn_machine *machine)
{
	if (machine->initialized)
	{
		amx_ElCleanup (&(machine->amx));
		amx_StringCleanup (&(machine->amx));
		amx_FloatCleanup (&(machine->amx));
		amx_ConsoleCleanup (&(machine->amx));
		amx_Cleanup (&(machine->amx));
		machine->initialized = 0;
	}

	if (machine->buffer)
	{
		free (machine->buffer);
		machine->buffer = NULL;
		machine->buf_size = 0;
	}
}