Raised This Month: $32 Target: $400
 8% 

[L4D2] Oshroth's Backpack


Post New Thread Reply   
 
Thread Tools Display Modes
jking
AlliedModders Donor
Join Date: Jan 2012
Old 08-19-2018 , 12:12   Re: [L4D2] Oshroth's Backpack
Reply With Quote #41

Quote:
Originally Posted by MasterMind420 View Post
ok when u said pack i assumed upgrade pack not the actual backpack. Also i'm not even sure why the backpack is dropping....deathdrop cvar only effects actual items dropping when a player dies not there backpack models...I did experiment with dropping the backpack and allowing players to pick them back up but i thought i disabled the code. i'd recommend not using the backpack model until i update the plugin for now...that shouldn't be happening.
Ok, tested w/o Gear Transfer, it appears from the video she has another after revive, you just don't see it until she's killed again...

video
jking is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 08-19-2018 , 12:29   Re: [L4D2] Oshroth's Backpack
Reply With Quote #42

Quote:
Originally Posted by jking View Post
Ok, tested w/o Gear Transfer, it appears from the video she has another after revive, you just don't see it until she's killed again...

video
Yah it shouldnt be dropping the backpack...im fixing a massive amount code within backpack for the official 1.0 release...just disable the backpack model in the config for now if u dont want to see that...
MasterMind420 is offline
jking
AlliedModders Donor
Join Date: Jan 2012
Old 08-19-2018 , 12:35   Re: [L4D2] Oshroth's Backpack
Reply With Quote #43

Quote:
Originally Posted by MasterMind420 View Post
Yah it shouldnt be dropping the backpack...im fixing a massive amount code within backpack for the official 1.0 release...just disable the backpack model in the config for now if u dont want to see that...
Nice and thanks for your continued work , nah I'm fine I just thought I'd point this out since you're in the midst of an update, not sure if anyone else had noticed.
jking is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-09-2018 , 02:16   Re: [L4D2] Oshroth's Backpack
Reply With Quote #44

This is a good plugin, but it has a ton of bugs. One big thing that it really needs is that there has to be a limit based on the slot. The way it is right now a player can carry 6 throwables, 2 medpacks, 2 defibs, 2 explosive ammo packs, 2 fire ammo packs, 2 sets of pills and 2 adrenaline shots.

That becomes a little too much. Maybe remove the limit based on the item and add a limit based on the slot number.
__________________
Spirit_12 is offline
grimxxl
Member
Join Date: Dec 2012
Old 09-09-2018 , 05:41   Re: [L4D2] Oshroth's Backpack
Reply With Quote #45

Quote:
Originally Posted by Spirit_12 View Post
This is a good plugin, but it has a ton of bugs. One big thing that it really needs is that there has to be a limit based on the slot. The way it is right now a player can carry 6 throwables, 2 medpacks, 2 defibs, 2 explosive ammo packs, 2 fire ammo packs, 2 sets of pills and 2 adrenaline shots.

That becomes a little too much. Maybe remove the limit based on the item and add a limit based on the slot number.
Or you could use the .cfg file, to limit those items you don't want them to pick up as many of.
grimxxl is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 09-09-2018 , 10:24   Re: [L4D2] Oshroth's Backpack
Reply With Quote #46

I am currently close to fixing all the bugs in backpack, most bugs were due to a rushed release and as i originally posted consider it a beta version. The quantity system as of right now works quite well. You can completely prevent people from using specific items completely if you want when its set to zero for a specific item. On my server I allow one of every item except for pills and adrenaline, players can carry two of each of them, 1 of each bomb type as well. It definitely helps using a loot plugin with this. I used to play with two of each bomb but decided to limit it to 1 of each for the same reasons spirit12 mentions. People overkilling with the bombs. I've been considering for awhile to add slot quantities as well. I won't remove the current system however because it still has its uses. I'm hoping to be finished up with my testing on the current version within the next week or two for release. I'm currently working on several of my plugins, along with this one Pistol Reloading will be getting a much needed update, Ammo display...Better ammo and clip tracking for pistols, many bug fixes in that as well.

