AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [L4D/L4D2] Left 4 Dead (2) Include File (Last Updated: 04/21/2019) (https://forums.alliedmods.net/showthread.php?t=303716)

Drixevel 12-18-2017 14:39

[L4D/L4D2] Left 4 Dead (2) Include File (Last Updated: 04/21/2019)
 
An include file for the Left 4 Dead games, similar to how cstrike is for CSS and CSGO, tf2/tf2_stocks is for TF2, etc.

There's separate functions for survivor and infected indexes due to how indexes are different for both games.

Moved to the Sourcemod-Misc info around 04/21/2019.

Download | Github | Donate

Drixevel 04-21-2019 21:09

Re: [L4D/L4D2] Left 4 Dead (2) Include File (Last Updated: 04/21/2019)
 
Updated and moved to the Sourcemod-Resources repository on Github.

Dragokas 08-02-2019 12:20

Re: [L4D/L4D2] Left 4 Dead (2) Include File (Last Updated: 04/21/2019)
 
Thank you!

Can you please describe more, what does that mean?

PHP Code:

/**
 * Checks if the survivor is capped.
 *
 * @param client    Players index.
 * @return            True if the player is capped, false otherwise.
 */
stock bool L4D_IsPlayerCapped(int client)
{
    
int survivorProps[4] = { 13284160081612815976 };
    
    for (
int i 0sizeof(survivorProps); i++)
    {
        if (
IsClientInGame(GetEntDataEnt2(survivorsurvivorProps[i])))
            return 
true;
    }
    
    return 
false;



Lux 08-03-2019 16:32

Re: [L4D/L4D2] Left 4 Dead (2) Include File (Last Updated: 04/21/2019)
 
Quote:

Originally Posted by Dragokas (Post 2661555)
Thank you!

Can you please describe more, what does that mean?

PHP Code:

/**
 * Checks if the survivor is capped.
 *
 * @param client    Players index.
 * @return            True if the player is capped, false otherwise.
 */
stock bool L4D_IsPlayerCapped(int client)
{
    
int survivorProps[4] = { 13284160081612815976 };
    
    for (
int i 0sizeof(survivorProps); i++)
    {
        if (
IsClientInGame(GetEntDataEnt2(survivorsurvivorProps[i])))
            return 
true;
    }
    
    return 
false;



It reads if they are being dominated by specials e.g. smoked charged jockeyed and pounded.

You should just get the offsets and cache them in a static when called because the offsets could change altho it would be very rare for l4d but still a better habbit or just use GetEntPropEnt as that uses a hashmap iirc.

How I do it much more understanding.
https://github.com/LuxLuma/Luxs-Mode...t.sp#L158-L165


The carry attacker is not included in his bool i think it should.
PHP Code:

stock bool L4D_IsPlayerCapped(int client)
{
    if(
GetEntPropEnt(clientProp_Send"m_pummelAttacker") > 0)
        return 
true;
    if(
GetEntPropEnt(clientProp_Send"m_carryAttacker") > 0)
        return 
true;
    if(
GetEntPropEnt(clientProp_Send"m_pounceAttacker") > 0)
        return 
true;
    if(
GetEntPropEnt(clientProp_Send"m_jockeyAttacker") > 0)
        return 
true;
    if(
GetEntPropEnt(clientProp_Send"m_tongueOwner") > 0)
        return 
true;
    
    return 
false;


less jnz's?
PHP Code:

stock bool L4D_IsPlayerCapped(int client)
{
    if(
GetEntPropEnt(clientProp_Send"m_pummelAttacker") > || 
        
GetEntPropEnt(clientProp_Send"m_carryAttacker") > || 
        
GetEntPropEnt(clientProp_Send"m_pounceAttacker") > || 
        
GetEntPropEnt(clientProp_Send"m_jockeyAttacker") > || 
        
GetEntPropEnt(clientProp_Send"m_pounceAttacker") > ||
        
GetEntPropEnt(clientProp_Send"m_tongueOwner") > 0)
        return 
true;
    return 
false;



Dragokas 08-03-2019 16:38

Re: [L4D/L4D2] Left 4 Dead (2) Include File (Last Updated: 04/21/2019)
 
Ahh, understand, thank you.

Drixevel 08-25-2019 14:14

Re: [L4D/L4D2] Left 4 Dead (2) Include File (Last Updated: 04/21/2019)
 
Pushed a change to the l4d.inc file to change the method used to detect if you're capped by Lux.


All times are GMT -4. The time now is 11:52.

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