mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-09 19:38:25 +00:00
add Shavit_OnRestartPre
This commit is contained in:
parent
958c87ccf4
commit
3f14b65cc4
@ -618,6 +618,15 @@ forward Action Shavit_OnStartPre(int client, int track);
|
|||||||
*/
|
*/
|
||||||
forward Action Shavit_OnStart(int client, int track);
|
forward Action Shavit_OnStart(int client, int track);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player uses the restart command.
|
||||||
|
*
|
||||||
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
|
* @return Plugin_Continue to do nothing or anything else to not restart.
|
||||||
|
*/
|
||||||
|
forward Action Shavit_OnRestartPre(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player uses the restart command.
|
* Called when a player uses the restart command.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -93,6 +93,7 @@ Handle gH_Forwards_Stop = null;
|
|||||||
Handle gH_Forwards_StopPre = null;
|
Handle gH_Forwards_StopPre = null;
|
||||||
Handle gH_Forwards_FinishPre = null;
|
Handle gH_Forwards_FinishPre = null;
|
||||||
Handle gH_Forwards_Finish = null;
|
Handle gH_Forwards_Finish = null;
|
||||||
|
Handle gH_Forwards_OnRestartPre = null;
|
||||||
Handle gH_Forwards_OnRestart = null;
|
Handle gH_Forwards_OnRestart = null;
|
||||||
Handle gH_Forwards_OnEnd = null;
|
Handle gH_Forwards_OnEnd = null;
|
||||||
Handle gH_Forwards_OnPause = null;
|
Handle gH_Forwards_OnPause = null;
|
||||||
@ -274,7 +275,8 @@ public void OnPluginStart()
|
|||||||
gH_Forwards_StopPre = CreateGlobalForward("Shavit_OnStopPre", ET_Event, Param_Cell, Param_Cell);
|
gH_Forwards_StopPre = CreateGlobalForward("Shavit_OnStopPre", ET_Event, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_FinishPre = CreateGlobalForward("Shavit_OnFinishPre", ET_Event, Param_Cell, Param_Array);
|
gH_Forwards_FinishPre = CreateGlobalForward("Shavit_OnFinishPre", ET_Event, Param_Cell, Param_Array);
|
||||||
gH_Forwards_Finish = CreateGlobalForward("Shavit_OnFinish", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
gH_Forwards_Finish = CreateGlobalForward("Shavit_OnFinish", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnRestart = CreateGlobalForward("Shavit_OnRestart", ET_Event, Param_Cell, Param_Cell);
|
gH_Forwards_OnRestartPre = CreateGlobalForward("Shavit_OnRestartPre", ET_Event, Param_Cell, Param_Cell);
|
||||||
|
gH_Forwards_OnRestart = CreateGlobalForward("Shavit_OnRestart", ET_Ignore, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnEnd = CreateGlobalForward("Shavit_OnEnd", ET_Event, Param_Cell, Param_Cell);
|
gH_Forwards_OnEnd = CreateGlobalForward("Shavit_OnEnd", ET_Event, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnPause = CreateGlobalForward("Shavit_OnPause", ET_Event, Param_Cell, Param_Cell);
|
gH_Forwards_OnPause = CreateGlobalForward("Shavit_OnPause", ET_Event, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnResume = CreateGlobalForward("Shavit_OnResume", ET_Event, Param_Cell, Param_Cell);
|
gH_Forwards_OnResume = CreateGlobalForward("Shavit_OnResume", ET_Event, Param_Cell, Param_Cell);
|
||||||
@ -653,6 +655,17 @@ public Action Command_StartTimer(int client, int args)
|
|||||||
}
|
}
|
||||||
else if(StrContains(sCommand, "sm_r", false) == 0 || StrContains(sCommand, "sm_s", false) == 0)
|
else if(StrContains(sCommand, "sm_r", false) == 0 || StrContains(sCommand, "sm_s", false) == 0)
|
||||||
{
|
{
|
||||||
|
Action result = Plugin_Continue;
|
||||||
|
Call_StartForward(gH_Forwards_OnRestartPre);
|
||||||
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(track);
|
||||||
|
Call_Finish(result);
|
||||||
|
|
||||||
|
if (result > Plugin_Continue)
|
||||||
|
{
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
track = gA_Timers[client].iTrack;
|
track = gA_Timers[client].iTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3220,12 +3220,10 @@ public void Shavit_OnRestart(int client, int track)
|
|||||||
{
|
{
|
||||||
OpenKZCPMenu(client);
|
OpenKZCPMenu(client);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(!gCV_RespawnOnRestart.BoolValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public Action Shavit_OnRestartPre(int client, int track)
|
||||||
|
{
|
||||||
if(gCV_RespawnOnRestart.BoolValue && !IsPlayerAlive(client))
|
if(gCV_RespawnOnRestart.BoolValue && !IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
if(gEV_Type == Engine_TF2)
|
if(gEV_Type == Engine_TF2)
|
||||||
@ -3245,7 +3243,11 @@ public void Shavit_OnRestart(int client, int track)
|
|||||||
{
|
{
|
||||||
CS_RespawnPlayer(client);
|
CS_RespawnPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Respawn(Handle timer, any data)
|
public Action Respawn(Handle timer, any data)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user