Last edited by MasterMind420; 09-09-2018 at 10:28.
MasterMind420 is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-09-2018 , 13:32   Re: [L4D2] Oshroth's Backpack
Reply With Quote #47

Quote:
Originally Posted by grimxxl View Post
Or you could use the .cfg file, to limit those items you don't want them to pick up as many of.
Won’t work! Let me present you a scenario where it will fail.

Player has the ability to pickup 2 of each slot. He finds 2 sets of pills, but considering he can only pickup one based on config limits him. If we have a limit based on slot count, then it’s upto the player to pickup 2 of same item or 2 different items based on situation.
__________________
Spirit_12 is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-20-2018 , 23:52   Re: [L4D2] Oshroth's Backpack
Reply With Quote #48

Here are some forwards that I made by poking around the binary.

You can use l4d2_OnChangeActiveWeapon to push the backpack item to the front and l4d2_OnWeaponEquip to detect switch between items in the backpack. They worked nicely for me, but I haven't had time to do detailed testing. See if you can find a use for them.

Note: Only Linux support for now as searching functions in windows can be time consuming. Support form windows will be added in the future.

FORWARDS

PHP Code:
/**
 * @brief Called when player switches active weapon
 *
 * @param client    Player index
 * @param weapon    Weapon index
 * @param weapon    Weapon name
 */
forward void l4d2_OnChangeActiveWeapon(const int client, const int weaponchar[] name);

/**
 * @brief Called when player equips/picks up a weapon
 *
 * @param client    Player index
 * @param weapon    Weapon index
 * @param weapon    Weapon name
 */
forward void l4d2_OnWeaponEquip(const int client, const int weaponchar[] name); 
PLUGIN CODE
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <dhooks>

#define GAMEDATA            "l4d2_backpack"
#define PLUGIN_VERSION         "1.0"
#define CHAT_TAG            "\x04[\x05Backpack Forwards\x04] \x01"

// Setup Forward Handles
Handle g_ActiveWeapon_Forward;
Handle g_WeaponEquip_Forward;

public 
Plugin myinfo =
{
    
name "Backpack Forwards",
    
author "$atanic $pirit",
    
description "Provides forwards for backpack",
    
version PLUGIN_VERSION,
    
url ""
}

