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

[L4D/2] Incapped Pickup Items (1.4.0)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
xZk
Senior Member
Join Date: Nov 2017
Location: cl
Plugin ID:
6890
Plugin Version:
1.4
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    3 
    Plugin Description:
    incapped survivors can pickup items and weapons
    Old 01-11-2020 , 12:28   [L4D/2] Incapped Pickup Items (1.4.0)
    Reply With Quote #1

    Details
    Survivors can pick up weapons or items while incapped, by pressing the E key (IN_USE)

    Cvars:
    PHP Code:
    // 0:Disable, 1:Enable plugin
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_incapped_pickup "1"

    // Use pickup distance limit (player_use_radius = 96) 
    // -
    // Default: "96.0"
    // Minimum: "1.000000"
    l4d_incapped_pickup_distance "96.0"

    // 0:Disable pickup scavenge items, 1:Allow pickup gascans, 2: Allow pickup colas, 3:All
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "3.000000"
    l4d_incapped_pickup_scavenge "0"

    // 0:Disable, 1:Allow pickup carryable items (gnome, propanetank, etc)
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    l4d_incapped_pickup_carryable "0" 
    Special Thanks


    Rant:
    -put l4d2_incapped_pickup.txt in /addons/sourcemod/gamedata/ folder


    Changelog
    Spoiler
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d_incapped_pickup.sp - 1418 views - 10.2 KB)

    Last edited by xZk; 12-12-2021 at 19:07. Reason: v1.4
    xZk is offline
    KRUTIK
    Senior Member
    Join Date: Feb 2019
    Location: Мос
    Old 01-11-2020 , 14:42   Re: [L4D/2]Incapped Pickup Items
    Reply With Quote #2

    You have a line 87, a link to the site, is this how it should be?
    KRUTIK is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 01-11-2020 , 14:52   Re: [L4D/2]Incapped Pickup Items
    Reply With Quote #3

    Quote:
    Originally Posted by KRUTIK View Post
    You have a line 87, a link to the site, is this how it should be?
    Yes? Credit for source and info.
    __________________
    Silvers is offline
    KRUTIK
    Senior Member
    Join Date: Feb 2019
    Location: Мос
    Old 01-11-2020 , 15:37   Re: [L4D/2]Incapped Pickup Items
    Reply With Quote #4

    I checked on my server, there are no errors yet.
    KRUTIK is offline
    MasterMind420
    BANNED
    Join Date: Nov 2010
    Old 01-19-2020 , 10:05   Re: [L4D/2]Incapped Pickup Items
    Reply With Quote #5

    stock void SetActiveWeapon(int client, int weapon)
    {
    SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", weapon);
    ChangeEdictState(client, FindDataMapInfo(client, "m_hActiveWeapon"));
    }

    Although you do not use this function in your code, I would advise highly against ever using this method to switch a players weapon, i've personally seen bugs where the weapon u switch too can't be seen in your hands nor does the clients hud that shows your items properly update...say after using a molotov and forcefully changing to a primary or secondary the icon for the molotov stays in your inventory even though u no longer can select it or have it...instead use clientcommand/fakeclientcommand to set the weapon bug free by changing to its slot.

    Last edited by MasterMind420; 01-19-2020 at 10:07.
    MasterMind420 is offline
    xZk
    Senior Member
    Join Date: Nov 2017
    Location: cl
    Old 01-19-2020 , 17:33   Re: [L4D/2]Incapped Pickup Items
    Reply With Quote #6

    ok thanks for the tip, i'm testing this fakeclientcommand method in the Incapped Weapons plugin.
    xZk is offline
    xZk
    Senior Member
    Join Date: Nov 2017
    Location: cl
    Old 03-01-2020 , 15:20   Re: [L4D/2]Incapped Pickup Items
    Reply With Quote #7

    Update:
    Code:
    2020-03-01 (v1.2)
    * Fixed "IsPlayerCapped" method for L4D1
    thanks TiTz for his report
    xZk is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 11-27-2020 , 21:27   Re: [L4D/2] Incapped Pickup Items
    Reply With Quote #8

    Noticed a bug when scavenge items cvar is enable, if you press E next to a scavenge gascan it spawns another one next to it, but in the red color.

    After messing with the code a bit I figured out that when pressing "E", sometimes it fires "GetItemOnFloor" for the "weapon_scavenge_item_spawn" entities [invisible], instead of the "weapon_gascan" and it makes another gascan spawn.

    So to fix it I added another check on "IsValidItemPickup"

    Here is the code in case the author wants to incorporate into the plugin, or someone else has the same problem. Seems to fix this bug.

    Spoiler


    Note: I will/allow delete the post in case this has been fixed.
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d_incapped_pickup.sp - 458 views - 8.0 KB)
    __________________

    Last edited by Marttt; 11-28-2020 at 08:01.
    Marttt is offline
    mixjay
    New Member
    Join Date: Oct 2011
    Location: Vladivostok
    Old 01-09-2021 , 05:56   Re: [L4D/2] Incapped Pickup Items
    Reply With Quote #9

    One more fix - restrict pickup chainsaw, when you incapped:

    Code:
    stock bool IsWeaponChainsaw(int weapon){
    	if(IsValidWeapon(weapon)){
    		char class_name[64];
    		GetEntityClassname(weapon, class_name, sizeof(class_name));
    		return (strcmp(class_name, "weapon_chainsaw") == 0);
    	}
    	return false;
    }
    mixjay is offline
    sorallll
    Senior Member
    Join Date: Oct 2018
    Old 08-06-2021 , 03:32   Re: [L4D/2] Incapped Pickup Items
    Reply With Quote #10

    A better way to get items that are about to be picked up
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_incapped_pickup.sp - 436 views - 3.7 KB)
    File Type: txt l4d2_incapped_pickup.txt (222 Bytes, 271 views)
    sorallll 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 12:40.


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