questionable how effective teleport spotting now is, but probably no lag anymore
This commit is contained in:
parent
cace8afc41
commit
38fdad89ba
@ -28,8 +28,6 @@ bool chat_cooldown = false;
|
||||
//admins & vips
|
||||
bool admins[MAXPLAYERS + 1];
|
||||
bool vips[MAXPLAYERS + 1];
|
||||
bool teleport_hook = false;
|
||||
bool multiple_hook = false;
|
||||
|
||||
//socket for bot input
|
||||
Handle global_socket;
|
||||
@ -63,6 +61,7 @@ public void OnPluginStart()
|
||||
//UDP connection
|
||||
connect_socket();
|
||||
chat_cooldown = false;
|
||||
round_start_void();
|
||||
}
|
||||
|
||||
public void reset_target_human_tp_coord(int client)
|
||||
@ -259,8 +258,6 @@ public void unhookAll()
|
||||
UnhookSingleEntityOutput(entity_tp, "OnTrigger", OnEntityOutPut_tp);
|
||||
}
|
||||
}
|
||||
teleport_hook = false;
|
||||
multiple_hook = false;
|
||||
}
|
||||
|
||||
public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
|
||||
@ -268,23 +265,23 @@ public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
|
||||
unhookAll();
|
||||
}
|
||||
|
||||
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
|
||||
public void round_start_void()
|
||||
{
|
||||
unhookAll();
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i) && !IsFakeClient(i))
|
||||
{
|
||||
target_friend[i] = 0;
|
||||
target_enemy[i] = 0;
|
||||
reset_target_human_tp_coord(i);
|
||||
}
|
||||
if (IsValidClient(i) && !IsFakeClient(i))
|
||||
{
|
||||
target_friend[i] = 0;
|
||||
target_enemy[i] = 0;
|
||||
reset_target_human_tp_coord(i);
|
||||
}
|
||||
int entity_tp = MaxClients + 1;
|
||||
int entity_mp = MaxClients + 1;
|
||||
while((entity_mp = FindEntityByClassname(entity_mp, "trigger_multiple")) != -1)
|
||||
{
|
||||
{
|
||||
char targetName[64];
|
||||
GetEntPropString(entity_mp, Prop_Data, "m_iName", targetName, sizeof(targetName));
|
||||
if (strlen(targetName) > 0)
|
||||
GetEntPropString(entity_mp, Prop_Data, "m_iName", targetName, sizeof(targetName));
|
||||
if (strlen(targetName) > 0)
|
||||
{
|
||||
HookSingleEntityOutput(entity_mp, "OnStartTouch", OnEntityOutPut_mp, true);
|
||||
HookSingleEntityOutput(entity_mp, "OnTrigger", OnEntityOutPut_mp, true);
|
||||
@ -302,6 +299,11 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast
|
||||
}
|
||||
}
|
||||
|
||||
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
round_start_void();
|
||||
}
|
||||
|
||||
public void OnEntityOutPut_mp(const char[] output, int entity_index, int client, float delay)
|
||||
{
|
||||
if (IsValidEdict(entity_index) && origin_command_check(entity_index))
|
||||
@ -322,14 +324,12 @@ public void OnEntityOutPut_mp(const char[] output, int entity_index, int client,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!multiple_hook)
|
||||
{
|
||||
multiple_hook = true;
|
||||
UnhookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_mp);
|
||||
UnhookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_mp);
|
||||
//experimental if unhooking very shortly solves tp lag
|
||||
CreateTimer(0.5, reset_hook_mp, INVALID_HANDLE);
|
||||
}
|
||||
UnhookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_mp);
|
||||
UnhookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_mp);
|
||||
//experimental if unhooking very shortly solves tp lag
|
||||
DataPack dPack;
|
||||
CreateDataTimer(0.5, reset_hook_mp, dPack);
|
||||
dPack.WriteCell(entity_index);
|
||||
}
|
||||
|
||||
public void OnEntityOutPut_tp(const char[] output, int entity_index, int client, float delay)
|
||||
@ -350,14 +350,12 @@ public void OnEntityOutPut_tp(const char[] output, int entity_index, int client,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!teleport_hook)
|
||||
{
|
||||
teleport_hook = true;
|
||||
UnhookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_tp);
|
||||
UnhookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_tp);
|
||||
//experimental if unhooking very shortly solves tp lag
|
||||
CreateTimer(0.5, reset_hook_tp, INVALID_HANDLE);
|
||||
}
|
||||
UnhookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_tp);
|
||||
UnhookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_tp);
|
||||
//experimental if unhooking very shortly solves tp lag
|
||||
DataPack dPack;
|
||||
CreateDataTimer(0.5, reset_hook_tp, dPack);
|
||||
dPack.WriteCell(entity_index);
|
||||
}
|
||||
|
||||
public void OnMapStart()
|
||||
@ -591,15 +589,27 @@ public bool is_bot_player(int client)
|
||||
return is_autism_bot1(client) || is_autism_bot2(client) || is_autism_bot3(client) || is_autism_bot4(client);
|
||||
}
|
||||
|
||||
public Action reset_hook_mp(Handle timer, any data)
|
||||
public Action reset_hook_mp(Handle timer, DataPack dPack)
|
||||
{
|
||||
multiple_hook = false;
|
||||
dPack.Reset();
|
||||
int entity_index = dPack.ReadCell();
|
||||
if (IsValidEdict(entity_index))
|
||||
{
|
||||
HookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_mp, true);
|
||||
HookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_mp, true);
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action reset_hook_tp(Handle timer, any data)
|
||||
public Action reset_hook_tp(Handle timer, DataPack dPack)
|
||||
{
|
||||
teleport_hook = false;
|
||||
dPack.Reset();
|
||||
int entity_index = dPack.ReadCell();
|
||||
if (IsValidEdict(entity_index))
|
||||
{
|
||||
HookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_tp, true);
|
||||
HookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_tp, true);
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user