Raised This Month: $ Target: $400
 0% 

Solved Weapon Attribute Not Being Overriden?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Requiesta
Senior Member
Join Date: May 2012
Location: Texas
Old 07-28-2014 , 09:44   Weapon Attribute Not Being Overriden?
Reply With Quote #1

Here's a snippet from my OnGiveNamedItem code which is designed to override the attributes of the Conniver's Kunai (turning it into a regular knife) while also being able to support multiple OnGiveNamedItem adjustments from other plugins.

PHP Code:
    case 356:
    {
      if(
hItem == INVALID_HANDLE)
      {
        
hItem TF2Items_CreateItem(OVERRIDE_ATTRIBUTES|OVERRIDE_ITEM_QUALITY|OVERRIDE_ITEM_LEVEL);
        
hNewItem hItem;
      }

      new 
iFlags TF2Items_GetFlags(hItem);
      if(!(
iFlags OVERRIDE_ATTRIBUTES)) iFlags |= OVERRIDE_ATTRIBUTES;
      if(!(
iFlags OVERRIDE_ITEM_QUALITY)) iFlags |= OVERRIDE_ITEM_QUALITY;
      if(!(
iFlags OVERRIDE_ITEM_LEVEL)) iFlags |= OVERRIDE_ITEM_LEVEL;
      if(
iFlags PRESERVE_ATTRIBUTESiFlags &= ~PRESERVE_ATTRIBUTES;
      
TF2Items_SetFlags(hItemiFlags);




      new 
iNumAttributes TF2Items_GetNumAttributes(hItem);
      
TF2Items_SetNumAttributes(hItemiNumAttributes 2);
      
TF2Items_SetAttribute(hItemiNumAttributes2170.0);
      
TF2Items_SetAttribute(hItemiNumAttributes 11250.0);

      
PrintToChat(client"\x05[ZF ITEMS]\x01 The Conniver's Kunai has stock Knife attributes.");
      return 
Plugin_Changed;
    } 
What's wrong in the code I can't seem to pinpoint, but what happens in-game is fairly simple... it doesn't override anything. The health penalty and other effects appear to remain untouched.

I did some debugging and the code snippet does indeed fire, it prints the ZF Items line. So it fires, it just doesn't do what we want it to do. Any suggestions on how to fix this?
__________________
YouTuber, Modder, Accountant, and somehow I still enjoy programming after all that.

Check out my YouTube Channel.

Last edited by Requiesta; 08-06-2014 at 14:47.
Requiesta 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 21:31.


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