added check to prevent teleport abuse
This commit is contained in:
parent
63703675e1
commit
d29f3fa2f1
@ -1,7 +1,7 @@
|
|||||||
#pragma semicolon 1
|
#pragma semicolon 1
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
#define PLUGIN_AUTHOR "jenz"
|
#define PLUGIN_AUTHOR "jenz"
|
||||||
#define PLUGIN_VERSION "1.6"
|
#define PLUGIN_VERSION "1.7"
|
||||||
#define g_dLength 400
|
#define g_dLength 400
|
||||||
#define g_dIndex 65
|
#define g_dIndex 65
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
@ -27,6 +27,7 @@ int g_iClientSpeedInterval[MAXPLAYERS + 1];
|
|||||||
int g_iClientChecking[MAXPLAYERS + 1];
|
int g_iClientChecking[MAXPLAYERS + 1];
|
||||||
bool g_bDisplaySpecial;
|
bool g_bDisplaySpecial;
|
||||||
bool g_bHumansAllowedTime[MAXPLAYERS + 1];
|
bool g_bHumansAllowedTime[MAXPLAYERS + 1];
|
||||||
|
bool g_bhumans_finished[MAXPLAYERS + 1];
|
||||||
bool g_bHideTimer[MAXPLAYERS + 1];
|
bool g_bHideTimer[MAXPLAYERS + 1];
|
||||||
bool g_bEventBool = false;
|
bool g_bEventBool = false;
|
||||||
Handle g_hClientCookie = INVALID_HANDLE;
|
Handle g_hClientCookie = INVALID_HANDLE;
|
||||||
@ -83,7 +84,7 @@ public void trigger_teleport(const char[] output, int entity_index, int client,
|
|||||||
resetClientVectors(client);
|
resetClientVectors(client);
|
||||||
if (GetClientTeam(client) == 3)
|
if (GetClientTeam(client) == 3)
|
||||||
{
|
{
|
||||||
PrintToChat(client, "Disabled timer due to potential teleport abuse, if this is wrong annoy jenz on discord");
|
PrintToChat(client, "Disabled timer due to potential teleport abuse");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +98,7 @@ public void Trigger_Multiple(const char[] output, int entity_index, int client,
|
|||||||
{
|
{
|
||||||
g_bHumansAllowedTime[client] = false;
|
g_bHumansAllowedTime[client] = false;
|
||||||
resetClientVectors(client);
|
resetClientVectors(client);
|
||||||
PrintToChat(client, "Disabled timer due to potential teleport abuse, if this is wrong annoy jenz on discord");
|
PrintToChat(client, "Disabled timer due to potential teleport abuse");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,6 +270,7 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast
|
|||||||
for (int i = 1; i <= MaxClients; i++)
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
if (IsValidClient(i) && !IsFakeClient(i))
|
if (IsValidClient(i) && !IsFakeClient(i))
|
||||||
{
|
{
|
||||||
|
g_bhumans_finished[i] = false;
|
||||||
resetClientVectors(i);
|
resetClientVectors(i);
|
||||||
if (l_iZoneCount != 1)
|
if (l_iZoneCount != 1)
|
||||||
g_bHumansAllowedTime[i] = false;
|
g_bHumansAllowedTime[i] = false;
|
||||||
@ -313,6 +315,7 @@ public void resetClient(int client)
|
|||||||
{
|
{
|
||||||
g_iClientChecking[client] = 0;
|
g_iClientChecking[client] = 0;
|
||||||
g_bHumansAllowedTime[client] = false;
|
g_bHumansAllowedTime[client] = false;
|
||||||
|
g_bhumans_finished[client] = false;
|
||||||
resetClientVectors(client);
|
resetClientVectors(client);
|
||||||
player_stage[client] = 0;
|
player_stage[client] = 0;
|
||||||
Format(g_csTime_record[client], sizeof(g_csTime_record[]), "0.000");
|
Format(g_csTime_record[client], sizeof(g_csTime_record[]), "0.000");
|
||||||
@ -323,16 +326,19 @@ public void resetClient(int client)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon, int subtype, int cmdnum, int tickcount, int seed, const int mouse[2])
|
public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon, int subtype, int cmdnum, int tickcount, int seed, const int mouse[2])
|
||||||
{
|
{
|
||||||
if (!IsValidClient(client))
|
if (!IsValidClient(client) || !g_bHumansAllowedTime[client])
|
||||||
return;
|
return;
|
||||||
|
//checks if event is going on
|
||||||
if (g_bEventBool)
|
if (g_bEventBool)
|
||||||
{
|
{
|
||||||
g_bHumansAllowedTime[client] = false;
|
g_bHumansAllowedTime[client] = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (g_bHumansAllowedTime[client] && (GetClientTeam(client) == CS_TEAM_CT) && IsPlayerAlive(client))
|
if (GetClientTeam(client) == CS_TEAM_CT && IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
int frameCap = 11;
|
int frameCap = 11;
|
||||||
|
if (g_bhumans_finished[client])
|
||||||
|
g_iClientFrames[client] = 11;
|
||||||
if (g_iClientFrames[client] >= frameCap)
|
if (g_iClientFrames[client] >= frameCap)
|
||||||
{
|
{
|
||||||
g_iClientFrames[client] = 0;
|
g_iClientFrames[client] = 0;
|
||||||
@ -341,10 +347,18 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
|||||||
if (checkClientOrigin(g_fClientVectors[client], clientVectors, client))
|
if (checkClientOrigin(g_fClientVectors[client], clientVectors, client))
|
||||||
{
|
{
|
||||||
g_bHumansAllowedTime[client] = false;
|
g_bHumansAllowedTime[client] = false;
|
||||||
|
g_bhumans_finished[client] = false;
|
||||||
resetClientVectors(client);
|
resetClientVectors(client);
|
||||||
PrintToChat(client, "Disabled timer due to potential teleport abuse");
|
PrintToChat(client, "Disabled timer due to potential teleport abuse");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (g_bhumans_finished[client])
|
||||||
|
{
|
||||||
|
g_bhumans_finished[client] = false;
|
||||||
|
g_bHumansAllowedTime[client] = false;
|
||||||
|
FinishedStageRaceZone(client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int speedCheckerCap = 10;
|
int speedCheckerCap = 10;
|
||||||
if (g_iClientSpeedInterval[client] > speedCheckerCap)
|
if (g_iClientSpeedInterval[client] > speedCheckerCap)
|
||||||
{
|
{
|
||||||
@ -353,6 +367,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
|||||||
if (bNoclip)
|
if (bNoclip)
|
||||||
{
|
{
|
||||||
g_bHumansAllowedTime[client] = false;
|
g_bHumansAllowedTime[client] = false;
|
||||||
|
g_bhumans_finished[client] = false;
|
||||||
resetClientVectors(client);
|
resetClientVectors(client);
|
||||||
PrintToChat(client, "Disabled timer due to Noclip");
|
PrintToChat(client, "Disabled timer due to Noclip");
|
||||||
return;
|
return;
|
||||||
@ -363,6 +378,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
|||||||
if (StrContains(g_cMapname, "surf", false) == -1)
|
if (StrContains(g_cMapname, "surf", false) == -1)
|
||||||
{
|
{
|
||||||
g_bHumansAllowedTime[client] = false;
|
g_bHumansAllowedTime[client] = false;
|
||||||
|
g_bhumans_finished[client] = false;
|
||||||
resetClientVectors(client);
|
resetClientVectors(client);
|
||||||
PrintToChat(client, "Disabled timer due to modified run speed");
|
PrintToChat(client, "Disabled timer due to modified run speed");
|
||||||
return;
|
return;
|
||||||
@ -377,6 +393,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
|||||||
{
|
{
|
||||||
//PrintToChat(client, "client_gravity: %f\ngravityFloat: %f", client_gravity, gravityFloat);
|
//PrintToChat(client, "client_gravity: %f\ngravityFloat: %f", client_gravity, gravityFloat);
|
||||||
g_bHumansAllowedTime[client] = false;
|
g_bHumansAllowedTime[client] = false;
|
||||||
|
g_bhumans_finished[client] = false;
|
||||||
resetClientVectors(client);
|
resetClientVectors(client);
|
||||||
PrintToChat(client, "Disabled timer due to modified gravity");
|
PrintToChat(client, "Disabled timer due to modified gravity");
|
||||||
return;
|
return;
|
||||||
@ -448,18 +465,20 @@ public void unloze_zoneEntry(int client, char[] zone)
|
|||||||
{
|
{
|
||||||
int zoneIndex = RetrieveZoneIndex(zone);
|
int zoneIndex = RetrieveZoneIndex(zone);
|
||||||
int l_iZoneCount = unloze_zoneCount();
|
int l_iZoneCount = unloze_zoneCount();
|
||||||
if (((GetClientTeam(client) == CS_TEAM_CT && g_bHumansAllowedTime[client]) && StrContains(zone, "ZONE_PREFIX_RACE") > -1) || StrEqual(zone, g_cSpecialMapEnd))
|
|
||||||
|
if (GetClientTeam(client) == CS_TEAM_CT && g_bHumansAllowedTime[client])
|
||||||
{
|
{
|
||||||
if (IsClientAuthorized(client))
|
if ((StrContains(zone, "ZONE_PREFIX_RACE") > -1) || StrEqual(zone, g_cSpecialMapEnd))
|
||||||
{
|
{
|
||||||
|
g_bHumansAllowedTime[client] = false;
|
||||||
if (l_iZoneCount < 2)
|
if (l_iZoneCount < 2)
|
||||||
player_stage[client] = 0;
|
player_stage[client] = 0;
|
||||||
if (player_stage[client] == (zoneIndex / 2) || l_iZoneCount < 2)
|
if (player_stage[client] == (zoneIndex / 2) || l_iZoneCount < 2)
|
||||||
FinishedStageRaceZone(client);
|
{
|
||||||
|
g_bHumansAllowedTime[client] = true;
|
||||||
|
g_bhumans_finished[client] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
PrintToChat(client, "You are not authorized with steam!!");
|
|
||||||
g_bHumansAllowedTime[client] = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -469,7 +488,9 @@ public void unloze_zoneLeave(int client, char[] zone)
|
|||||||
{
|
{
|
||||||
//only maps with multiple zones need ZONE_PREFIX_START
|
//only maps with multiple zones need ZONE_PREFIX_START
|
||||||
int l_iZoneCount = unloze_zoneCount();
|
int l_iZoneCount = unloze_zoneCount();
|
||||||
if (((GetClientTeam(client) == CS_TEAM_CT) && StrContains(zone, "ZONE_PREFIX_START") > -1) || StrEqual(zone, g_cSpecialMapStart))
|
if (GetClientTeam(client) == CS_TEAM_CT)
|
||||||
|
{
|
||||||
|
if ((StrContains(zone, "ZONE_PREFIX_START") > -1) || StrEqual(zone, g_cSpecialMapStart))
|
||||||
{
|
{
|
||||||
if (!l_iZoneCount)
|
if (!l_iZoneCount)
|
||||||
return;
|
return;
|
||||||
@ -482,6 +503,7 @@ public void unloze_zoneLeave(int client, char[] zone)
|
|||||||
CPrintToChat(client, "Timer started for Course: %i", player_stage[client]);
|
CPrintToChat(client, "Timer started for Course: %i", player_stage[client]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stock void FormatPlayerTime(float Time, char[] result, int maxlength, bool showDash, int precision)
|
stock void FormatPlayerTime(float Time, char[] result, int maxlength, bool showDash, int precision)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user