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

[TF2]Banning weapons by weapon index.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-06-2017 , 12:28   [TF2]Banning weapons by weapon index.
Reply With Quote #1

So I'm familiar with banning weapons by the weapon class.

Class
tf_weapon_scattergun
Index
13

How could I go about banning weapons by an item index number? Since some items share similar weapon class's but only one index per item in TF2.

Last edited by Halt; 09-06-2017 at 15:17.
Halt is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 09-07-2017 , 13:18   Re: [TF2]Banning weapons by weapon index.
Reply With Quote #2

EDIT: There is already a plugin that performs exactly what you want: https://forums.alliedmods.net/showthread.php?t=140045
Spoiler

Last edited by ThatKidWhoGames; 09-07-2017 at 13:43.
ThatKidWhoGames is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-12-2017 , 12:07   Re: [TF2]Banning weapons by weapon index.
Reply With Quote #3

Quote:
Originally Posted by ThatKidWhoGames View Post
EDIT: There is already a plugin that performs exactly what you want: https://forums.alliedmods.net/showthread.php?t=140045
Spoiler
So you're scrip simply replaces whatever weapon has index 12 and gives whatever weapon has index 11? I might just take yours and tinker with it if you don't mind. I need to set proper weapon index's for default weapons of the players current class.
Halt is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-12-2017 , 15:58   Re: [TF2]Banning weapons by weapon index.
Reply With Quote #4

So I'm attempting to search through a clients current equipped items to see if they have a banned item. I'm searching all slots and storing them in an array, I will then check the array and strip the weapons if they are banned. My question is how would I strip the selected slot then equip back to that slot. Not just their active slot?

PHP Code:
public Action BannedWeapons(ClientCurrentWeaponIndex)
{
    new 
CurrentWeapon GetEntPropEnt(ClientProp_Send"m_hActiveWeapon");
    static 
WeaponSlots[4];
    switch (
TF2_GetPlayerClass(Client))
    {
        case 
TFClass_Spy:
        {
            
WeaponSlots[0] = GetPlayerWeaponSlot(Client1);
            
WeaponSlots[1] = GetPlayerWeaponSlot(Client2);
            
WeaponSlots[2] = GetPlayerWeaponSlot(Client3);
            
WeaponSlots[3] = GetPlayerWeaponSlot(Client4);
        }
        case 
TFClass_Engineer
        
{
            
//Same As Above
        
}
    }

I'm not sure if I'm even on the right track? someone point me in the right direction.
Halt is offline
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 09-12-2017 , 18:53   Re: [TF2]Banning weapons by weapon index.
Reply With Quote #5

Use for to go through all the slots then against banned ids remove them, Give default back and fix T-pose if it happens

Don't forget to hook resupply touching too
__________________
The plugin developer of TF2BWR Reborn
And a TF2 Player
Michalplyoutube is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 09-15-2017 , 10:07   Re: [TF2]Banning weapons by weapon index.
Reply With Quote #6

Quote:
Originally Posted by Halt View Post
So I'm attempting to search through a clients current equipped items to see if they have a banned item. I'm searching all slots and storing them in an array, I will then check the array and strip the weapons if they are banned. My question is how would I strip the selected slot then equip back to that slot. Not just their active slot?

PHP Code:
public Action BannedWeapons(ClientCurrentWeaponIndex)
{
    new 
CurrentWeapon GetEntPropEnt(ClientProp_Send"m_hActiveWeapon");
    static 
WeaponSlots[4];
    switch (
TF2_GetPlayerClass(Client))
    {
        case 
TFClass_Spy:
        {

        }
        case 
TFClass_Engineer
        
{
            
//Same As Above
        
}
    }

I'm not sure if I'm even on the right track? someone point me in the right direction.
You don't need to check each weapon slot, the
Code:
new CurrentWeapon = GetEntPropEnt(Client, Prop_Send, "m_hActiveWeapon");
gets each weapon a client has.
ThatKidWhoGames is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-15-2017 , 10:56   Re: [TF2]Banning weapons by weapon index.
Reply With Quote #7

Wait I thought that retrieved the players ACTIVE weapon?
Halt is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 09-15-2017 , 12:20   Re: [TF2]Banning weapons by weapon index.
Reply With Quote #8

Quote:
Originally Posted by Halt View Post
Wait I thought that retrieved the players ACTIVE weapon?
Same. It checks for all of their weapons I believe though. I have a plugin which gives players a saxxy on command and even if the player has a primary weapon out, it is still able to check if the player has the saxxy or not.
ThatKidWhoGames is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 09-15-2017 , 12:47   Re: [TF2]Banning weapons by weapon index.
Reply With Quote #9

lies

1) Prop_Send integer "CTFPlayer" "m_hActiveWeapon" is 107614502
1) Prop_Data entity "CTFPlayer" "m_hActiveWeapon" is 294
294 Class: tf_weapon_sniperrifle_decap Targetname: Model: models/weapons/c_models/c_sniper_arms.mdl
__________________
Pelipoika is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-15-2017 , 14:33   Re: [TF2]Banning weapons by weapon index.
Reply With Quote #10

Quote:
Originally Posted by Pelipoika View Post
lies

1) Prop_Send integer "CTFPlayer" "m_hActiveWeapon" is 107614502
1) Prop_Data entity "CTFPlayer" "m_hActiveWeapon" is 294
294 Class: tf_weapon_sniperrifle_decap Targetname: Model: models/weapons/c_models/c_sniper_arms.mdl
So still loop through all weapon slots?
Halt 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 16:39.


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