AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [TF2] Help changing sniper attributes (https://forums.alliedmods.net/showthread.php?t=289547)

LeBabouin 10-24-2016 09:50

[TF2] Help changing sniper attributes
 
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 :)

Nursik 10-24-2016 10:14

Re: [TF2] Help changing sniper attributes
 
Quote:

Originally Posted by LeBabouin (Post 2464568)
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.

LeBabouin 10-24-2016 10:26

Re: [TF2] Help changing sniper attributes
 
Quote:

Originally Posted by Nursik (Post 2464576)
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?

Nursik 10-24-2016 11:16

Re: [TF2] Help changing sniper attributes
 
Quote:

Originally Posted by LeBabouin (Post 2464579)
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.

LeBabouin 10-24-2016 15:08

Re: [TF2] Help changing sniper attributes
 
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 :oops:

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 10-24-2016 18:43

Re: [TF2] Help changing sniper attributes
 
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.

Powerlord 10-24-2016 20:24

Re: [TF2] Help changing sniper attributes
 
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.

friagram 10-25-2016 03:31

Re: [TF2] Help changing sniper attributes
 
just use the machina attributes?

Benoist3012 10-25-2016 07:19

Re: [TF2] Help changing sniper attributes
 
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)

LeBabouin 10-25-2016 14:43

Re: [TF2] Help changing sniper attributes
 
Thank you so much for your consistent answers!

Quote:

Originally Posted by Powerlord (Post 2464724)
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" :up: 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 :)


All times are GMT -4. The time now is 18:27.

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