он только работает когда больше 2-ух игроков на сервере. Использую вместе с модулем Round Control
- Код: Выделить всё
#include <amxmodx>
#include <fakemeta>
#tryinclude <roundcontrol>
#if AMXX_VERSION_NUM < 182
#endif
#define PLUGIN "Force Round End"
#define VERSION "0.80b"
#define AUTHOR "Safety1st"
#if !defined _roundcontrol_included
#assert "Round Control AMXX module required for plugin!"
#endif
new pWarnBefore
new bool:gbRoundStarted, bool:gbGameScoringActive, giWarnBefore
#define TASK_ID 7330 // arbitrary value
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR )
register_dictionary( "force_round_end.txt" )
new szObjectivesList[][] =
{
"func_bomb_target",
"info_bomb_target",
"hostage_entity",
"func_hostage_rescue",
"info_hostage_rescue",
"info_vip_start",
"func_vip_safetyzone",
"func_escapezone"
}
for( new i = 0; i < sizeof szObjectivesList; i++ )
{
if( engfunc(EngFunc_FindEntityByString, -1, "classname", szObjectivesList[i] ) )
pause("d") // set 'stopped' status when pausing whole plugin; in this status plugin is unpauseable
// TODO: may be unload module too...
}
register_event( "RoundTime", "RoundTimer", "bc" ) // we hook single MSG_ONE message repeated to players
register_logevent( "Event_RoundStart", 2, "1=Round_Start" )
register_logevent( "Event_RoundEnd", 2, "1=Round_End" )
register_event( "TextMsg", "Event_NewGame", "a", "2=#Game_Commencing" )
register_event( "TextMsg", "Event_RoundRestart", "a", "2=#Game_will_restart_in" )
register_event( "TextMsg", "Event_GameScoring", "a", "2=#Game_scoring" )
pWarnBefore = register_cvar( "fre_warn_before", "0" )
}
public Event_RoundStart()
{
gbRoundStarted = true
}
public RoundTimer()
{
if( gbGameScoringActive || !gbRoundStarted )
return
gbRoundStarted = false
giWarnBefore = get_pcvar_num( pWarnBefore )
if( !giWarnBefore )
set_task( float( read_data(1) ), "ForceRoundEnd", TASK_ID )
else
set_task( float( read_data(1) - giWarnBefore ), "WarnPlayers", TASK_ID )
}
public WarnPlayers()
{
// SAMPLE FUNCTION FOR THE FUTURE
set_hudmessage( 255, 0, 0, -1.0, 0.16, 0, 0.0, 5.0, 1.0, 1.0 )
show_hudmessage( 0, "%L", LANG_PLAYER, "FRE_WARNING", giWarnBefore )
set_task( float(giWarnBefore), "ForceRoundEnd", TASK_ID )
}
public ForceRoundEnd()
{
RoundEndForceControl( WINSTATUS_CT )
}
public Event_RoundEnd()
remove_task(TASK_ID)
public Event_RoundRestart()
remove_task(TASK_ID)
public Event_NewGame()
{
gbGameScoringActive = false
/* task will be removed in Event_RoundEnd() function because
Game_Commencing event is followed by Round_End logevent */
}
public Event_GameScoring()
{
if( !gbGameScoringActive )
{
remove_task(TASK_ID)
gbGameScoringActive = true
}
}
Тема перемещена в раздел "Вопросы по AMXX и его плагинам" // Subb98