PDA

View Full Version : Is SM API has 'pause function' for specific plugin?


vingbbit
02-06-2012, 23:18
Hello I'm looking for 'pause / unpause' function like AMXX API.
I found forward OnPluginPauseChange in SM API page. but It isn't I want to.
Is SM API has this? or no?

Peace-Maker
02-07-2012, 06:49
I think plugin pausing was disabled long time ago - maybe together with the debugging mode being removed?

Why do you want to pause plugins anyway?

necavi
02-07-2012, 06:55
If you need to delay your plugin's operation for a while, use a timer.

vingbbit
02-10-2012, 06:33
I think plugin pausing was disabled long time ago - maybe together with the debugging mode being removed?

Why do you want to pause plugins anyway?

Because this.
It's AMXX ZP 'zp50_gamemodes.sma' contents.

public choose_game_mode()
{
// No players joined yet
if (GetAliveCount() <= 0)
return;

new index, filename[64]

// Try choosing a game mode
for (index = g_DefaultGameMode + 1; /*no condition*/; index++)
{
// Start over when we reach the end
if (index >= g_GameModeCount)
index = 0

// Game mode already chosen?
if (g_ChosenGameMode != ZP_NO_GAME_MODE)
{
// Pause previous game mode before picking a new one
ArrayGetString(g_GameModeFileName, g_ChosenGameMode, filename, charsmax(filename))
pause("ac", filename)
}

// Set chosen game mode index
g_ChosenGameMode = index

// Unpause game mode once it's chosen
ArrayGetString(g_GameModeFileName, g_ChosenGameMode, filename, charsmax(filename))
unpause("ac", filename)

// Starting non-default game mode?
if (index != g_DefaultGameMode)
{
// Execute game mode choose attempt forward (skip checks = false)
ExecuteForward(g_Forwards[FW_GAME_MODE_CHOOSE_PRE], g_ForwardResult, g_ChosenGameMode, false)

// Custom game mode can start?
if (g_ForwardResult < PLUGIN_HANDLED && (!get_pcvar_num(cvar_prevent_consecutive) || g_LastGameMode != index))
{
// Execute game mode chosen forward
ExecuteForward(g_Forwards[FW_GAME_MODE_CHOOSE_POST], g_ForwardResult, g_ChosenGameMode, RANDOM_TARGET_PLAYER)
g_LastGameMode = g_ChosenGameMode
break;
}
}
else
{
// Execute game mode choose attempt forward (skip checks = true)
ExecuteForward(g_Forwards[FW_GAME_MODE_CHOOSE_PRE], g_ForwardResult, g_ChosenGameMode, true)

// Default game mode can start?
if (g_ForwardResult < PLUGIN_HANDLED)
{
// Execute game mode chosen forward
ExecuteForward(g_Forwards[FW_GAME_MODE_CHOOSE_POST], g_ForwardResult, g_ChosenGameMode, RANDOM_TARGET_PLAYER)
g_LastGameMode = g_ChosenGameMode
break;
}
else
{
remove_task(TASK_GAMEMODE)
abort(AMX_ERR_GENERAL, "[ZP] Default game mode can't be started. Check server settings.")
break;
}
}
}
}


But now, I don't need pause the plugin.
Present problem is forward.... I'm making this with SM.

Dr. McKay
02-10-2012, 11:20
You can just call a ServerCommand to unload the plugin. It'll be reloaded at mapchange.