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

[TF2] Weapon Restrictions


Post New Thread Reply   
 
Thread Tools Display Modes
Dr_Knuckles
AlliedModders Donor
Join Date: Mar 2005
Location: SW Florida
Old 05-25-2014 , 11:43   Re: [TF2] Weapon Restrictions
Reply With Quote #11

I dont suppose you can block the danger shield without blocking ALL wearables?
__________________
Dr_Knuckles is offline
SuperU
Member
Join Date: Feb 2014
Location: Panama
Old 05-25-2014 , 20:05   Re: [TF2] Weapon Restrictions
Reply With Quote #12

Powerlord thank you so much for you help

Your plugin is working for me now, i only need wait to the plugin replace the weapon blocked for the stock weapon.

I like your plugin

Once your plugin is doing the replacement i can purge tNoUnlocksPls and weapon blocker from the servers.

Last edited by SuperU; 05-25-2014 at 20:28.
SuperU is offline
ClassicGuzzi
Veteran Member
Join Date: Oct 2013
Location: Argentina
Old 05-28-2014 , 20:18   Re: [TF2] Weapon Restrictions
Reply With Quote #13

Just a two quick questions, I'm looking for a plugin to disallow The Atomizer, The Eureka effect and the Ullapool Caber in my Multi-Mod server, in the Death Run mod.
In all the examples you gave, you always use the weapon class to allow/disallow, this is not a problem with the Caber (tf_weapon_stickbomb) but I don't want to just block every bat and wrench.
Does this plugin accept index ID instead of the weapon class?
Also, I want to use it in other mods (ex: to block every flamethrower but the default in Dodge-ball) so:
Can I use the weaponrestrict [setname] not only as an admin but also as a command in a config file?
Thanks for you time!
ClassicGuzzi is offline
SuperU
Member
Join Date: Feb 2014
Location: Panama
Old 05-29-2014 , 21:44   Re: [TF2] Weapon Restrictions
Reply With Quote #14

ClassicGuzzi use this config and call the file like the name between quotes

Quote:
"weapon_restrictions"
{
"name" "restriction"
"default" "deny"

"allow_buildings" "1"
"allow_action_items" "1"


"indexes"
{
"450"
{
"name" "The Atomizer"
"allow" "1"
}
"589"
{
"name" "The Eureka Effect"
"allow" "1"
}
"307"
{
"name" "Ullapool Caber"
"allow" "1"
}

}//close indexes
}// close weapon_restrictions
Try this and tell me if works for you the config

Quote:
Originally Posted by Powerlord View Post
This plugin's main feature is the ability to switch weapon sets on the fly. As far as I know, it's the only plugin that does this. It also has a native so that other plugins can change weapon sets as well.

Unlike the other plugins, this plugin can block weapons both by classname and by Item Definition index. It can block cosmetic items by their item definition index. It can block cosmetic action items (but Valve prevents you from blocking the actual item). It can also block Engineer buildings (all of them or just specific ones, including sappers). In a blacklist (the default mode), you can choose to blacklist all tf_weapon_minigun, then whitelist just the stock minigun by its item definition indexes if you so choose.

You can also do this in config file "default" "deny" makes it so only the listed items are allowed. "default" "allow" would make it so only the listed items are blocked.

The other question about the command i don't know but i guess you can try add it in server.cfg under sourcemod commands i think.

Last edited by SuperU; 05-29-2014 at 22:19.
SuperU is offline
ClassicGuzzi
Veteran Member
Join Date: Oct 2013
Location: Argentina
Old 05-29-2014 , 22:24   Re: [TF2] Weapon Restrictions
Reply With Quote #15

Quote:
Originally Posted by SuperU View Post
Awesome response
Thanks I will try this a soon as possible and report back!
ClassicGuzzi is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-30-2014 , 09:24   Re: [TF2] Weapon Restrictions
Reply With Quote #16

Quote:
Originally Posted by ClassicGuzzi View Post
Just a two quick questions, I'm looking for a plugin to disallow The Atomizer, The Eureka effect and the Ullapool Caber in my Multi-Mod server, in the Death Run mod.
In all the examples you gave, you always use the weapon class to allow/disallow, this is not a problem with the Caber (tf_weapon_stickbomb) but I don't want to just block every bat and wrench.
Does this plugin accept index ID instead of the weapon class?
Yes, it can block by item definition index as well.

