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

[TF2] Disable Weapon by Index Number


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AeroAcrobat
AlliedModders Donor
Join Date: Apr 2011
Location: lives in a circus
Old 10-23-2013 , 07:21   [TF2] Disable Weapon by Index Number
Reply With Quote #1

I'm looking for a way to disable all sappers (or "not able to sap" or "building sap immunity").

I wasn't able to find anything related.
There is a plugin that disables by weapon class: http://forums.alliedmods.net/showthread.php?p=771534

But it does not only disable the sapper, but tf_weapon_builder would also disable engineer's PDA... That's the drawback.
Code:
735     Sapper     tf_weapon_builder
736     Sapper (Renamed/Strange)     tf_weapon_builder
810     The Red-Tape Recorder     tf_weapon_sapper
831     The Red-Tape Recorder (Genuine)     tf_weapon_sapper
933     The Ap-Sap (Genuine)        tf_weapon_sapper
Would be cool if there is an easy way to disable all sappers. Even more awesome if there is a solution to block at least weapons by the index numbers.
__________________

Last edited by AeroAcrobat; 10-23-2013 at 13:35.
AeroAcrobat is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 10-23-2013 , 12:14   Re: [TF2] Disable Weapon by Index Number
Reply With Quote #2

Okay, going to script dat now !

EDIT: Can't finish now, uploading here later.

EDIT2: Ousch, I didn't search before. Leonardo post give you a link to the plugin.
__________________
Want to check my plugins ?

Last edited by Arkarr; 10-23-2013 at 17:10.
Arkarr is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 10-23-2013 , 16:41   Re: [TF2] Disable Weapon by Index Number
Reply With Quote #3

http://forums.alliedmods.net/showthread.php?t=191585 eh?

or, atleast, edit this
http://forums.alliedmods.net/showthread.php?t=205019

Last edited by Leonardo; 10-23-2013 at 16:42.
Leonardo is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 10-23-2013 , 18:15   Re: [TF2] Disable Weapon by Index Number
Reply With Quote #4

The "Red-Tape Disabler" is very oddly coded, and will SPAM the chat with change team messages until the player either leaves the server, or switches to a loadout that does not contain that weapon. It doesn't actually remove the weapon, it just sends the player to Spectator and back, over and over, until the weapon is removed by the player.
__________________

Last edited by ddhoward; 10-23-2013 at 18:34.
ddhoward is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 10-24-2013 , 03:14   Re: [TF2] Disable Weapon by Index Number
Reply With Quote #5

Quote:
Originally Posted by ddhoward View Post
It doesn't actually remove the weapon, it just sends the player to Spectator and back, over and over, until the weapon is removed by the player.
Which is the best way to disable a weapon, obviously.

Weapon Limiter seems to be really complex for accomplishing such a simple task as disabling a weapon class. Here's a really simple plugin that'll silently remove all Sappers as they are given. (By checking item indexes, unfortunately, as TF2Items_OnGiveNamedItemPost seems to go with that weapon class listing in the first post, instead of all being tf_weapon_sapper.) Requires TF2Items.
PHP Code:
#include <tf2_stocks>
#include <tf2items>

public TF2Items_OnGiveNamedItem_Post(clientString:classname[], indexlevelqualityentity)
{
    switch (
index)
    {    case 
735736810831933CreateTimer(0.1Timer_RemoveEntityEntIndexToEntRef(entity));    }
}

public 
Action:Timer_RemoveEntity(Handle:timerany:ref)
{
    new 
entity EntRefToEntIndex(ref);
    if (
entity <= MaxClients) return;
    
AcceptEntityInput(entity"Kill");

Attached Files
File Type: smx removesapper.smx (3.2 KB, 260 views)
File Type: sp Get Plugin or Get Source (removesapper.sp - 293 views - 449 Bytes)
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 10-24-2013 , 03:25   Re: [TF2] Disable Weapon by Index Number
Reply With Quote #6

Quote:
Originally Posted by MasterOfTheXP View Post
PHP Code:
#include <tf2_stocks> 
why
Leonardo is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 10-24-2013 , 03:44   Re: [TF2] Disable Weapon by Index Number
Reply With Quote #7

Needed to include sdktools (for AcceptEntityInput), and it's a TF2 plugin, so I figured, why not?
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)

Last edited by MasterOfTheXP; 10-24-2013 at 03:45.
MasterOfTheXP is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-25-2013 , 14:46   Re: [TF2] Disable Weapon by Index Number
Reply With Quote #8

Quote:
Originally Posted by MasterOfTheXP View Post
Which is the best way to disable a weapon, obviously.

Weapon Limiter seems to be really complex for accomplishing such a simple task as disabling a weapon class. Here's a really simple plugin that'll silently remove all Sappers as they are given. (By checking item indexes, unfortunately, as TF2Items_OnGiveNamedItemPost seems to go with that weapon class listing in the first post, instead of all being tf_weapon_sapper.) Requires TF2Items.
PHP Code:
#include <tf2_stocks>
#include <tf2items>

public TF2Items_OnGiveNamedItem_Post(clientString:classname[], indexlevelqualityentity)
{
    switch (
index)
    {    case 
735736810831933CreateTimer(0.1Timer_RemoveEntityEntIndexToEntRef(entity));    }
}

public 
Action:Timer_RemoveEntity(Handle:timerany:ref)
{
    new 
entity EntRefToEntIndex(ref);
    if (
entity <= MaxClients) return;
    
AcceptEntityInput(entity"Kill");

Any particular reason you're removing them in post instead of just blocking them?
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 10-25-2013 , 18:17   Re: [TF2] Disable Weapon by Index Number
Reply With Quote #9

Quote:
Originally Posted by Powerlord View Post
Any particular reason you're removing them in post instead of just blocking them?
Regular OGNI doesn't catch items given by plugins; although, it could be used for that reason intentionally, in order to allow admins to give players sappers using Give Weapon. However, it'd then ignore sappers (or just Red-Tape, maybe) given by Local Item Server, or other such plugins.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-25-2013 , 18:45   Re: [TF2] Disable Weapon by Index Number
Reply With Quote #10

Quote:
Originally Posted by MasterOfTheXP View Post
Regular OGNI doesn't catch items given by plugins; although, it could be used for that reason intentionally, in order to allow admins to give players sappers using Give Weapon. However, it'd then ignore sappers (or just Red-Tape, maybe) given by Local Item Server, or other such plugins.
That sounds like a bug to me... maybe we should point that out to asherkin.

Who knows, maybe it's intentional.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-25-2013 at 18:46.
Powerlord 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 01:31.


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