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

[TF2] Custom Attributes


Post New Thread Reply   
 
Thread Tools Display Modes
nosoop
Veteran Member
Join Date: Aug 2014
Old 03-15-2021 , 16:51   Re: [TF2] Custom Attributes
Reply With Quote #11

Quote:
Originally Posted by LeAlex14 View Post
Hey ! It's me again, all works fine, I just have some issues with canteen. I don't see any function for remove attribute, but that can be possible ?
You can currently use the raw KeyValues access functions:

Code:
KeyValues attributes = TF2CustAttr_GetAttributeKeyValues(entity);
if (attributes) {
	attributes.DeleteKey(attribName);
	TF2CustAttr_UseKeyValues(entity, attributes);
	delete attributes;
}
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
hydrochloride
New Member
Join Date: Aug 2023
Old 08-08-2023 , 18:22   Re: [TF2] Custom Attributes
Reply With Quote #12

im gonna be honest, i have no clue how yo use sm_custattr_add, is there an example on how to use it? i put in the name of the file of the attribute, also even if i type in random letters and it accepts them as attributes, can you make it so it detects if the name put in matches the attribute name instead of accepting anything
hydrochloride is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 08-09-2023 , 05:44   Re: [TF2] Custom Attributes
Reply With Quote #13

Quote:
Originally Posted by hydrochloride View Post
im gonna be honest, i have no clue how yo use sm_custattr_add, is there an example on how to use it? i put in the name of the file of the attribute, also even if i type in random letters and it accepts them as attributes, can you make it so it detects if the name put in matches the attribute name instead of accepting anything
What you're asking for is not possible - the Custom Attribute system is free form and doesn't have any concept of whether or not attributes actually exist; plugins just check that some entry is present when it needs to.

Can't give you any concrete instructions since I don't know what you have on hand, but assuming you installed the Starter Pack, you can refer to the attribute list for descriptions of how to use every attribute available there - other attribute plugins likely provide their own instructions.

For example, if you wanted to apply weapon always gibs on kill to your current weapon:

Code:
sm_custattr_add "weapon always gibs on kill" "1"
Note that the command is primarily intended for rapid development; use something like the built-in configuration for attributes to persist.

(These days I'd recommend using Econ Dynamic so plugins can register real attributes that operate seamlessly with the game's attribute system. But that's something that would be up to the attribute plugin developers to implement and migrate to, so this doesn't do you any good as a server operator.)
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop 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 10:59.


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