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

[L4D2] Release Infected's Victim Modification / Help Requests


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Darkwob
BANNED
Join Date: Oct 2018
Old 08-13-2020 , 21:34   [L4D2] Release Infected's Victim Modification / Help Requests
Reply With Quote #1

Hello everyone, this plugin does not leave the survivor it attacked in charger, jockey,smoker, Hunter when we press the right button in mouse. What could be the reason for this? and can you improve?

PHP Code:
/* Plugin Template generated by Pawn Studio */

#include <sourcemod>
#include <sdktools>

#define CVAR_FLAGS FCVAR_PLUGIN
#define PLUGIN_VERSION "1.3a"
#define INFECTEDTEAM 3
#define ZOMBIECLASS_SMOKER    1
#define ZOMBIECLASS_BOOMER    2
#define ZOMBIECLASS_HUNTER    3
#define ZOMBIECLASS_SPITTER    4
#define ZOMBIECLASS_JOCKEY    5
#define ZOMBIECLASS_CHARGER    6

new Handle:g_hConVar_JockeyReleaseOn;
new 
Handle:g_hConVar_HunterReleaseOn;
new 
Handle:g_hConVar_ChargerReleaseOn;
new 
Handle:g_hConVar_ChargerChargeInterval;
new 
Handle:g_hConVar_JockeyAttackDelay;
new 
Handle:g_hConVar_HunterAttackDelay;
new 
Handle:g_hConVar_ChargerAttackDelay;
new 
bool:g_isJockeyEnabled;
new 
bool:g_isHunterEnabled;
new 
bool:g_isChargerEnabled;

new 
bool:g_ButtonDelay[MAXPLAYERS+1];

public 
Plugin:myinfo 
{
    
name "[L4D2] Infected Release",
    
author "Thraka",
    
description "Allows infected players to release victims with the melee button.",
    
version PLUGIN_VERSION,
    
url "http://forums.alliedmods.net/showthread.php?t=109715"
}

public 
APLRes:AskPluginLoad2(Handle:hPluginbool:isAfterMapLoadedString:error[], err_max)
{
    
// Require Left 4 Dead 2
    
decl String:game_name[64];
    
GetGameFolderName(game_namesizeof(game_name));
    if (!
StrEqual(game_name"left4dead2"false))
    {
        
Format(errorerr_max"Plugin only supports Left4Dead 2.");
        return 
APLRes_Failure;
    }
    return 
APLRes_Success;
}

