mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 18:38:26 +00:00
Added Shavit_OnStopPre
This commit is contained in:
parent
a30da28d69
commit
30264ef092
@ -373,6 +373,15 @@ forward void Shavit_OnRestart(int client, int track);
|
||||
*/
|
||||
forward void Shavit_OnEnd(int client, int track);
|
||||
|
||||
/**
|
||||
* Called before a player's timer is stopped. (stop =/= finish a map)
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param track Timer track.
|
||||
* @return False to prevent the timer from stopping.
|
||||
*/
|
||||
forward bool Shavit_OnStopPre(int client, int track);
|
||||
|
||||
/**
|
||||
* Called when a player's timer stops. (stop =/= finish a map)
|
||||
*
|
||||
@ -681,9 +690,10 @@ native void Shavit_RestartTimer(int client, int track);
|
||||
* Will not teleport the player to anywhere, it's handled inside the mapzones plugin.
|
||||
*
|
||||
* @param client Client index.
|
||||
* @noreturn
|
||||
* @param bypass Bypass call to Shavit_OnStopPre?
|
||||
* @return True if the operation went through.
|
||||
*/
|
||||
native void Shavit_StopTimer(int client);
|
||||
native bool Shavit_StopTimer(int client, bool bypass = true);
|
||||
|
||||
/**
|
||||
* Deletes all map records for the specified map.
|
||||
|
||||
@ -68,6 +68,7 @@ bool gB_MySQL = false;
|
||||
// forwards
|
||||
Handle gH_Forwards_Start = null;
|
||||
Handle gH_Forwards_Stop = null;
|
||||
Handle gH_Forwards_StopPre = null;
|
||||
Handle gH_Forwards_FinishPre = null;
|
||||
Handle gH_Forwards_Finish = null;
|
||||
Handle gH_Forwards_OnRestart = null;
|
||||
@ -215,6 +216,7 @@ public void OnPluginStart()
|
||||
// forwards
|
||||
gH_Forwards_Start = CreateGlobalForward("Shavit_OnStart", ET_Event, Param_Cell, Param_Cell);
|
||||
gH_Forwards_Stop = CreateGlobalForward("Shavit_OnStop", 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_Finish = CreateGlobalForward("Shavit_OnFinish", ET_Event, 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);
|
||||
@ -1256,6 +1258,21 @@ public int Native_StartTimer(Handle handler, int numParams)
|
||||
public int Native_StopTimer(Handle handler, int numParams)
|
||||
{
|
||||
int client = GetNativeCell(1);
|
||||
bool bBypass = (numParams < 2 || view_as<bool>(GetNativeCell(2)));
|
||||
|
||||
if(!bBypass)
|
||||
{
|
||||
bool bResult = true;
|
||||
Call_StartForward(gH_Forwards_StopPre);
|
||||
Call_PushCell(client);
|
||||
Call_PushCell(gA_Timers[client].iTrack);
|
||||
Call_Finish(bResult);
|
||||
|
||||
if(!bResult)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
StopTimer(client);
|
||||
|
||||
@ -1263,6 +1280,8 @@ public int Native_StopTimer(Handle handler, int numParams)
|
||||
Call_PushCell(client);
|
||||
Call_PushCell(gA_Timers[client].iTrack);
|
||||
Call_Finish();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int Native_CanPause(Handle handler, int numParams)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user