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

[TF2] Help changing sniper attributes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LeBabouin
Member
Join Date: Sep 2014
Old 10-24-2016 , 09:50   [TF2] Help changing sniper attributes
Reply With Quote #1

Well hello!

Going back to plugins utilisation after a 2 year long wait, I noticed one of the tInstagib plugin (https://forum.alliedmods.net/showtread.php?p=1606838) module i used to run a "Rifle Only" dedicated server is not working anymore:

The plugin module (tIg.forceweapon.sp) removes all weapons from every player (they all have yet been forced to choose Sniper class) and give them back only the sniper after updating some attributes to make them shoot tracers and be ammo'd with 200 rounds.

Everything works good except everyone's sniper weapon can't be seen by other players! I spontaneously blame the "give weapon" functionality and am looking for some workaround so everyone's sniper would shoot tracers and have a 200 round magazine.

For example, could it be posssible to update the sniper before it equips the players or update every sniper once the player is effectively equipped with it, without remove+give?

*I will be happy even if you just tell me yes or no

Last edited by LeBabouin; 10-24-2016 at 09:55.
LeBabouin is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 10-24-2016 , 10:14   Re: [TF2] Help changing sniper attributes
Reply With Quote #2

Quote:
Originally Posted by LeBabouin View Post
Well hello!

Going back to plugins utilisation after a 2 year long wait, I noticed one of the tInstagib plugin (https://forum.alliedmods.net/showtread.php?p=1606838) module i used to run a "Rifle Only" dedicated server is not working anymore:
...
*I will be happy even if you just tell me yes or no
Discussing visibility of weapons/hats is against the policy of Valve, no one will help you here.
Nursik is offline
LeBabouin
Member
Join Date: Sep 2014
Old 10-24-2016 , 10:26   Re: [TF2] Help changing sniper attributes
Reply With Quote #3

Quote:
Originally Posted by Nursik View Post
Discussing visibility of weapons/hats is against the policy of Valve, no one will help you here.
Oh! Thank you though.
And what if we talk about weapon attrubutes updating, is it a taboo subject too?
LeBabouin is offline
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 10-24-2016 , 11:16   Re: [TF2] Help changing sniper attributes
Reply With Quote #4

Quote:
Originally Posted by LeBabouin View Post
Oh! Thank you though.
And what if we talk about weapon attrubutes updating, is it a taboo subject too?
what do you mean by updating? Valve updates and removes attributes. Do you mean making our own attributes or what? Explain please.
Nursik is offline
LeBabouin
Member
Join Date: Sep 2014
Old 10-24-2016 , 15:08   Re: [TF2] Help changing sniper attributes
Reply With Quote #5

Thanks for your reply Nursik. By updating i meant only change attributes of the player current weapon, without having to create a sniper with custom attribute values and then removing the current weapon and then giving the new one to the player. In other words, can we change the attributes once the weapon has been given to the player?

I would like to workaround these functions, as they produce the bad result i faultly mentioned above

Code:
public Action:Timer_CheckInventory(Handle:timer, any:iClient) {
 TF2_RemoveAllWeapons(iClient);
 CreateTimer(0.3, Timer_EquipRailgun, iClient);
}
public Action:Timer_EquipRailgun(Handle:timer, any:iClient) {
 new Handle:hTest = TF2Items_CreateItem(FORCE_GENERATION | OVERRIDE_CLASSNAME | OVERRIDE_ITEM_DEF | OVERRIDE_ITEM_LEVEL | OVERRIDE_ITEM_QUALITY | OVERRIDE_ATTRIBUTES);
 TF2Items_SetClassname(hTest, "tf_weapon_sniperrifle");
 TF2Items_SetItemIndex(hTest, 14);  // Default Rifle
 //TF2Items_SetItemIndex(hTest, 526);  // The Machina
 //TF2Items_SetItemIndex(hTest, 201);  // Upgradeable Default Rifle

 TF2Items_SetLevel(hTest, 5);
 TF2Items_SetQuality(hTest, 6);
 TF2Items_SetNumAttributes(hTest, 4);
 TF2Items_SetAttribute(hTest, 0, 304, 1.0);
 TF2Items_SetAttribute(hTest, 1, 308, 1.0);
 TF2Items_SetAttribute(hTest, 2, 305, 1.0);
 TF2Items_SetAttribute(hTest, 3, 2, 100.0);
 new entity = TF2Items_GiveNamedItem(iClient, hTest);
 CloseHandle(hTest);
 EquipPlayerWeapon(iClient, entity);
 // Give 200 shot
 new iOffAmmo = FindDataMapOffs(iClient, "m_iAmmo") + 1 * 4;
 SetEntData(iClient, iOffAmmo, 200);
}
This is for a sniper only server, every player's choice is restricted to a single sniper. Having the player spawn without weapons and getting the customized sniper from resupply could be ok too. But is it doable
LeBabouin is offline
LeBabouin
Member
Join Date: Sep 2014
Old 10-24-2016 , 18:43   Re: [TF2] Help changing sniper attributes
Reply With Quote #6

ok i got what i want using tf2Items
But still eager to know if it's possible to access attributes of a player current weapon.
LeBabouin is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-24-2016 , 20:24   Re: [TF2] Help changing sniper attributes
Reply With Quote #7

If you give them the stock weapons (like the sniper rifle), they're usually visible.

Keep in mind that Stock weapons usually have a level of 1 and a quality of... 0 I think.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-24-2016 at 20:25.
Powerlord is offline
LeBabouin
Member
Join Date: Sep 2014
Old 10-25-2016 , 14:43   Re: [TF2] Help changing sniper attributes
Reply With Quote #8

Thank you so much for your consistent answers!

Quote:
Originally Posted by Powerlord View Post
If you give them the stock weapons (like the sniper rifle), they're usually visible.
Keep in mind that Stock weapons usually have a level of 1 and a quality of... 0 I think.
"item_quality" "normal" but i cant seem yet to achieve the objective with TF2Items_SetLevel(hTest, 1); and TF2Items_SetQuality(hTest, 0); I keep trying.
In the meanwhile, it's going good too with your weapon restriction plugin + a tf2items.weapons.txt to add the wanted sniper attribute values.
Thanks for the method Benoist, that was the way i imagined to do it initially but didn't have yet someone to point me to the fundamental basics !
Wonder if you have some smart process behind your head fiagram
__________________

Last edited by LeBabouin; 10-25-2016 at 14:44.
LeBabouin is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 10-25-2016 , 03:31   Re: [TF2] Help changing sniper attributes
Reply With Quote #9

just use the machina attributes?
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 10-25-2016 , 07:19   Re: [TF2] Help changing sniper attributes
Reply With Quote #10

If you want to have the weapons visible, you should let them their sniper, use tf2attributes and strip all the attributes from their sniper, giving you a stock sniper to work from. And then reuse tf2attributes, to apply the attributes you want.

And you should also add a check for the class name "tf_weapon_sniperrifle_classic" and "tf_weapon_compound_bow", and then give them a stock sniper and change their attributes. (Only those players will have an invisible sniper)
__________________

Last edited by Benoist3012; 10-25-2016 at 07:20.
Benoist3012 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 05:58.


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