replaced HookEntityOutput with HookSingleEntityOutput for handling teleportation understanding
This commit is contained in:
parent
bc3c1e6ca5
commit
f55d664311
@ -57,11 +57,6 @@ public void OnPluginStart()
|
||||
|
||||
//hooks
|
||||
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
||||
HookEntityOutput("trigger_multiple", "OnTrigger", Trigger_Multiple);
|
||||
HookEntityOutput("trigger_multiple", "OnStartTouch", Trigger_Multiple);
|
||||
HookEntityOutput("trigger_teleport", "OnTrigger", trigger_teleport);
|
||||
HookEntityOutput("trigger_teleport", "OnStartTouch", trigger_teleport);
|
||||
|
||||
//UDP connection
|
||||
connect_socket();
|
||||
chat_cooldown = false;
|
||||
@ -74,40 +69,6 @@ public void reset_target_human_tp_coord(int client)
|
||||
targethuman_teleported[client][2] = 0.0;
|
||||
}
|
||||
|
||||
public void trigger_teleport(const char[] output, int entity_index, int client, float delay)
|
||||
{
|
||||
if (IsValidEdict(entity_index))
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
if (target_friend[i] == client)
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported[i]);
|
||||
CreateTimer(6.0, reset_target_tp, client);
|
||||
}
|
||||
else if (is_bot_player(i) && i == client)
|
||||
CreateTimer(0.1, reset_target_tp, client);
|
||||
}
|
||||
}
|
||||
|
||||
public void Trigger_Multiple(const char[] output, int entity_index, int client, float delay)
|
||||
{
|
||||
if (IsValidEdict(entity_index) && origin_command_check(entity_index))
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
if (target_friend[i] == client)
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported[i]);
|
||||
CreateTimer(6.0, reset_target_tp, client);
|
||||
}
|
||||
else if (is_bot_player(i) && i == client)
|
||||
CreateTimer(0.1, reset_target_tp, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool origin_command_check(int entity_index)
|
||||
{
|
||||
int count_trigger = GetOutputCount(entity_index, "m_OnTrigger");
|
||||
@ -280,6 +241,61 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast
|
||||
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)
|
||||
{
|
||||
HookSingleEntityOutput(entity_mp, "OnStartTouch", OnEntityOutPut_mp);
|
||||
HookSingleEntityOutput(entity_mp, "OnTrigger", OnEntityOutPut_mp);
|
||||
}
|
||||
}
|
||||
while((entity_tp = FindEntityByClassname(entity_tp, "trigger_teleport")) != -1)
|
||||
{
|
||||
char targetName[64];
|
||||
GetEntPropString(entity_tp, Prop_Data, "m_iName", targetName, sizeof(targetName));
|
||||
if (strlen(targetName) > 0)
|
||||
{
|
||||
HookSingleEntityOutput(entity_tp, "OnStartTouch", OnEntityOutPut_tp);
|
||||
HookSingleEntityOutput(entity_tp, "OnTrigger", OnEntityOutPut_tp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntityOutPut_mp(const char[] output, int entity_index, int client, float delay)
|
||||
{
|
||||
if (IsValidEdict(entity_index) && origin_command_check(entity_index))
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
if (target_friend[i] == client)
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported[i]);
|
||||
CreateTimer(6.0, reset_target_tp, client);
|
||||
}
|
||||
else if (is_bot_player(i) && i == client)
|
||||
CreateTimer(0.1, reset_target_tp, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntityOutPut_tp(const char[] output, int caller, int client, float delay)
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
if (target_friend[i] == client)
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported[i]);
|
||||
CreateTimer(6.0, reset_target_tp, client);
|
||||
}
|
||||
else if (is_bot_player(i) && i == client)
|
||||
CreateTimer(0.1, reset_target_tp, client);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMapStart()
|
||||
|
Loading…
Reference in New Issue
Block a user