AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] Weapon Remove (https://forums.alliedmods.net/showthread.php?t=133726)

Rain_orel 07-28-2010 06:44

[L4D2] Weapon Remove
 
1 Attachment(s)
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.

dYZER 07-28-2010 07:14

Re: [L4D2] Weapon Remove
 
1 Attachment(s)
yeah nice plugin, (tiny and small) gj

here i little update, 1.01
config file support ,and version info

Rain_orel 07-28-2010 07:33

Re: [L4D2] Weapon Remove
 
thx =)

Elektramode 12-31-2010 11:26

Re: [L4D2] Weapon Remove
 
Goodie, this is very good for my realism server

GanjaStar 01-01-2011 03:46

Re: [L4D2] Weapon Remove
 
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 :)

Rain_orel 01-23-2011 14:30

Re: [L4D2] Weapon Remove
 
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.

asto 05-06-2011 13:43

Re: [L4D2] Weapon Remove
 
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 :oops:)
Please help

Hanzoligen 02-19-2013 15:36

Re: [L4D2] Weapon Remove
 
1 Attachment(s)
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"


eric0279 08-25-2014 23:29

Re: [L4D2] Weapon Remove
 
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

DeathChaos25 08-26-2014 05:54

Re: [L4D2] Weapon Remove
 
Quote:

Originally Posted by Hanzoligen (Post 1897812)
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




All times are GMT -4. The time now is 19:10.

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