AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   TF2Items (https://forums.alliedmods.net/forumdisplay.php?f=146)
-   -   Solved Weapon Attribute Not Being Overriden? (https://forums.alliedmods.net/showthread.php?t=245100)

Requiesta 07-28-2014 09:44

Weapon Attribute Not Being Overriden?
 
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?


All times are GMT -4. The time now is 21:31.

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