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

how do i get attribute value?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sglee241
Junior Member
Join Date: Mar 2009
Old 06-08-2014 , 09:39   how do i get attribute value?
Reply With Quote #1

I want to change attribute according to original value.

if item already have damage buff like direct hit, make more powerful.

i tried code below, but all weapon damage stuck in 150%..


Code:
public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefinitionIndex, &Handle:hItem)
{
 static Handle:item = INVALID_HANDLE;
 if( item != INVALID_HANDLE )
 {
  CloseHandle(item);
  item = INVALID_HANDLE;
 }
 
 item = TF2Items_CreateItem(OVERRIDE_ATTRIBUTES|PRESERVE_ATTRIBUTES);
 TF2Items_SetAttribute(item, 2, 1.5) // 150% damage.
 TF2Items_SetNumAttributes(item, 1);
 
 if( item != INVALID_HANDLE )
 {
  hItem = item;
  return Plugin_Changed;
 }
 
 return Plugin_Continue;
}
sglee241 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-08-2014 , 12:51   Re: how do i get attribute value?
Reply With Quote #2

Sadly, you currently can't.

Well, not in TF2Items anyway. TF2Attributes can, but not until the item is already given to the player... but you can modify items in the post_inventory_application event using TF2Attributes.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
sglee241
Junior Member
Join Date: Mar 2009
Old 06-08-2014 , 21:59   Re: how do i get attribute value?
Reply With Quote #3

Quote:
Originally Posted by Powerlord View Post
Sadly, you currently can't.

Well, not in TF2Items anyway. TF2Attributes can, but not until the item is already given to the player... but you can modify items in the post_inventory_application event using TF2Attributes.
i appriciate your answer even if it cant be modified. i was finding almost 3 hrs on google before i ask here.

i'll try with tf2attribute. thanks again.
sglee241 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 02:57.


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