Raised This Month: $ Target: $400
 0% 

Solved [L4D2] Killing Special Infected Will Boost Your Speed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alasfourom
Senior Member
Join Date: Feb 2022
Old 06-13-2022 , 05:01   [L4D2] Killing Special Infected Will Boost Your Speed
Reply With Quote #1

Hello Everyone


I was trying to make a plugin by holding shift button, your speed will be boosted, but since shift is meant to slower your speed, the movement was awkward


So, I made a different idea, which is by killing special infected your speed will be boosted for a while then reset


Its kinda still has the same concept of the HEV Suit in Half Life, I tried to make it in a way as if you are wearing the suit and killing the special infected will give you the fuel for it






Features:
- Killing SI Will Boost Your Speed For a Period of Time
- You Can Adjust Your Speed, and Duration



To Do:
- Adding more abilities to the suit > Adjustable (Jump Velocity, Fast Shooting, Fast Reloading, Fast Reviving, Adding +HP After Each kill)
- Cumulative Effect > Ex: Killing 1 SI will give you boost duration for 5 sec, while killing 3 infected at same time will give you 5+5+5 boost duration > I have no idea how to do it



PHP Code:
// This file was auto-generated by SourceMod (v1.11.0.6884)
// ConVars for plugin "L4D2_Hazard_Suit.smx"


// Enable/Disable The Hazard Suit Plugin [ 0 = Disable - 1 = Enable ]
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
l4d2_survivor_boost_allowed "1"

// Set the maximum survivor boost speed [ Normal Game Value = 1 ]
// -
// Default: "1.45"
// Minimum: "0.000000"
// Maximum: "2.000000"
l4d2_survivor_boost_speed "1.45"

//  Set the survivor boost speed duration
// -
// Default: "6.0"
l4d2_survivor_boost_duration "6.0" 
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sdktools>
#include <sourcemod>

#define PLUGIN_VERSION "1.0"
#define TEAM_SURVIVOR 2
#define TEAM_INFECTED 3

Handle SurvivorBoostAllowed INVALID_HANDLE;
Handle SurvivorSpeed INVALID_HANDLE;
Handle BoostDuration INVALID_HANDLE;

public 
Plugin myinfo 
{
    
name "L4D2 Survivor Booster",
    
author "alasfourom",
    
description "Boosting Survivors Speed When Killing Special Infected For Specific Duration",
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/"
}

