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

Weapons' item definition indexes stay the same.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SadScrub
Member
Join Date: May 2014
Old 06-01-2014 , 16:22   Weapons' item definition indexes stay the same.
Reply With Quote #1

Hello. I've lurked around the TF2Items section of this forum, but so far I've found nothing that resembled my issue (if there is something, I apologize).

Lately, I've been messing around with SP and TF2Items, and when I'm spawning weapons via this function:

Code:
new Handle:hWeapon = TF2Items_CreateItem(OVERRIDE_CLASSNAME | OVERRIDE_ITEM_DEF | FORCE_GENERATION | PRESERVE_ATTRIBUTES);
    new String:classname[MAX_CLASSNAME_SIZE];
            
    TF2Items_SetItemIndex(hWeapon, index);
            
    TF2II_GetItemClass(index, classname, sizeof(classname), TFClassType:class); 
    TF2Items_SetClassname(hWeapon, classname);
            
    new wEntity = TF2Items_GiveNamedItem(UserSlot, hWeapon);
    CloseHandle(hWeapon);
    EquipPlayerWeapon(client, wEntity);
Everything seems to be working and looking fine. But some items don't seem to be behaving as intended (consumables like the Sandvich cannot be eaten, but Bonk! works; also, taunts do not correspond with equipped weapons, only default ones are used).

When I check the item definition indexes of my current weapons with this:

Code:
entityStorage = GetPlayerWeaponSlot(slot, i);
if ( GetEntProp(entityStorage, Prop_Send, "m_iItemDefinitionIndex") != index )
PrintToServer("Slot %i is fine", i);
GetEntProp seems to only return the values of stock weapon indexes. I'd really appreciate any advice, this has been bugging me for a couple of days now

Last edited by SadScrub; 06-01-2014 at 16:35.
SadScrub is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 06-02-2014 , 11:46   Re: Weapons' item definition indexes stay the same.
Reply With Quote #2

what's index set to?
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-02-2014 , 14:35   Re: Weapons' item definition indexes stay the same.
Reply With Quote #3

You're remembering to remove the previous weapon before giving them the new one?
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
SadScrub
Member
Join Date: May 2014
Old 06-03-2014 , 11:16   Re: Weapons' item definition indexes stay the same.
Reply With Quote #4

Quote:
Originally Posted by WildCard65 View Post
what's index set to?
Index used to refer to a weapon index I set for the program (Primary slot, 45 (Force-a-Nature) to be precise). It's been now rewritten for 3 slots for more testing purposes.

Quote:
Originally Posted by Powerlord View Post
You're remembering to remove the previous weapon before giving them the new one?
Yes, in both my Post_Inventory_Application & Player_Spawn hooks. Here is the full code of the program, I apologize for not posting it sooner:

Spoiler


This force-spawns you as a Scout with the Force-a-Nature, Bonk! and Atomizer. They all do what they're supposed to (knockback, consumable/immunity and triple jump, respectively) and have proper skins, but, for example, the Atomizer still has the Bat taunt (that's how I noticed that the indexes differ in the first place).

Last edited by SadScrub; 06-03-2014 at 11:18.
SadScrub is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 06-03-2014 , 12:21   Re: Weapons' item definition indexes stay the same.
Reply With Quote #5

Quote:
Originally Posted by SadScrub View Post
Index used to refer to a weapon index I set for the program (Primary slot, 45 (Force-a-Nature) to be precise). It's been now rewritten for 3 slots for more testing purposes.



Yes, in both my Post_Inventory_Application & Player_Spawn hooks. Here is the full code of the program, I apologize for not posting it sooner:

Spoiler


This force-spawns you as a Scout with the Force-a-Nature, Bonk! and Atomizer. They all do what they're supposed to (knockback, consumable/immunity and triple jump, respectively) and have proper skins, but, for example, the Atomizer still has the Bat taunt (that's how I noticed that the indexes differ in the first place).
atomizer has an special taunt attribute (511)

also are not setting any attribute on the weapons
arthurdead 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 18:19.


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