View Single Post
Mitchell
~lick~
Join Date: Mar 2010
Old 02-26-2019 , 13:44   Re: Adding Spy Cloakflicker?
Reply With Quote #2

I was looking into this also, 6 years later, turns out there's a property called "m_flLastStealthExposeTime" which does just this.

CTFPlayerShared Touch
Code:
m_flLastStealthExposeTime = gpGlobals->curtime;
AddCond( TF_COND_STEALTHED_BLINK );
Seems a mix of the attribute 159 and firing the "Touch" offset might do this fine.
Touch has to be an enemy though.

Turns out I couldn't get touch to do anything when firing it and stuck to just damaging the player here for anybody interested.
Code:
public void flickerCloak(int client) {
    int oldTakeDamage = GetEntProp(client, Prop_Data, "m_takedamage");
    SetEntProp(client, Prop_Data, "m_takedamage", 1, 1); //Don't do damage, but still fire the damage hooks.
    SDKHooks_TakeDamage(client, 0, 0, 6.0, DMG_PREVENT_PHYSICS_FORCE, 0, NULL_VECTOR, NULL_VECTOR);
    SetEntPropVector(client, Prop_Send, "m_vecPunchAngle", NULL_VECTOR); //Resets the punch angle.
    SetEntPropVector(client, Prop_Send, "m_vecPunchAngleVel", NULL_VECTOR);
    SetEntProp(client, Prop_Data, "m_takedamage", oldTakeDamage, 1);
}

public void OnClientPutInServer(int client) {
    SDKHook(client, SDKHook_OnTakeDamageAlive, TakeDamageAliveHook);
}

public Action TakeDamageAliveHook(int client, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon,
        float damageForce[3], float damagePosition[3], int damagecustom) {
    if(attacker == 0 && damagetype == DMG_PREVENT_PHYSICS_FORCE) {
        return Plugin_Stop; //Prevents the blood effect.
    }
    return Plugin_Continue;
}

Last edited by Mitchell; 02-26-2019 at 18:21.
Mitchell is offline