mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 02:18:26 +00:00
add Shavit_GetTimesTeleported() (#1012)
* add Shavit_GetTimesTeleported() * add Shavit_GetTimesTeleported() to the optional native section * Use ++ instead of += 1 Co-authored-by: KiD Fearless <kidfearless1@gmail.com>
This commit is contained in:
parent
183db7c1a9
commit
df8b64d1b3
@ -1960,6 +1960,15 @@ native int Shavit_GetCurrentCheckpoint(int client);
|
||||
*/
|
||||
native void Shavit_SetCurrentCheckpoint(int client, int index);
|
||||
|
||||
/**
|
||||
* Gets how many times the client has teleported to checkpoints.
|
||||
*
|
||||
* @param client Client index
|
||||
*
|
||||
* @return The number of times the client has teleported to checkpoints.
|
||||
*/
|
||||
native int Shavit_GetTimesTeleported(int client);
|
||||
|
||||
/*
|
||||
* returns the number of preframes in the players current run.
|
||||
*
|
||||
@ -2134,6 +2143,7 @@ public void __pl_shavit_SetNTVOptional()
|
||||
MarkNativeAsOptional("Shavit_SaveCheckpoint");
|
||||
MarkNativeAsOptional("Shavit_GetCurrentCheckpoint");
|
||||
MarkNativeAsOptional("Shavit_SetCurrentCheckpoint");
|
||||
MarkNativeAsOptional("Shavit_GetTimesTeleported");
|
||||
MarkNativeAsOptional("Shavit_GetPlayerPreFrame");
|
||||
MarkNativeAsOptional("Shavit_GetPlayerTimerFrame");
|
||||
MarkNativeAsOptional("Shavit_SetPlayerPreFrame");
|
||||
|
||||
@ -91,6 +91,7 @@ bool gB_ClosedKZCP[MAXPLAYERS+1];
|
||||
|
||||
ArrayList gA_Checkpoints[MAXPLAYERS+1];
|
||||
int gI_CurrentCheckpoint[MAXPLAYERS+1];
|
||||
int gI_TimesTeleported[MAXPLAYERS+1];
|
||||
|
||||
int gI_CheckpointsSettings[MAXPLAYERS+1];
|
||||
ArrayList gA_Targetnames = null;
|
||||
@ -199,6 +200,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
||||
CreateNative("Shavit_SaveCheckpoint", Native_SaveCheckpoint);
|
||||
CreateNative("Shavit_GetCurrentCheckpoint", Native_GetCurrentCheckpoint);
|
||||
CreateNative("Shavit_SetCurrentCheckpoint", Native_SetCurrentCheckpoint);
|
||||
CreateNative("Shavit_GetTimesTeleported", Native_GetTimesTeleported);
|
||||
|
||||
gB_Late = late;
|
||||
|
||||
@ -2492,6 +2494,8 @@ void TeleportToCheckpoint(int client, int index, bool suppressMessage)
|
||||
return;
|
||||
}
|
||||
|
||||
gI_TimesTeleported[client]++;
|
||||
|
||||
if(Shavit_InsideZone(client, Zone_Start, -1))
|
||||
{
|
||||
Shavit_StopTimer(client);
|
||||
@ -2863,6 +2867,8 @@ public Action Command_Specs(int client, int args)
|
||||
|
||||
public Action Shavit_OnStart(int client)
|
||||
{
|
||||
gI_TimesTeleported[client] = 0;
|
||||
|
||||
if(Shavit_GetStyleSettingInt(gI_Style[client], "prespeed") == 0 && GetEntityMoveType(client) == MOVETYPE_NOCLIP)
|
||||
{
|
||||
return Plugin_Stop;
|
||||
@ -3561,6 +3567,11 @@ public any Native_TeleportToCheckpoint(Handle plugin, int numParams)
|
||||
return 0;
|
||||
}
|
||||
|
||||
public any Native_GetTimesTeleported(Handle plugin, int numParams)
|
||||
{
|
||||
return gI_TimesTeleported[GetNativeCell(1)];
|
||||
}
|
||||
|
||||
public any Native_GetTotalCheckpoints(Handle plugin, int numParams)
|
||||
{
|
||||
return gA_Checkpoints[GetNativeCell(1)].Length;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user