diff --git a/addons/sourcemod/scripting/include/shavit.inc b/addons/sourcemod/scripting/include/shavit.inc index dc818cbf..dff940c4 100644 --- a/addons/sourcemod/scripting/include/shavit.inc +++ b/addons/sourcemod/scripting/include/shavit.inc @@ -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"); diff --git a/addons/sourcemod/scripting/shavit-misc.sp b/addons/sourcemod/scripting/shavit-misc.sp index 03ce61ee..01ff3fd5 100644 --- a/addons/sourcemod/scripting/shavit-misc.sp +++ b/addons/sourcemod/scripting/shavit-misc.sp @@ -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;