Added better Nuclear Dawn compatibility to base plugins (bug 5117, r=fyren).
authorNicholas Hastings <skamonkey@gmail.com>
Tue Oct 11 19:47:20 2011 -0400 (2011-10-11)
changeset 3399c81e3ec1123a
parent 3398 fcf4e97e0844
child 3400 6e39456566fe
Added better Nuclear Dawn compatibility to base plugins (bug 5117, r=fyren).
plugins/basetriggers.sp
plugins/funcommands.sp
plugins/mapchooser.sp
     1.1 --- a/plugins/basetriggers.sp	Tue Oct 11 19:41:56 2011 -0400
     1.2 +++ b/plugins/basetriggers.sp	Tue Oct 11 19:47:20 2011 -0400
     1.3 @@ -97,7 +97,15 @@
     1.4     		HookEvent("game_start", Event_GameStart);
     1.5     	}
     1.6  	
     1.7 -	HookEvent("round_end", Event_RoundEnd);
     1.8 +	if (strcmp(folder, "nucleardawn") == 0)
     1.9 +	{
    1.10 +		HookEvent("round_win", Event_RoundEnd);
    1.11 +	}
    1.12 +	else
    1.13 +	{
    1.14 +		HookEvent("round_end", Event_RoundEnd);
    1.15 +	}
    1.16 +	
    1.17  	HookEventEx("teamplay_win_panel", Event_TeamPlayWinPanel);
    1.18  	HookEventEx("teamplay_restart_round", Event_TFRestartRound);
    1.19  	HookEventEx("arena_win_panel", Event_TeamPlayWinPanel);
     2.1 --- a/plugins/funcommands.sp	Tue Oct 11 19:41:56 2011 -0400
     2.2 +++ b/plugins/funcommands.sp	Tue Oct 11 19:47:20 2011 -0400
     2.3 @@ -158,7 +158,23 @@
     2.4  
     2.5  HookEvents( )
     2.6  {
     2.7 -	HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
     2.8 +	decl String:folder[64];
     2.9 +	GetGameFolderName(folder, sizeof(folder));
    2.10 +
    2.11 +	if (strcmp(folder, "tf") == 0)
    2.12 +	{
    2.13 +		HookEvent("teamplay_win_panel", Event_RoundEnd, EventHookMode_PostNoCopy);
    2.14 +		HookEvent("teamplay_restart_round", Event_RoundEnd, EventHookMode_PostNoCopy);
    2.15 +		HookEvent("arena_win_panel", Event_RoundEnd, EventHookMode_PostNoCopy);
    2.16 +	}
    2.17 +	else if (strcmp(folder, "nucleardawn") == 0)
    2.18 +	{
    2.19 +		HookEvent("round_win", Event_RoundEnd, EventHookMode_PostNoCopy);
    2.20 +	}
    2.21 +	else
    2.22 +	{
    2.23 +		HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
    2.24 +	}	
    2.25  }
    2.26  
    2.27  public OnMapStart()
     3.1 --- a/plugins/mapchooser.sp	Tue Oct 11 19:41:56 2011 -0400
     3.2 +++ b/plugins/mapchooser.sp	Tue Oct 11 19:47:20 2011 -0400
     3.3 @@ -137,10 +137,23 @@
     3.4  	
     3.5  	if (g_Cvar_Winlimit != INVALID_HANDLE || g_Cvar_Maxrounds != INVALID_HANDLE)
     3.6  	{
     3.7 -		HookEvent("round_end", Event_RoundEnd);
     3.8 -		HookEventEx("teamplay_win_panel", Event_TeamPlayWinPanel);
     3.9 -		HookEventEx("teamplay_restart_round", Event_TFRestartRound);
    3.10 -		HookEventEx("arena_win_panel", Event_TeamPlayWinPanel);
    3.11 +		decl String:folder[64];
    3.12 +		GetGameFolderName(folder, sizeof(folder));
    3.13 +
    3.14 +		if (strcmp(folder, "tf") == 0)
    3.15 +		{
    3.16 +			HookEvent("teamplay_win_panel", Event_TeamPlayWinPanel);
    3.17 +			HookEvent("teamplay_restart_round", Event_TFRestartRound);
    3.18 +			HookEvent("arena_win_panel", Event_TeamPlayWinPanel);
    3.19 +		}
    3.20 +		else if (strcmp(folder, "nucleardawn") == 0)
    3.21 +		{
    3.22 +			HookEvent("round_win", Event_RoundEnd);
    3.23 +		}
    3.24 +		else
    3.25 +		{
    3.26 +			HookEvent("round_end", Event_RoundEnd);
    3.27 +		}
    3.28  	}
    3.29  	
    3.30  	if (g_Cvar_Fraglimit != INVALID_HANDLE)
    3.31 @@ -407,7 +420,16 @@
    3.32  		g_ChangeMapInProgress = true;
    3.33  	}
    3.34  	
    3.35 -	new winner = GetEventInt(event, "winner");
    3.36 +	new winner;
    3.37 +	if (strcmp(name, "round_win") == 0)
    3.38 +	{
    3.39 +		// Nuclear Dawn
    3.40 +		winner = GetEventInt(event, "team");
    3.41 +	}
    3.42 +	else
    3.43 +	{
    3.44 +		winner = GetEventInt(event, "winner");
    3.45 +	}
    3.46  	
    3.47  	if (winner == 0 || winner == 1 || !GetConVarBool(g_Cvar_EndOfMapVote))
    3.48  	{