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

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


Post New Thread Reply   
 
Thread Tools Display Modes
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-20-2014 , 05:08   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #201

Quote:
Originally Posted by bovril View Post
Should the following work?

PHP Code:
                for (new 06i++)
                {
                    
iEntity[i] = GetPlayerWeaponSlot(iTargeti);
                    
                    if (
iEntity[i] != -1) { 
                        new 
givenwepent TF2Items_GiveWeapon(iClientGetEntProp(iEntity[i], Prop_Send"m_iItemDefinitionIndex"));
                        new 
attriblist[16];
                        new 
Float:attriblistvalues[16];
                        new 
Address:attr;
                        
                        new 
count TF2Attrib_ListDefIndices(iEntity[i], attriblist);
                        for (new 
0countj++)
                        {
                            
attr TF2Attrib_GetByDefIndex(iEntity[i], attriblist[j]);
                            
attriblistvalues[j] = TF2Attrib_GetValue(attr);
                            
TF2Attrib_SetByDefIndex(givenwepentattriblist[j], attriblistvalues[j]);
                        }
                    }
                } 
The weapon is given ok but the attributes fail to arrive on the new weapon.

Nothing pertinent is in the event logs
Why are you attempting to give people a second (identical?) copy of a weapon they already have?

Besides which, the entity pointed to by iEntity[i] is deleted during the TF2Items_GiveWeapon call (tf2items_giveweapon.sp line 1144 calls RemoveEdict on it)... which makes me wonder how you're not getting errors in the TF2Attrib_ calls on it.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-20-2014 at 05:14.
Powerlord is offline
bovril
Member
Join Date: Jan 2011
Old 04-20-2014 , 07:38   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #202

Quote:
Originally Posted by Powerlord View Post
Why are you attempting to give people a second (identical?) copy of a weapon they already have?

Besides which, the entity pointed to by iEntity[i] is deleted during the TF2Items_GiveWeapon call (tf2items_giveweapon.sp line 1144 calls RemoveEdict on it)... which makes me wonder how you're not getting errors in the TF2Attrib_ calls on it.
iTarget is the bot, iClient is the human and iEntity[i] is the weapon entity that the bot is carrying. I'm trying to copy the weapon a bot has (attributes and all) and give it to a human player. All its doing is getting the weapon index from the weapon entity the bots has and using that as part of giveweapon.

After that I read the number of attributes the entity has, get the address of the entity and loop through reading their values into an array and writing the attribute and values onto the new weapon.

Why would iEntity be removed when all I'm using it for is to get the weapon index?

Last edited by bovril; 04-20-2014 at 07:46. Reason: extra words
bovril is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-20-2014 , 13:50   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #203

Quote:
Originally Posted by bovril View Post
iTarget is the bot, iClient is the human and iEntity[i] is the weapon entity that the bot is carrying. I'm trying to copy the weapon a bot has (attributes and all) and give it to a human player. All its doing is getting the weapon index from the weapon entity the bots has and using that as part of giveweapon.

After that I read the number of attributes the entity has, get the address of the entity and loop through reading their values into an array and writing the attribute and values onto the new weapon.

Why would iEntity be removed when all I'm using it for is to get the weapon index?
Oh, derp, I didn't notice one was iTarget and the other iClient.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 04-21-2014 , 02:35   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #204

The attribs you read will not be the entirety of attribs on the actual item, many will be skipped over.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 04-21-2014 , 17:25   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #205

After we find a players' weapons' attribs, we then have a few ways to deal with it.

1. Apply new attribs to the weapon (currently no longer works, thanks to Valve)
2. Replace the weapon with a new one, with all the attribs we want (should work very well)
3. Apply our new attribs to the player, for when they are holding the weapon and when actions occur. (alot of work and complex)

There could be more, but this is the way I see it.
In any instance that we replace a players weapon, we need to also make sure that the kill is tracked for the original weapon too, so that Stranges still get credit.
CoolJosh3k is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 04-25-2014 , 08:36   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #206

I need to figure out how to grab an attribute's default value (it's 1.0 for some, 0 for others, etc). If I do that, then you can reapply it to the weapon with the default value and it'll nullify it.


...Update soon, Valve time. Busy organizing natives and making this thing not fail every time a tiny bit of gamedata's missing.
__________________
Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.
FlaminSarge is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-02-2014 , 12:11   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #207

Quote:
Originally Posted by FlaminSarge View Post
I need to figure out how to grab an attribute's default value (it's 1.0 for some, 0 for others, etc). If I do that, then you can reapply it to the weapon with the default value and it'll nullify it.


...Update soon, Valve time. Busy organizing natives and making this thing not fail every time a tiny bit of gamedata's missing.
If I knew which methods you were using on the server side (or even which server class they're from), I could poke around and see if I can find anything.

and since my test server is a Linux machine, I can even do so without needing to generate binary signatures, which I'm terrible at... although I did recently find out about tools/gdc-psyfork in sourcemod-central.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Rd1981
Senior Member
Join Date: Apr 2011
Old 05-15-2014 , 20:43   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #208

L 05/15/2014 - 172:28: [SM] Native "SetFailState" reported: Could not initialize call to CEconItemSchema::GetAttributeDefinition
L 05/15/2014 - 172:28: [SM] Displaying call stack trace for plugin "tf2attributes.smx":
Rd1981 is offline
Horsedick
AlliedModders Donor
Join Date: Sep 2011
Old 05-15-2014 , 21:02   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #209

Quote:
Originally Posted by Rd1981 View Post
L 05/15/2014 - 172:28: [SM] Native "SetFailState" reported: Could not initialize call to CEconItemSchema::GetAttributeDefinition
L 05/15/2014 - 172:28: [SM] Displaying call stack trace for plugin "tf2attributes.smx":

https://forums.alliedmods.net/showthread.php?t=240457
Horsedick is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-15-2014 , 21:19   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #210

Quote:
Originally Posted by Rd1981 View Post
L 05/15/2014 - 172:28: [SM] Native "SetFailState" reported: Could not initialize call to CEconItemSchema::GetAttributeDefinition
L 05/15/2014 - 172:28: [SM] Displaying call stack trace for plugin "tf2attributes.smx":
Is this Windows or Linux/Mac?

I let FlaminSarge know someone was getting gamedata issues but he's busy.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-15-2014 at 21:37.
Powerlord 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 03:56.


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