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

Preserving Attributes?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
realwx
Member
Join Date: May 2012
Old 06-29-2012 , 21:05   Preserving Attributes?
Reply With Quote #1

I'm a bit confused here. I'm trying to add a particle effect (134 ; X), but every method I do just replaces all of the attributes of the weapon instead of keeping them and adding one more.

Code:
stock GiveNewWeapon(client, itemIndex, attribute, String:classname[], slot)
{
    new Handle:newItem = TF2Items_CreateItem(OVERRIDE_ITEM_LEVEL | OVERRIDE_ITEM_QUALITY | OVERRIDE_ATTRIBUTES | PRESERVE_ATTRIBUTES);
    TF2Items_SetItemIndex(newItem, itemIndex);
    TF2Items_SetLevel(newItem, 100);
    TF2Items_SetQuality(newItem, 6);
    TF2Items_SetAttribute(newItem, 0, 134, float(attribute));
    TF2Items_SetNumAttributes(newItem, 1);
    TF2Items_SetClassname(newItem, classname);
    TF2_RemoveWeaponSlot(client, slot);
    new entity = TF2Items_GiveNamedItem(client, newItem);
    EquipPlayerWeapon(client, entity);
}
What do I modify to keep the weapon's attributes (like FaN keeping FaN attributes) and add on the particle effect? I've tried with and without OVERRIDE_ATTRIBUTES and nothing works.
realwx is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-30-2012 , 00:46   Re: Preserving Attributes?
Reply With Quote #2

PRESERVE_ATTRIBUTES only works if you're modifying an item in the TF2Items_OnGiveNamedItem callback. I use it in the Pyrovision plugin to add attribute 406 to all items, for instance.

Otherwise, if you're creating an item from scratch, you have to set all the attributes for it.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 06-30-2012 at 00:47.
Powerlord is offline
realwx
Member
Join Date: May 2012
Old 06-30-2012 , 15:35   Re: Preserving Attributes?
Reply With Quote #3

Ah, that's a shame. Thanks.
realwx 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 08:52.


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