Permalink
Browse files

Fix #399

  • Loading branch information...
Bara committed Jan 20, 2019
1 parent 6402e5a commit c457a13fca1f582bede0551e23db755d64a0955c
Showing with 24 additions and 16 deletions.
  1. +4 −2 addons/sourcemod/scripting/ttt/ttt.sp
  2. +20 −14 addons/sourcemod/scripting/ttt/ttt_hurtshot.sp
@@ -55,7 +55,7 @@ public void OnPluginStart()

LoadBadNames();

g_aRagdoll = new ArrayList(296);
g_aRagdoll = new ArrayList(104);
g_aLogs = new ArrayList(512);
g_aForceTraitor = new ArrayList();
g_aForceDetective = new ArrayList();
@@ -3384,13 +3384,15 @@ public int TTT_OnButtonPress(int client, int button)

if (button & IN_USE)
{

int iEntity = GetClientAimTarget(client, false);

if (iEntity > 0)
{
float OriginG[3], TargetOriginG[3];

GetClientEyePosition(client, TargetOriginG);
GetEntPropVector(iEntity, Prop_Data, "m_vecOrigin", OriginG);

if (GetVectorDistance(TargetOriginG, OriginG, false) > 90.0)
{
return;
@@ -137,16 +137,19 @@ public Action Event_Fire(Event event, const char[] name, bool dontBroadcast)

public Action OnWeaponEquip(int client, int weapon)
{
int iRef = EntIndexToEntRef(weapon);
int iIndex = g_aListHS.FindValue(iRef);

if (iIndex != -1)
if (IsValidEntity(weapon))
{
int iArrayRef = g_aListHS.Get(iIndex);
int iRef = EntIndexToEntRef(weapon);
int iIndex = g_aListHS.FindValue(iRef);

if (TTT_IsClientValid(client) && IsValidEntity(EntRefToEntIndex(iArrayRef) && iRef == iArrayRef))
if (iIndex != -1)
{
g_bHasHS[client] = true;
int iArrayRef = g_aListHS.Get(iIndex);

if (TTT_IsClientValid(client) && IsValidEntity(EntRefToEntIndex(iArrayRef) && iRef == iArrayRef))
{
g_bHasHS[client] = true;
}
}
}

@@ -155,16 +158,19 @@ public Action OnWeaponEquip(int client, int weapon)

public Action OnWeaponDrop(int client, int weapon)
{
int iRef = EntIndexToEntRef(weapon);
int iIndex = g_aListHS.FindValue(iRef);

if (iIndex != -1)
if (IsValidEntity(weapon))
{
int iArrayRef = g_aListHS.Get(iIndex);
int iRef = EntIndexToEntRef(weapon);
int iIndex = g_aListHS.FindValue(iRef);

if (TTT_IsClientValid(client) && IsValidEntity(EntRefToEntIndex(iArrayRef) && iRef == iArrayRef))
if (iIndex != -1)
{
g_bHasHS[client] = false;
int iArrayRef = g_aListHS.Get(iIndex);

if (TTT_IsClientValid(client) && IsValidEntity(EntRefToEntIndex(iArrayRef) && iRef == iArrayRef))
{
g_bHasHS[client] = false;
}
}
}

0 comments on commit c457a13

Please sign in to comment.