Raised This Month: $12 Target: $400
 3% 

Solved [L4D2] Block the attacks of special infected


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mich8441012
Junior Member
Join Date: May 2023
Old 06-26-2023 , 06:00   [L4D2] Block the attacks of special infected
Reply With Quote #1

Is there a way to completely prevent the attacks of special infected people?
such as jockey's ride or being thrown down by the hunter?

Last edited by mich8441012; 06-26-2023 at 10:03.
mich8441012 is offline
sorallll
Senior Member
Join Date: Oct 2018
Old 06-26-2023 , 07:20   Re: [L4D2] Block the attacks of special infected
Reply With Quote #2

PHP Code:
#include <left4dhooks>

public Action L4D_OnGrabWithTongue(int victimint attacker) {
    return 
Plugin_Handled;
}

public 
Action L4D_OnPouncedOnSurvivor(int victimint attacker) {
    return 
Plugin_Handled;
}

public 
Action L4D2_OnJockeyRide(int victimint attacker) {
    return 
Plugin_Handled;
}

public 
Action L4D2_OnStartCarryingVictim(int victimint attacker) {
    return 
Plugin_Handled;
}

public 
Action L4D2_OnPummelVictim(int attackerint victim) {
    
// from "left4dhooks_test.sp"
    
DataPack pack = new DataPack();
    
RequestFrame(OnPummelTeleportpack);
    
pack.WriteCell(GetClientUserId(victim));
    
pack.WriteCell(GetClientUserId(attacker));

    
// To block the stumble animation, uncomment and use the following 2 lines:
    
AnimHookEnable(victimOnPummelOnAnimPreINVALID_FUNCTION);
    
CreateTimer(0.3Timer_OnPummelResetAnimGetClientUserId(victim));

    return 
Plugin_Handled;
}

// To fix getting stuck use this:
void OnPummelTeleport(DataPack pack) {
    
pack.Reset();
    
int victim pack.ReadCell();
    
int attacker pack.ReadCell();
    
delete pack;

    
victim GetClientOfUserId(victim);
    if (!
victim || !IsClientInGame(victim))
        return;

    
attacker GetClientOfUserId(attacker);
    if (!
attacker || !IsClientInGame(attacker))
        return;

    
SetVariantString("!activator");
    
AcceptEntityInput(victim"SetParent"attacker);
    
TeleportEntity(victimview_as<float>({50.00.00.0}), NULL_VECTORNULL_VECTOR);
    
AcceptEntityInput(victim"ClearParent");
}

// To block the stumble animation use the next two functions:
Action OnPummelOnAnimPre(int clientint &anim) {
    if (
anim == L4D2_ACT_TERROR_SLAMMED_WALL || anim == L4D2_ACT_TERROR_SLAMMED_GROUND) {
        
anim L4D2_ACT_STAND;
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;
}

Action Timer_OnPummelResetAnim(Handle timerint client) {
    if ((
client GetClientOfUserId(client)))
        
AnimHookDisable(clientOnPummelOnAnimPre);

    return 
Plugin_Continue;

sorallll is offline
mich8441012
Junior Member
Join Date: May 2023
Old 06-26-2023 , 10:03   Re: [L4D2] Block the attacks of special infected
Reply With Quote #3

Quote:
Originally Posted by sorallll View Post
PHP Code:
#include <left4dhooks>

public Action L4D_OnGrabWithTongue(int victimint attacker) {
    return 
Plugin_Handled;
}

public 
Action L4D_OnPouncedOnSurvivor(int victimint attacker) {
    return 
Plugin_Handled;
}

public 
Action L4D2_OnJockeyRide(int victimint attacker) {
    return 
Plugin_Handled;
}

public 
Action L4D2_OnStartCarryingVictim(int victimint attacker) {
    return 
Plugin_Handled;
}

public 
Action L4D2_OnPummelVictim(int attackerint victim) {
    
// from "left4dhooks_test.sp"
    
DataPack pack = new DataPack();
    
RequestFrame(OnPummelTeleportpack);
    
pack.WriteCell(GetClientUserId(victim));
    
pack.WriteCell(GetClientUserId(attacker));

    
// To block the stumble animation, uncomment and use the following 2 lines:
    
AnimHookEnable(victimOnPummelOnAnimPreINVALID_FUNCTION);
    
CreateTimer(0.3Timer_OnPummelResetAnimGetClientUserId(victim));

    return 
Plugin_Handled;
}

// To fix getting stuck use this:
void OnPummelTeleport(DataPack pack) {
    
pack.Reset();
    
int victim pack.ReadCell();
    
int attacker pack.ReadCell();
    
delete pack;

    
victim GetClientOfUserId(victim);
    if (!
victim || !IsClientInGame(victim))
        return;

    
attacker GetClientOfUserId(attacker);
    if (!
attacker || !IsClientInGame(attacker))
        return;

    
SetVariantString("!activator");
    
AcceptEntityInput(victim"SetParent"attacker);
    
TeleportEntity(victimview_as<float>({50.00.00.0}), NULL_VECTORNULL_VECTOR);
    
AcceptEntityInput(victim"ClearParent");
}

// To block the stumble animation use the next two functions:
Action OnPummelOnAnimPre(int clientint &anim) {
    if (
anim == L4D2_ACT_TERROR_SLAMMED_WALL || anim == L4D2_ACT_TERROR_SLAMMED_GROUND) {
        
anim L4D2_ACT_STAND;
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;
}

Action Timer_OnPummelResetAnim(Handle timerint client) {
    if ((
client GetClientOfUserId(client)))
        
AnimHookDisable(clientOnPummelOnAnimPre);

    return 
Plugin_Continue;

thank you so much!
mich8441012 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode