Raised This Month: $ Target: $400
 0% 

[TF2] TF2Attributes (v1.7.2, 2022/09/18)


Post New Thread Reply   
 
Thread Tools Display Modes
Nightmare Pyro
Member
Join Date: Mar 2020
Location: Cedar Falls
Old 04-06-2020 , 15:25   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #591

Ok, I using noscoop one and still get an error.

L 04/06/2020 - 14:24:26: SourceMod error session started
L 04/06/2020 - 14:24:26: Info (map "tfdb_anotherbox_v2") (file "g:\tf2 server manages\servers\db kpg\server\tf\addons\sourcemod\logs\errors_20 200406.log")
L 04/06/2020 - 14:24:26: [SM] Exception reported: Failed to create native "TF2Attrib_SetByName", name is probably already in use
L 04/06/2020 - 14:24:26: [SM] Blaming: plugin.smx
L 04/06/2020 - 14:24:26: [SM] Call stack trace:
L 04/06/2020 - 14:24:26: [SM] [0] CreateNative
L 04/06/2020 - 14:24:26: [SM] [1] Line 42, plugin.sp::AskPluginLoad2
L 04/06/2020 - 14:24:26: [SM] Failed to load plugin "plugin.smx": unexpected error 23 in AskPluginLoad callback.
L 04/06/2020 - 14:24:26: [SM] Exception reported: Could not initialize call to CTFPlayer::AddCustomAttribute
L 04/06/2020 - 14:24:26: [SM] Blaming: tf2attributes.smx
L 04/06/2020 - 14:24:26: [SM] Call stack trace:
L 04/06/2020 - 14:24:26: [SM] [0] SetFailState
L 04/06/2020 - 14:24:26: [SM] [1] Line 189, S:\Hard Drive Backup\SourceMod\tf2attributes\tf2attributes. sp::OnPluginStart
L 04/06/2020 - 14:24:26: [SM] Unable to load plugin "tf2attributes.smx": Error detected in plugin startup (see error logs)
Nightmare Pyro is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 04-06-2020 , 16:20   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #592

Quote:
Originally Posted by Nightmare Pyro View Post
Ok, I using noscoop one and still get an error.

L 04/06/2020 - 14:24:26: SourceMod error session started
L 04/06/2020 - 14:24:26: Info (map "tfdb_anotherbox_v2") (file "g:\tf2 server manages\servers\db kpg\server\tf\addons\sourcemod\logs\errors_20 200406.log")
L 04/06/2020 - 14:24:26: [SM] Exception reported: Failed to create native "TF2Attrib_SetByName", name is probably already in use
L 04/06/2020 - 14:24:26: [SM] Blaming: plugin.smx
L 04/06/2020 - 14:24:26: [SM] Call stack trace:
L 04/06/2020 - 14:24:26: [SM] [0] CreateNative
L 04/06/2020 - 14:24:26: [SM] [1] Line 42, plugin.sp::AskPluginLoad2
L 04/06/2020 - 14:24:26: [SM] Failed to load plugin "plugin.smx": unexpected error 23 in AskPluginLoad callback.
L 04/06/2020 - 14:24:26: [SM] Exception reported: Could not initialize call to CTFPlayer::AddCustomAttribute
L 04/06/2020 - 14:24:26: [SM] Blaming: tf2attributes.smx
L 04/06/2020 - 14:24:26: [SM] Call stack trace:
L 04/06/2020 - 14:24:26: [SM] [0] SetFailState
L 04/06/2020 - 14:24:26: [SM] [1] Line 189, S:\Hard Drive Backup\SourceMod\tf2attributes\tf2attributes. sp::OnPluginStart
L 04/06/2020 - 14:24:26: [SM] Unable to load plugin "tf2attributes.smx": Error detected in plugin startup (see error logs)
Are you sure that you don't have any duplicate plugins that create TF2Attrib_SetByName native?
__________________

Last edited by MAGNAT2645; 04-06-2020 at 16:20.
MAGNAT2645 is offline
Nightmare Pyro
Member
Join Date: Mar 2020
Location: Cedar Falls
Old 04-06-2020 , 20:35   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #593

Discard about dodgeball I am not interested to make dodgeball anymore. However, I am using RTD plugin and I got this error.



L 04/06/2020 - 1928: [SM] Blaming: tf2attributes.smx
L 04/06/2020 - 1928: [SM] Call stack trace:
L 04/06/2020 - 1928: [SM] [0] LoadGameConfigFile
L 04/06/2020 - 1928: [SM] [1] Line 80, plugin.sp::OnPluginStart
L 04/06/2020 - 1928: [SM] Unable to load plugin "tf2attributes.smx": Error detected in plugin startup (see error logs)
L 04/06/2020 - 1928: [SM] Unable to load plugin "rtd.smx": Could not find required plugin "tf2attributes"
Nightmare Pyro is offline
DeadBoom
Member
Join Date: Sep 2014
Old 06-29-2020 , 07:08   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #594

Doesn't work with RTD? Missing .txt file?
DeadBoom is offline
torridgristle
Junior Member
Join Date: Aug 2020
Old 10-16-2020 , 20:40   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #595

Using TF2Attrib_GetByDefIndex(entity, 142); on a cosmetic--or perhaps anything but in this case a cosmetic which I have verified to be the correct entity ID--returns an address of zero. I know the cosmetic has paint on it so it should have the "set item tint RGB" attribute, all 3 of the cosmetics equipped while testing did.

I've tried running TF2Attrib_ClearCache(entity) and TF2Attrib_ClearCache(owner) to rebuild the attributes for cosmetics and players wearing them, but this didn't help either.

However. It seems that if I set "set item tint RGB" to some value, it'll then be able to find an actual address. Or this and then also TF2Attrib_ClearCache(entity).

How do I make this give me a usable address so I can load the existing paint colors?
torridgristle is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 10-16-2020 , 22:45   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #596

torridgristle... It's my understanding that the TF2 Attributes 'Get' functions will only work to get a value for something set by the TF2 Attributes 'Set' functions.

In other words, you won't be able to use TF2 Attributes to find the attribute values of an item unless they were previously set by TF2 Attributes.
PC Gamer is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 10-16-2020 , 23:15   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #597

Quote:
Originally Posted by torridgristle View Post
Using TF2Attrib_GetByDefIndex(entity, 142); on a cosmetic--or perhaps anything but in this case a cosmetic which I have verified to be the correct entity ID--returns an address of zero. I know the cosmetic has paint on it so it should have the "set item tint RGB" attribute, all 3 of the cosmetics equipped while testing did.

How do I make this give me a usable address so I can load the existing paint colors?
There's a couple of different ways attributes are stored.

TF2Attrib_*ByDefIndex operates on runtime attributes. These are mainly used by plugins and things like the Dalokoh's / MvM.

TF2Attrib_GetSOCAttribs reads item server / inventory attributes. It sounds like you were looking at this based on the Discord conversation, so I'm not sure why you couldn't get this to work. I have an older plugin that uses this method.

In my fork, I added TF2Attrib_HookValueInt, which takes an attribute class (not name!) and determines the output value based on runtime / static / item server atttributes. You can get the raw paint value by doing something like the following:

Code:
int value = TF2Attrib_HookValueInt(0, "set_item_tint_rgb", item); // outputs a raw RGB value
__________________
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
torridgristle
Junior Member
Join Date: Aug 2020
Old 10-17-2020 , 12:28   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #598

nosoop... this works perfectly. It just does exactly what I wanted it to do, and what it says it'll do. Thank you.

For anyone finding this in search results, I ended up using the version for floats and not integers to get the paint values since it turns out to be stored this way.
torridgristle is offline
DreadedGhoul575
Senior Member
Join Date: Apr 2016
Old 12-16-2020 , 08:50   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #599

Unable to download the plug-in oddly (happens with other ones as well).
DreadedGhoul575 is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 02-14-2021 , 07:38   Re: [TF2] TF2Attributes (v1.2.1, 07/02/2015)
Reply With Quote #600

I now have a developer preview up in my releases that adds support for string attributes.

You still can't do things like set custom names / descriptions (this will probably never happen), but you can now read them, and you can set attributes given the name and string value (mainly the server-sided things like custom projectile model).

Code:
// read the custom name on an item, or "NO NAME" if the item doesn't have a custom name
// note that you must use the attribute class, not the name
TF2Attrib_HookValueString("NO NAME", "custom_name_attr", entity, buffer, sizeof(buffer));

// set a custom projectile model on a weapon
TF2Attrib_SetFromStringValue(entity, "custom projectile model", "models/weapons/c_models/c_grenadelauncher/c_grenadelauncher.mdl");

// you can even read off strings from somewhere and do this and it will Just Work(tm) for setting it as any type the game supports
TF2Attrib_SetFromStringValue(entity, "fire rate bonus HIDDEN", "0.2");
Let me know if you run into any issues with this one.
__________________
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)

Last edited by nosoop; 02-14-2021 at 10:37.
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 07:49.


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