public 
void OnPluginStart()
{
    
Handle hGameData LoadGameConfigFile(GAMEDATA);
    if( 
hGameData == null 
        
SetFailState("Failed to load \"%s.txt\" gamedata."GAMEDATA);
    
    
// ====================================================================================================
    // Detour Setup - CBaseCombatCharacter::OnChangeActiveWeapon
    // ====================================================================================================
        
    // Create a hook from config.
    
Handle hDetour_OnChangeActiveWeapon DHookCreateFromConf(hGameData"CBaseCombatCharacter::OnChangeActiveWeapon");
    if( !
hDetour_OnChangeActiveWeapon )
        
SetFailState("Failed to setup detour for CBaseCombatCharacter::OnChangeActiveWeapon");
    
    
// Add a post hook on the function.
    
if (!DHookEnableDetour(hDetour_OnChangeActiveWeaponfalseDetour_OnChangeActiveWeapon))
        
SetFailState("Failed to detour OnChangeActiveWeapon.");

    
// ====================================================================================================
    // Detour Setup - CBaseCombatWeapon::Weapon_Equip
    // ====================================================================================================
    
        // Create a hook from config.
    
Handle hDetour_Weapon_Equip DHookCreateFromConf(hGameData"CBaseCombatCharacter::Weapon_Equip");
    if( !
hDetour_Weapon_Equip )
        
SetFailState("Failed to setup detour for CBaseCombatCharacter::Weapon_Equip");
    
    
// Add a post hook on the function.
    
if (!DHookEnableDetour(hDetour_Weapon_EquipfalseDetour_Weapon_Equip))
        
SetFailState("Failed to detour Weapon_Equip.");
        
    
// ====================================================================================================
    // Forwards Setup
    // ====================================================================================================
    
g_ActiveWeapon_Forward    CreateGlobalForward("OnChangeActiveWeapon"ET_IgnoreParam_CellParam_CellParam_String);
    
g_WeaponEquip_Forward    CreateGlobalForward("OnWeaponEquip"ET_IgnoreParam_CellParam_CellParam_String);
}

// ====================================================================================================
// Function    -    CBaseCombatCharacter::OnChangeActiveWeapon
// ====================================================================================================

public MRESReturn Detour_OnChangeActiveWeapon(Address pThisHandle hParams)
{    
    
// Get the Int value
    
int    client            view_as<int>(pThis);
    
int  weapon        DHookGetParam(hParams1);
    
char name[20];
    
name GetEntityName(weapon);
    
    
/* Start function call */
    
Call_StartForward(g_ActiveWeapon_Forward);

    
/* Push parameters one at a time */
    
Call_PushCell(client);
    
Call_PushCell(weapon);
    
Call_PushString(name);

    
/* Finish the call, get the result */
    
Call_Finish();
    
    
PrintToChatAll("%s OnChangeActiveWeapon - Player Name: %N, Weapon Name: %s"CHAT_TAGclientGetEntityName(weapon));
    return 
MRES_Ignored;
}

// ====================================================================================================
// Function    -    CBaseCombatCharacter::Weapon_Equip
// ====================================================================================================

public MRESReturn Detour_Weapon_Equip(Address pThisHandle hParams)
{    
    
// Get the Int value
    
int  client        view_as<int>(pThis);
    
int  weapon        DHookGetParam(hParams1);
    
char name[20];
    
name GetEntityName(weapon);
    
    
/* Start function call */
    
Call_StartForward(g_WeaponEquip_Forward);

    
/* Push parameters one at a time */
    
Call_PushCell(client);
    
Call_PushCell(weapon);
    
Call_PushString(name);

    
/* Finish the call, get the result */
    
Call_Finish();
    
    
PrintToChatAll("%s Weapon_Equip - Player Name: %N, Weapon Name: %s."CHAT_TAGclientGetEntityName(weapon));
    return 
MRES_Ignored;
}

// ====================================================================================================
// GetEntityName    -    Stock to get weapon's name
// ====================================================================================================

stock char GetEntityName(int entity)
{
    
char name[20];
    
GetEntityClassname(entitynamesizeof name);
    
    if(
StrEqual(name"weapon_melee"))
    {
        
GetEntPropString(entityProp_Data"m_strMapSetScriptName"namesizeof name);
    }
    return 
name;

GAMEDATA
PHP Code:
"Games"
{/*
  * CBaseCombatCharacter::OnChangeActiveWeapon    (client, weapon)
  * CBaseCombatCharacter::Weapon_Equip            (client, weapon)
  */
    
"left4dead2"
    
{
        
"Functions"
        
{
            
"CBaseCombatCharacter::OnChangeActiveWeapon"
            
{
                
"signature"  "CBaseCombatCharacter::OnChangeActiveWeapon"
                "callconv"  "thiscall"
                "return"  "void"
                "this"  "entity"
                "arguments"
                
{
                    
"weapon"
                    
{
                        
"type"    "cbaseentity"
                    
}
                }
            }
            
"CBaseCombatCharacter::Weapon_Equip"
            
{
                
"signature"  "CBaseCombatCharacter::Weapon_Equip"
                "callconv"  "thiscall"
                "return"  "void"
                "this"  "entity"
                "arguments"
                
{
                    
"weapon"
                    
{
                        
"type"    "cbaseentity"
                    
}
                }
            }
        }
        
"Signatures"
        
{
            
"CBaseCombatCharacter::OnChangeActiveWeapon"
            
{
                
"library"  "server"
                "linux"    "@_ZN20CBaseCombatCharacter20OnChangeActiveWeaponEP17CBaseCombatWeaponS1_"
            
}
            
"CBaseCombatCharacter::Weapon_Equip"
            
{
                
"library"  "server"
                "linux"    "@_ZN20CBaseCombatCharacter12Weapon_EquipEP17CBaseCombatWeapon"
            
}
        }
    }

Attached Files
File Type: txt l4d2_backpack.txt (1.3 KB, 120 views)
File Type: sp Get Plugin or Get Source (Backpack-forwards.sp - 112 views - 4.8 KB)
__________________
Spirit_12 is offline
Captain Stubin
Member
Join Date: Jun 2017
Old 12-10-2018 , 04:04   Re: [L4D2] Oshroth's Backpack
Reply With Quote #49

Quote:
Originally Posted by Spirit_12 View Post
Here are some forwards that I made by poking around the binary.

You can use l4d2_OnChangeActiveWeapon to push the backpack item to the front and l4d2_OnWeaponEquip to detect switch between items in the backpack. They worked nicely for me, but I haven't had time to do detailed testing. See if you can find a use for them.

Note: Only Linux support for now as searching functions in windows can be time consuming. Support form windows will be added in the future.

FORWARDS

PHP Code:
/**
 * @brief Called when player switches active weapon
 *
 * @param client    Player index
 * @param weapon    Weapon index
 * @param weapon    Weapon name
 */
forward void l4d2_OnChangeActiveWeapon(const int client, const int weaponchar[] name);

/**
 * @brief Called when player equips/picks up a weapon
 *
 * @param client    Player index
 * @param weapon    Weapon index
 * @param weapon    Weapon name
 */
forward void l4d2_OnWeaponEquip(const int client, const int weaponchar[] name); 
PLUGIN CODE
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <dhooks>

#define GAMEDATA            "l4d2_backpack"
#define PLUGIN_VERSION         "1.0"
#define CHAT_TAG            "\x04[\x05Backpack Forwards\x04] \x01"

// Setup Forward Handles
Handle g_ActiveWeapon_Forward;
Handle g_WeaponEquip_Forward;

public 
Plugin myinfo =
{
    
name "Backpack Forwards",
    
author "$atanic $pirit",
    
description "Provides forwards for backpack",
    
version PLUGIN_VERSION,
    
url ""
}

public 
void OnPluginStart()
{
    
Handle hGameData LoadGameConfigFile(GAMEDATA);
    if( 
hGameData == null 
        
SetFailState("Failed to load \"%s.txt\" gamedata."GAMEDATA);
    
    
// ====================================================================================================
    // Detour Setup - CBaseCombatCharacter::OnChangeActiveWeapon
    // ====================================================================================================
        
    // Create a hook from config.
    
Handle hDetour_OnChangeActiveWeapon DHookCreateFromConf(hGameData"CBaseCombatCharacter::OnChangeActiveWeapon");
    if( !
hDetour_OnChangeActiveWeapon )
        
SetFailState("Failed to setup detour for CBaseCombatCharacter::OnChangeActiveWeapon");
    
    
// Add a post hook on the function.
    
if (!DHookEnableDetour(hDetour_OnChangeActiveWeaponfalseDetour_OnChangeActiveWeapon))
        
SetFailState("Failed to detour OnChangeActiveWeapon.");

    
// ====================================================================================================
    // Detour Setup - CBaseCombatWeapon::Weapon_Equip
    // ====================================================================================================
    
        // Create a hook from config.
    
Handle hDetour_Weapon_Equip DHookCreateFromConf(hGameData"CBaseCombatCharacter::Weapon_Equip");
    if( !
hDetour_Weapon_Equip )
        
SetFailState("Failed to setup detour for CBaseCombatCharacter::Weapon_Equip");
    
    
// Add a post hook on the function.
    
if (!DHookEnableDetour(hDetour_Weapon_EquipfalseDetour_Weapon_Equip))
        
SetFailState("Failed to detour Weapon_Equip.");
        
    
// ====================================================================================================
    // Forwards Setup
    // ====================================================================================================
    
g_ActiveWeapon_Forward    CreateGlobalForward("OnChangeActiveWeapon"ET_IgnoreParam_CellParam_CellParam_String);
    
g_WeaponEquip_Forward    CreateGlobalForward("OnWeaponEquip"ET_IgnoreParam_CellParam_CellParam_String);
}

// ====================================================================================================
// Function    -    CBaseCombatCharacter::OnChangeActiveWeapon
// ====================================================================================================

public MRESReturn Detour_OnChangeActiveWeapon(Address pThisHandle hParams)
{    
    
// Get the Int value
    
int    client            view_as<int>(pThis);
    
int  weapon        DHookGetParam(hParams1);
    
char name[20];
    
name GetEntityName(weapon);
    
    
/* Start function call */
    
Call_StartForward(g_ActiveWeapon_Forward);

    
/* Push parameters one at a time */
    
Call_PushCell(client);
    
Call_PushCell(weapon);
    
Call_PushString(name);

    
/* Finish the call, get the result */
    
Call_Finish();
    
    
PrintToChatAll("%s OnChangeActiveWeapon - Player Name: %N, Weapon Name: %s"CHAT_TAGclientGetEntityName(weapon));
    return 
MRES_Ignored;
}

// ====================================================================================================
// Function    -    CBaseCombatCharacter::Weapon_Equip
// ====================================================================================================

public MRESReturn Detour_Weapon_Equip(Address pThisHandle hParams)
{    
    
// Get the Int value
    
int  client        view_as<int>(pThis);
    
int  weapon        DHookGetParam(hParams1);
    
char name[20];
    
name GetEntityName(weapon);
    
    
/* Start function call */
    
Call_StartForward(g_WeaponEquip_Forward);

    
/* Push parameters one at a time */
    
Call_PushCell(client);
    
Call_PushCell(weapon);
    
Call_PushString(name);

    
/* Finish the call, get the result */
    
Call_Finish();
    
    
PrintToChatAll("%s Weapon_Equip - Player Name: %N, Weapon Name: %s."CHAT_TAGclientGetEntityName(weapon));
    return 
MRES_Ignored;
}

// ====================================================================================================
// GetEntityName    -    Stock to get weapon's name
// ====================================================================================================

stock char GetEntityName(int entity)
{
    
char name[20];
    
GetEntityClassname(entitynamesizeof name);
    
    if(
StrEqual(name"weapon_melee"))
    {
        
GetEntPropString(entityProp_Data"m_strMapSetScriptName"namesizeof name);
    }
    return 
name;

GAMEDATA
PHP Code:
"Games"
{/*
  * CBaseCombatCharacter::OnChangeActiveWeapon    (client, weapon)
  * CBaseCombatCharacter::Weapon_Equip            (client, weapon)
  */
    
"left4dead2"
    
{
        
"Functions"
        
{
            
"CBaseCombatCharacter::OnChangeActiveWeapon"
            
{
                
"signature"  "CBaseCombatCharacter::OnChangeActiveWeapon"
                "callconv"  "thiscall"
                "return"  "void"
                "this"  "entity"
                "arguments"
                
{
                    
"weapon"
                    
{
                        
"type"    "cbaseentity"
                    
}
                }
            }
            
"CBaseCombatCharacter::Weapon_Equip"
            
{
                
"signature"  "CBaseCombatCharacter::Weapon_Equip"
                "callconv"  "thiscall"
                "return"  "void"
                "this"  "entity"
                "arguments"
                
{
                    
"weapon"
                    
{
                        
"type"    "cbaseentity"
                    
}
                }
            }
        }
        
"Signatures"
        
{
            
"CBaseCombatCharacter::OnChangeActiveWeapon"
            
{
                
"library"  "server"
                "linux"    "@_ZN20CBaseCombatCharacter20OnChangeActiveWeaponEP17CBaseCombatWeaponS1_"
            
}
            
"CBaseCombatCharacter::Weapon_Equip"
            
{
                
"library"  "server"
                "linux"    "@_ZN20CBaseCombatCharacter12Weapon_EquipEP17CBaseCombatWeapon"
            
}
        }
    }

Hello compile the file. Plugin failed to compile! Please try contacting the author.
Captain Stubin is offline
Captain Stubin
Member
Join Date: Jun 2017
Old 12-10-2018 , 06:09   Re: [L4D2] Oshroth's Backpack
Reply With Quote #50

Bug when you die backpack on the back no
Captain Stubin is offline
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 22:58.


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