public 
OnPluginStart()
{
    
    
CreateConVar("l4d2_infected_release_ver"PLUGIN_VERSION"Version of the infected release plugin."FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY);

    
g_hConVar_JockeyReleaseOn CreateConVar("l4d2_jockey_dismount_on""1""Jockey dismount is on or off. 1 = on"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
g_hConVar_HunterReleaseOn CreateConVar("l4d2_hunter_release_on""1""Hunter release is on or off. 1 = on"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
g_hConVar_ChargerReleaseOn CreateConVar("l4d2_charger_release_on""1""Charger release is on or off. 1 = on"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
g_hConVar_JockeyAttackDelay CreateConVar("l4d2_jockey_attackdelay""3.0""After dismounting with the jockey, how long can the player not use attack1 and attack2"FCVAR_PLUGIN|FCVAR_NOTIFYtrue);
    
g_hConVar_HunterAttackDelay CreateConVar("l4d2_hunter_attackdelay""3.0""After dismounting with the hunter, how long can the player not use attack1 and attack2"FCVAR_PLUGIN|FCVAR_NOTIFYtrue);
    
g_hConVar_ChargerAttackDelay CreateConVar("l4d2_charger_attackdelay""3.0""After dismounting with the charger, how long can the player not use attack1 and attack2"FCVAR_PLUGIN|FCVAR_NOTIFYtrue);
    
    
g_hConVar_ChargerChargeInterval FindConVar("z_charge_interval");
    
    
HookConVarChange(g_hConVar_JockeyReleaseOnCVarChange_JockeyRelease);
    
HookConVarChange(g_hConVar_HunterReleaseOnCVarChange_HunterRelease);
    
HookConVarChange(g_hConVar_ChargerReleaseOnCVarChange_ChargerRelease);
    
    
AutoExecConfig(true"l4d2_infected_release");
    
    
SetJockeyRelease();
    
SetHunterRelease();
    
SetChargerRelease();
}

/*
* ===========================================================================================================
* ===========================================================================================================

* CVAR Change events

* ===========================================================================================================
* ===========================================================================================================
*/

public CVarChange_JockeyRelease(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
SetJockeyRelease();
}

public 
CVarChange_HunterRelease(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
SetHunterRelease();
}

public 
CVarChange_ChargerRelease(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
SetChargerRelease();
}

SetJockeyRelease()
{
    
g_isJockeyEnabled GetConVarInt(g_hConVar_JockeyReleaseOn) == 1;
}

SetHunterRelease()
{
    
g_isHunterEnabled GetConVarInt(g_hConVar_HunterReleaseOn) == 1;
}

SetChargerRelease()
{
    
g_isChargerEnabled GetConVarInt(g_hConVar_ChargerReleaseOn) == 1;
}

/*
* ===========================================================================================================
* ===========================================================================================================

* Normal Hooks\Events

* ===========================================================================================================
* ===========================================================================================================
*/

public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (
client == 0)
        return 
Plugin_Continue;
    
    if (
buttons IN_ATTACK2 && !g_ButtonDelay[client])
    {
        if (
GetClientTeam(client) == INFECTEDTEAM)
        {
            new 
zombieClass GetEntProp(clientProp_Send"m_zombieClass");
            
            if (
zombieClass == ZOMBIECLASS_JOCKEY && g_isJockeyEnabled)
            {
                new 
h_vic GetEntPropEnt(clientProp_Send"m_jockeyVictim");
                
                if (
IsValidEntity(h_vic) && h_vic != 0)
                {
                    
ExecuteCommand(client"dismount");
                    
                    
CreateTimer(GetConVarFloat(g_hConVar_JockeyAttackDelay), ResetDelayclient)
                    
g_ButtonDelay[client] = true;
                }
            }
            else if (
zombieClass == ZOMBIECLASS_HUNTER && g_isHunterEnabled)
            {
                new 
h_vic GetEntPropEnt(clientProp_Send"m_pounceVictim");
                
                if (
IsValidEntity(h_vic) && h_vic != 0)
                {
                    
CallOnPounceEnd(client);

                    
CreateTimer(GetConVarFloat(g_hConVar_HunterAttackDelay), ResetDelayclient)
                    
g_ButtonDelay[client] = true;
                }
            }
            else if (
zombieClass == ZOMBIECLASS_CHARGER && g_isChargerEnabled)
            {
                new 
h_vic GetEntPropEnt(clientProp_Send"m_pummelVictim");
                
                if (
IsValidEntity(h_vic) && h_vic != 0)
                {
                    
CallOnPummelEnded(client);
                    
                    if (
g_hConVar_ChargerChargeInterval != INVALID_HANDLE)
                        
CallResetAbility(clientGetConVarFloat(g_hConVar_ChargerChargeInterval));
                    
                    
CreateTimer(GetConVarFloat(g_hConVar_ChargerAttackDelay), ResetDelayclient)
                    
g_ButtonDelay[client] = true;
                }
            }
        }
    }
    
    
// If delayed, don't let them click
    
if (buttons IN_ATTACK && g_ButtonDelay[client])
    {
        
buttons &= ~IN_ATTACK;
    }
    
    
// If delayed, don't let them click
    
if (buttons IN_ATTACK2 && g_ButtonDelay[client])
    {
        
buttons &= ~IN_ATTACK2;
    }
    
    return 
Plugin_Continue;
}


public 
Action:ResetDelay(Handle:timerany:client)
{
    
g_ButtonDelay[client] = false;
}
/*
* ===========================================================================================================
* ===========================================================================================================

* Private Methods

* ===========================================================================================================
* ===========================================================================================================
*/

ExecuteCommand(ClientString:strCommand[])
{
    new 
flags GetCommandFlags(strCommand);
    
    
SetCommandFlags(strCommandflags & ~FCVAR_CHEAT);
    
FakeClientCommand(Client"%s"strCommand);
    
SetCommandFlags(strCommandflags);
}

CallOnPummelEnded(client)
{
    static 
Handle:hOnPummelEnded=INVALID_HANDLE;
    if (
hOnPummelEnded==INVALID_HANDLE){
        new 
Handle:hConf INVALID_HANDLE;
        
hConf LoadGameConfigFile("l4d2_infected_release");
        
StartPrepSDKCall(SDKCall_Player);
        
PrepSDKCall_SetFromConf(hConfSDKConf_Signature"CTerrorPlayer::OnPummelEnded");
        
PrepSDKCall_AddParameter(SDKType_Bool,SDKPass_Plain);
        
PrepSDKCall_AddParameter(SDKType_CBasePlayer,SDKPass_Pointer,VDECODE_FLAG_ALLOWNULL);
        
hOnPummelEnded EndPrepSDKCall();
        
CloseHandle(hConf);
        if (
hOnPummelEnded == INVALID_HANDLE){
            
SetFailState("Can't get CTerrorPlayer::OnPummelEnded SDKCall!");
            return;
        }            
    }
    
SDKCall(hOnPummelEnded,client,true,-1);
}

CallOnPounceEnd(client)
{
    static 
Handle:hOnPounceEnd=INVALID_HANDLE;
    if (
hOnPounceEnd==INVALID_HANDLE){
        new 
Handle:hConf INVALID_HANDLE;
        
hConf LoadGameConfigFile("l4d2_infected_release");
        
StartPrepSDKCall(SDKCall_Player);
        
PrepSDKCall_SetFromConf(hConfSDKConf_Signature"CTerrorPlayer::OnPounceEnd");
        
hOnPounceEnd EndPrepSDKCall();
        
CloseHandle(hConf);
        if (
hOnPounceEnd == INVALID_HANDLE){
            
SetFailState("Can't get CTerrorPlayer::OnPounceEnd SDKCall!");
            return;
        }            
    }
    
SDKCall(hOnPounceEnd,client);


CallResetAbility(client,Float:time)
{
    static 
Handle:hStartActivationTimer=INVALID_HANDLE;
    if (
hStartActivationTimer==INVALID_HANDLE)
    {
        new 
Handle:hConf INVALID_HANDLE;
        
hConf LoadGameConfigFile("l4d2_infected_release");

        
StartPrepSDKCall(SDKCall_Entity);

        
PrepSDKCall_SetFromConf(hConfSDKConf_Signature"CBaseAbility::StartActivationTimer");
        
PrepSDKCall_AddParameter(SDKType_Float,SDKPass_Plain);
        
PrepSDKCall_AddParameter(SDKType_Float,SDKPass_Plain);

        
hStartActivationTimer EndPrepSDKCall();
        
CloseHandle(hConf);
        
        if (
hStartActivationTimer == INVALID_HANDLE)
        {
            
SetFailState("Can't get CBaseAbility::StartActivationTimer SDKCall!");
            return;
        }            
    }
    new 
AbilityEnt=GetEntPropEnt(clientProp_Send"m_customAbility");
    
SDKCall(hStartActivationTimerAbilityEnttime0.0);

this plugin post
https://forums.alliedmods.net/showthread.php?p=994506
Darkwob is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 08-14-2020 , 05:48   Re: [L4D2] Release Infected's Victim Modification / Help Requests
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?p=2676902
__________________
HarryPotter is offline
Darkwob
BANNED
Join Date: Oct 2018
Old 08-15-2020 , 11:35   Re: [L4D2] Release Infected's Victim Modification / Help Requests
Reply With Quote #3

Quote:
Originally Posted by fbef0102 View Post
I encounter an error when downloading and when I want to compile it, it encounters an error in the code.
Darkwob is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 08-15-2020 , 11:45   Re: [L4D2] Release Infected's Victim Modification / Help Requests
Reply With Quote #4

Need dhooks
https://forums.alliedmods.net/showpo...&postcount=589
__________________

Last edited by HarryPotter; 08-15-2020 at 12:42.
HarryPotter 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:45.


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