| 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_ATTRIBUTES) iFlags &= ~PRESERVE_ATTRIBUTES;
TF2Items_SetFlags(hItem, iFlags);
new iNumAttributes = TF2Items_GetNumAttributes(hItem);
TF2Items_SetNumAttributes(hItem, iNumAttributes + 2);
TF2Items_SetAttribute(hItem, iNumAttributes, 217, 0.0);
TF2Items_SetAttribute(hItem, iNumAttributes + 1, 125, 0.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?
|