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

[L4D2] Weapon Remove


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Rain_orel
New Member
Join Date: Jul 2010
Plugin ID:
1835
Plugin Version:
1.0
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Old 07-28-2010 , 06:44   [L4D2] Weapon Remove
    Reply With Quote #1

    My friend always wondered how one weapon spawn can produce an infinite number of weapons. This little plugin fixes this injustice.

    l4d2_usecount defines how many times a weapon spawn can be used before it will be removed.
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_deleteweapon.sp - 4197 views - 1.4 KB)

    Last edited by Rain_orel; 07-28-2010 at 06:45. Reason: Why the hell plugin optoins don't set first time?
    Rain_orel is offline
    dYZER
    Member
    Join Date: Jan 2010
    Location: Germany
    Old 07-28-2010 , 07:14   Re: [L4D2] Weapon Remove
    Reply With Quote #2

    yeah nice plugin, (tiny and small) gj

    here i little update, 1.01
    config file support ,and version info
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_deleteweapon.sp - 3012 views - 1.7 KB)
    dYZER is offline
    Rain_orel
    New Member
    Join Date: Jul 2010
    Old 07-28-2010 , 07:33   Re: [L4D2] Weapon Remove
    Reply With Quote #3

    thx =)
    Rain_orel is offline
    Elektramode
    Senior Member
    Join Date: Mar 2010
    Old 12-31-2010 , 11:26   Re: [L4D2] Weapon Remove
    Reply With Quote #4

    Goodie, this is very good for my realism server
    Elektramode is offline
    GanjaStar
    Senior Member
    Join Date: Jun 2009
    Old 01-01-2011 , 03:46   Re: [L4D2] Weapon Remove
    Reply With Quote #5

    Hey guys. I already requested a plugin like this before. Atomic stryker made one for me, but it does have some bugs.

    its here

    first off, it only applies to tier 2 weapons, and whoever first picks it up, is the only one that can use it. when someone drops it, the weapon is unusable by anyone else. it simply disappears on pickup.

    Thats why it would be great if your plugin could have variables for each weapon. because i only wan't tier 2 to be single pickup, and tier 1 staying infinite. Maybe your version doesn't have the drop bug.

    thats my humble request
    GanjaStar is offline
    Rain_orel
    New Member
    Join Date: Jul 2010
    Old 01-23-2011 , 14:30   Re: [L4D2] Weapon Remove
    Reply With Quote #6

    Quote:
    //decl String:item_name[32]
    //GetEventString(event, "item", item_name, 32); No need yet
    You can specify different cvars for different items. Ask a coder to write this feature as i don't have much time now for that work. It isn't difficult but requires rather big amount of repetative code. For weapon list, see this.
    Rain_orel is offline
    asto
    Member
    Join Date: Aug 2010
    Old 05-06-2011 , 13:43   Re: [L4D2] Weapon Remove
    Reply With Quote #7

    Hi!
    I searched a long time for a plugin like this. I found this, thanks, but unfortunately this plugin has 2 bugs :

    1. after everyone dies and the current map restarted 2-3 times, this plugin will not work

    2. my weapon will disappear when I pick up a same type weapon as mine
    example: if I have an SMG and I see an other spawned SMG and I tries to replace my old SMG with that new, spawned --> my old SMG will disappear

    (sorry for my bad english )
    Please help

    Last edited by asto; 05-06-2011 at 16:12.
    asto is offline
    Hanzoligen
    Junior Member
    Join Date: Feb 2013
    Old 02-19-2013 , 15:36   Re: [L4D2] Weapon Remove
    Reply With Quote #8

    I altered the script to make it adjustable for each weapon.
    It works for both L4D1 + 2.
    You can set a general pick up limit if you don't feel like altering each weapon for its own. It's also possible to set a limit of "0" to remove specific weapons completely or use "-1" if you want infinite amount (l4d standard).

    Thanks to Rain_orel for the initial plugin!

    For the bugs above: I didn't encounter the script not working, although I restarted several times. Can you try again and report please?
    I couldn't test the other bug (takes time to walk through the map). Each item spawn has it's unique ID. Unless that equals the ID of the gun you are holding it shouldn't get removed.

    Edit: I noticed that if you change the limits you need to reload the map twice before they get applied. I have no idea why. Any hints are welcome.

    Code:
    // Note:
    // a limit of "0" means that guns is removed
    // ..limit_all is the limit for all weapons (0=disable general limit)
    // which overrides weapon specific values below
    // if they are set above this limit
    
    l4d_weaponremove_enable "1"
    l4d_weaponremove_limit_all "0"
    
    l4d_weaponremove_limit_autoshotgun "1"
    l4d_weaponremove_limit_hunting_rifle "1"
    l4d_weaponremove_limit_pistol "2"
    l4d_weaponremove_limit_pumpshotgun "1"
    l4d_weaponremove_limit_rifle "1"
    l4d_weaponremove_limit_smg "3"
    
    l4d2_weaponremove_limit_grenade_launcher "1"
    l4d2_weaponremove_limit_pistol_magnum "1"
    l4d2_weaponremove_limit_rifle_ak47 "1"
    l4d2_weaponremove_limit_rifle_desert "1"
    l4d2_weaponremove_limit_rifle_m60 "1"
    l4d2_weaponremove_limit_rifle_sg552 "1"
    l4d2_weaponremove_limit_shotgun_chrome "1"
    l4d2_weaponremove_limit_shotgun_spas "1"
    l4d2_weaponremove_limit_smg_mp5 "1"
    l4d2_weaponremove_limit_smg_silenced "1"
    l4d2_weaponremove_limit_sniper_awp "1"
    l4d2_weaponremove_limit_sniper_military "1"
    l4d2_weaponremove_limit_sniper_scout "1"
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d1-2_weaponremover_v1.02.sp - 2615 views - 10.6 KB)

    Last edited by Hanzoligen; 02-19-2013 at 16:35.
    Hanzoligen is offline
    eric0279
    AlliedModders Donor
    Join Date: May 2007
    Old 08-25-2014 , 23:29   Re: [L4D2] Weapon Remove
    Reply With Quote #9

    Hello,

    Quote:
    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d2_weaponremove_limit_grenade_launcher "-1"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "2"
    l4d2_weaponremove_limit_pistol_magnum "2"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d2_weaponremove_limit_rifle_ak47 "-1"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d2_weaponremove_limit_rifle_desert "-1"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d2_weaponremove_limit_rifle_m60 "-1"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d2_weaponremove_limit_rifle_sg552 "-1"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "3"
    l4d2_weaponremove_limit_shotgun_chrome "3"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d2_weaponremove_limit_shotgun_spas "-1"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d2_weaponremove_limit_smg_mp5 "-1"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "3"
    l4d2_weaponremove_limit_smg_silenced "3"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d2_weaponremove_limit_sniper_awp "-1"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d2_weaponremove_limit_sniper_military "-1"

    // Limit for this weapon (0=infinite, -1=disable)
    // -
    // Default: "1"
    l4d2_weaponremove_limit_sniper_scout "1"

    // Enable or disable Weapon Remover plugin
    // -
    // Default: "1"
    l4d_weaponremove_enable "1"

    // Limits all weapons to this many pickups (0=no limit)
    // -
    // Default: "1"
    l4d_weaponremove_limit_all "1"

    // Limit for Autoshotguns (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d_weaponremove_limit_autoshotgun "-1"

    // Limit for Sniper Rifles (0=infinite, -1=disable)
    // -
    // Default: "2"
    l4d_weaponremove_limit_hunting_rifle "2"

    // Limit for Pistols (0=infinite, -1=disable)
    // -
    // Default: "0"
    l4d_weaponremove_limit_pistol "0"

    // Limit for Pumpshotguns (0=infinite, -1=disable)
    // -
    // Default: "2"
    l4d_weaponremove_limit_pumpshotgun "2"

    // Limit for M4s (0=infinite, -1=disable)
    // -
    // Default: "-1"
    l4d_weaponremove_limit_rifle "-1"

    // Limit for SMGs (0=infinite, -1=disable)
    // -
    // Default: "3"
    l4d_weaponremove_limit_smg "3"

    only two of you will have a weapon in safe room, make the good choice!

    l4d1-2_weaponremover_v1.02
    eric0279 is offline
    DeathChaos25
    Senior Member
    Join Date: Jan 2014
    Location: Puerto Rico
    Old 08-26-2014 , 05:54   Re: [L4D2] Weapon Remove
    Reply With Quote #10

    Quote:
    Originally Posted by Hanzoligen View Post
    I altered the script to make it adjustable for each weapon.
    It works for both L4D1 + 2.
    You can set a general pick up limit if you don't feel like altering each weapon for its own. It's also possible to set a limit of "0" to remove specific weapons completely or use "-1" if you want infinite amount (l4d standard).

    Thanks to Rain_orel for the initial plugin!

    For the bugs above: I didn't encounter the script not working, although I restarted several times. Can you try again and report please?
    I couldn't test the other bug (takes time to walk through the map). Each item spawn has it's unique ID. Unless that equals the ID of the gun you are holding it shouldn't get removed.

    Edit: I noticed that if you change the limits you need to reload the map twice before they get applied. I have no idea why. Any hints are welcome.
    I don't know if this is why the bug happens, but, you guys forgot to code the ConVar changed event, meaning if someone changes the value mid game, the plugin is never told so until it is reset, so it'll never change until the plugins are unloaded and refreshed or until a map change.

    Here it is,

    PHP Code:
    #include <sourcemod>
    #include <sdktools>
     
    public Plugin:myinfo =
    {
        
    name "[L4D2] Weapon Remove",
        
    author "Rain_orel",
        
    description "Removes weapon spawn",
        
    version "1.0",
        
    url "http://www.sourcemod.net/"
    };

    new 
    ent_table[64][2];
    new 
    new_ent_counter 0;
    new 
    Handle:hCount;

    public 
    OnPluginStart()
    {
        
    HookEvent("spawner_give_item"Event_SpawnerGiveItem);
        
    hCount CreateConVar("l4d2_usecount""1""How many times a weapon spawn can be used before it will be removed.")
        
    HookConVarChange(hCountConVarhCount
    }

    public 
    OnMapStart()
    {
        for(new 
    i=0;i<63;i++)
        {
        
    ent_table[i][0]=-1;
        
    ent_table[i][1]=-1;
        }
        
    new_ent_counter 0
    }

    public 
    OnMapEnd(){}

    public 
    Event_SpawnerGiveItem(Handle:event, const String:name[], bool:dontBroadcast)
    {
       
    //decl String:item_name[32]
       //GetEventString(event, "item", item_name, 32);  No need yet
       
    new entity_id GetEventInt(event"spawner")
       
       
       if(
    GetUseCount(entity_id)==-1)
       {
       
    ent_table[new_ent_counter][0]=entity_id;
       
    ent_table[new_ent_counter][1]=0;
       
    new_ent_counter++;
       }
       
       
    SetUseCount(entity_id);
       
       if(
    GetUseCount(entity_id)==GetConVarInt(hCount))RemoveEdict(entity_id);
    }

    GetUseCount(entid)
    {
        for(new 
    i=0;i<63;i++)
        {
        if(
    ent_table[i][0]==entid)return ent_table[i][1]
        }
        return -
    1
    }

    SetUseCount(entid)
    {
        for(new 
    j=0;j<63;j++)
        {
        if(
    ent_table[j][0]==entid)ent_table[j][1]++;
        }
    }
        
    public 
    ConVarhCount(Handle:convar, const String:oldValue[], const String:newValue[])
    {
        
    hCount GetConVarInt(convar


    Last edited by DeathChaos25; 08-26-2014 at 05:54.
    DeathChaos25 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 13:44.


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