SuperU's config file is close, but the all the "allow" and "deny" keywords need to be flipped. Note: the "name" keyvalues aren't actually used and are just there for informational purposes.

Code:
"weapon_restrictions"
{
    "name"                "Melee Restrictions"
    "default"            "allow"

    "allow_buildings"        "1"
    "allow_action_items"        "1"

    "indexes"
    {
        "450"
        {
            "name"        "The Atomizer"
            "deny"        "1"
        }

        "589"
        {
            "name"        "The Eureka Effect"
            "deny"        "1"
        }

        "307"
        {
            "name"        "Ullapool Caber"
            "deny"        "1"
        }
    }
}
Incidentally, the "allow_buildings" and "allow_action_items" can be omitted and they will default to "1".

You can use item definition indexes to override a class block, too... so you could, say, block all miniguns by class, then unblock the normal and strange stock miniguns. Ideally you'd use the replace version when its finished, though.

I haven't really done much with this lately other than try to find out if its possible to hook Valve's replacement code (which is still inconclusive).

Quote:
Originally Posted by ClassicGuzzi View Post
Also, I want to use it in other mods (ex: to block every flamethrower but the default in Dodge-ball) so:
Can I use the weaponrestrict [setname] not only as an admin but also as a command in a config file?
Thanks for you time!
Yes.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-30-2014 at 09:24.
Powerlord is offline
SuperU
Member
Join Date: Feb 2014
Location: Panama
Old 05-30-2014 , 20:00   Re: [TF2] Weapon Restrictions
Reply With Quote #17

Yeah i forgot edit the allow and switch it to deny i was using my old file, my bad.

Last edited by SuperU; 05-30-2014 at 20:01.
SuperU is offline
Dr_Knuckles
AlliedModders Donor
Join Date: Mar 2005
Location: SW Florida
Old 05-30-2014 , 20:51   Re: [TF2] Weapon Restrictions
Reply With Quote #18

Can you use indexes and classes in the same cfg?
__________________
Dr_Knuckles is offline
ClassicGuzzi
Veteran Member
Join Date: Oct 2013
Location: Argentina
Old 05-31-2014 , 00:42   Re: [TF2] Weapon Restrictions
Reply With Quote #19

Well after some test, for some reason It' doesn't work well with the melee mode of the DR plugin, so I just disabled it and made a new .cfg editing the melee one.

Just a little question Powerlord, is it possible to add a new keyvalue with something like "replace_with_default" "1" or "0" ? So instead of just blocking it, the wep would be replaced by the default one.
ClassicGuzzi is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-04-2014 , 10:58   Re: [TF2] Weapon Restrictions
Reply With Quote #20

After doing some poking around Valve's code, I may have to kill classname-based restrictions to be able to do some more advanced things.

Why? Because Valve's internal code is all keyed off of the CEconItemView class. If you've ever looked at the internals for TF2Items, you'll recognize CEconItemView as what TF2Items uses to override what weapon is being given to a player... but it doesn't include the classname (which is passed separately to GiveNamedItem).

The reason this is a problem is that TF2 does its own weapon restrictions for mp_stalemate_meleeonly using just CEconItemView... specifically using the CTFPlayer::ItemIsAllowed(CEconItemView *) method.

I have yet to find the code where TF2 does tournament weapon blocking (although I have found where it loads them from a KeyValues structure into memory somewhere), which replaces a weapon with its stock version, but I have a sneaky suspicion that it is also keyed off of CEconItemView and the item definition index.

Edit: Having said that, tournament weapon blocking has to be happening in either CTFPlayer::ManageRegularWeapons(TFPlayerClass Data_t *) or CTFPlayer::ValidateWeapons(TFPlayerClassData_ t *, bool) as those are the only two spots that restrict player weapons (they make a call to CTFPlayer::ItemIsAllowed(CEconItemView *) as well). However, without knowing what TFPlayerClassData_t looks like, I'm not sure what I can do with them.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 06-04-2014 at 14:29.
Powerlord 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:24.


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