public 
void OnPluginStart()
{
    
CreateConVar ("l4d2_hazard_suit_version"PLUGIN_VERSION"L4D2 Hazard Suit" ,FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
SurvivorBoostAllowed CreateConVar ("l4d2_survivor_boost_allowed""1""Enable/Disable The Hazard Suit Plugin [ 0 = Disable - 1 = Enable ]" ,FCVAR_NOTIFYtrue0.0true1.0);
    
SurvivorSpeed CreateConVar ("l4d2_survivor_boost_speed""1.45""Set the maximum survivor boost speed [ Normal Game Value = 1 ]" ,FCVAR_NOTIFYtrue0.0true2.0);
    
BoostDuration CreateConVar("l4d2_survivor_boost_duration""6.0""Set the survivor boost speed duration" ,FCVAR_NOTIFY);
    
AutoExecConfig (true"L4D2_Hazard_Suit");

    
HookEvent("player_death"Event_InfectedDeath);
}

public 
void Event_InfectedDeath (Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId (event.GetInt("userid")); if (IsClient (victim))
    {
        
int team GetClientTeam (victim); if (team == TEAM_INFECTED) if (GetConVarBool(SurvivorBoostAllowed))
        {
            
int attacker GetClientOfUserId (event.GetInt("attacker")); if (IsValidClient (attackerTEAM_SURVIVOR))
            if (!
IsFakeClient (attacker)) StartClientEngine (attackerGetConVarFloat(SurvivorSpeed));
            
CreateTimer (GetConVarFloat(BoostDuration), StopClientEngineattacker);
        }
    }
    return;
}

stock bool IsClient (int client)
{
    return 
client && client <= MaxClients && IsClientInGame (client);
}

stock bool IsValidClient(int clientint team)
{
    return 
client && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == team;
}

stock int StartClientEngine (int clientfloat ammount)
{
    
SetEntPropFloat (clientProp_Data"m_flLaggedMovementValue"ammount);
    
PrintHintText(client"Your Suit Engine Started");
    return 
true;
}
 
public 
Action StopClientEngine (Handle timerany client)
{
    
SetEntPropFloat (clientProp_Data"m_flLaggedMovementValue"1.0);
    
PrintHintText(client"Your Suit Engine Stopped");
    return 
Plugin_Handled;


Last edited by Sillium; 07-20-2022 at 14:20. Reason: Restore to previous version.
alasfourom is offline
alasfourom
Senior Member
Join Date: Feb 2022
Old 07-04-2022 , 21:52   Re: [L4D2] Speed Booster
Reply With Quote #2

Quote:
Issue:
- Need to disable plugin when special infected are using their abilities (Chargers, Smokers, Jockeys, Hunters)
- When boosting speed, movements looks awkward > because it fires multiple times
If someone can help me fix these issues I would really appreciate it

Thanks

Last edited by alasfourom; 07-12-2022 at 00:43.
alasfourom is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 07-05-2022 , 11:13   Re: [L4D2] Speed Booster
Reply With Quote #3

For Tank, I used m_flStamina once to detect, but don't know if is the best way to check it.

Example:
PHP Code:
if (GetEntPropFloat(clientProp_Send"m_flStamina") > 0)
// do (or not) something 
__________________
Marttt is offline
alasfourom
Senior Member
Join Date: Feb 2022
Old 07-05-2022 , 14:15   Re: [L4D2] Speed Booster
Reply With Quote #4

Thanks Marttt,

I tried to use HookEvent, because I want to disable it once charging start not necessary when charging a survivor

PHP Code:
    HookEvent ("charger_charge_start"Event_InfectedAbilityStart);
    
HookEvent ("charger_pummel_start"Event_InfectedAbilityStart);
    
HookEvent ("choke_start",     Event_InfectedAbilityStart);
    
HookEvent ("lunge_pounce"Event_InfectedAbilityStart);
    
HookEvent ("jockey_ride"Event_InfectedAbilityStart); 
I'm a bit confused with it, tried many ways but not sure how to make it work.

PHP Code:
public void Event_InfectedAbilityStart (Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId (event.GetInt("userid"));
    if (
client && IsClientInGame(client) && !IsFakeClient(client) && IsInfected(client))
    {
        
Speeding [client] = false;
        
SetEntPropFloat (clientProp_Data"m_flLaggedMovementValue"1.0);
    }
    return;

I tried different ways but still didnt work for me

Last edited by alasfourom; 07-07-2022 at 04:11.
alasfourom is offline
alasfourom
Senior Member
Join Date: Feb 2022
Old 07-08-2022 , 22:46   Re: [L4D2] Speed Booster
Reply With Quote #5

Updated

- You can enable/disable speed boost for each team survivors/infected
- Adjust the speed boost for each team
- Change jump Hight when using speed boost
- Adjust each survivors / infected normal jump height

Last edited by alasfourom; 07-09-2022 at 06:54.
alasfourom is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-12-2022 , 05:51   Re: [L4D2] Issue - Player Booster - Shift Boost Your Speed
Reply With Quote #6

Shekels are good, shekels are nice.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_623.png
Views:	30
Size:	96.6 KB
ID:	195682   Click image for larger version

Name:	Screenshot_624.jpg
Views:	16
Size:	59.6 KB
ID:	195683  
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
alasfourom
Senior Member
Join Date: Feb 2022
Old 07-12-2022 , 12:19   Re: [L4D2] Issue - Player Booster - Shift Boost Your Speed
Reply With Quote #7

The issue was "buttons &= ~IN_SPEED; "

Removed it and its smooth now thanks

Last edited by alasfourom; 07-16-2022 at 15:48.
alasfourom is offline
alasfourom
Senior Member
Join Date: Feb 2022
Old 07-13-2022 , 02:31   Re: [L4D2] Issue - Player Booster - Shift Boost Your Speed
Reply With Quote #8

Updated - Concept The Same

- Now its triggered by killing infected rather than when holding Shift Button
alasfourom is offline
L4D2Noob
AlliedModders Donor
Join Date: Mar 2020
Location: Moscow
Old 07-18-2022 , 18:55   Re: [L4D2] Killing Special Infected Will Boost Your Speed
Reply With Quote #9

PHP Code:
BlamingL4D2_Hazard_Suit.smx
Call stack trace
:
SetEntPropFloat
Line 67
D:\sm111\addons\sourcemod\scripting\L4D2_Hazard_Suit.sp::StopClientEngine 
__________________
L4D2Noob is offline
Send a message via ICQ to L4D2Noob Send a message via Skype™ to L4D2Noob
Reply


Thread Tools
Display Modes

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 14:05.


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