Raised This Month: $32 Target: $400
 8% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 04-03-2014 , 04:03   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #191

Quote:
Originally Posted by FlaminSarge View Post
That was uncharacteristically mean...
Wasn't supposed to be; I was just trying to point out that he needed quotes around a string value.

Although that wasn't the problem anyway since that parameter wasn't supposed to be a string (I don't use this plugin, and I didn't bother to check).
__________________
Dr. McKay is offline
xerox_i_
Member
Join Date: Mar 2013
Old 04-03-2014 , 10:26   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #192

Quote:
Originally Posted by 11530 View Post
You didn't read Powerlord's post above, did you?
yeah i have read but i dont understand i'm noob on scripting
__________________
~SirXeroX

-BPC Gaming!
xerox_i_ is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 04-06-2014 , 12:07   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #193

Cannot get/set attributes on weapons for some reason.

My relevant code looks like this:

PHP Code:

new Handle:hDebug;
…SNIP
new weaponid[6];        //would normally declare this as needed, but this way saves proccessing time later
new attrib_index[3] = {3471502027};        //Freeze victim, Golden victim, Is Australium

public OnPluginStart()
{
…SNIP
    hDebug 
CreateConVar("enable_weaponfx_debug""0""Enables printing of debuging information to the server.");
…SNIP
    HookEvent
("post_inventory_application"Event_PlayerEquipItem);
…SNIP
}

public 
Action:Event_PlayerEquipItem(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (
GetConVarInt(hDebug))
    {
        
PrintToServer("D0013:%i"client);
    }
    for (new 
i<6i++)
    {
        
weaponid[i] = GetPlayerWeaponSlot(clienti);        //Check all possible slots a weapon could be in
…SNIP
                
if (GetConVarInt(hDebug))
                {
                    
PrintToServer("D0012:%i,%i"iGetEntProp(weaponid[i], Prop_Send"m_iItemDefinitionIndex"));
                    
PrintToServer("D0011:%i,%i"iTF2Attrib_GetByDefIndex(weaponid[i], attrib_index[2]));
                }
                if (
TF2Attrib_GetByDefIndex(weaponid[i], attrib_index[2]) != Address_Null)        //Check if australium
                
{
                    if (!(
TF2Attrib_SetByDefIndex(weaponid[i], attrib_index[1], 1.0)))        //Set the attribute if it doesn't already exist
                    
{
                        
PrintToServer("WeaponsFX Error: Could not add attribute %i on client i%"attrib_index[1], client);
                    }
                }
…SNIP

I just cannot seem to figure out what is going on. Everything else is working for me, just not the tf2attributes stuff.
I should also mention that the line
PHP Code:
PrintToServer("WeaponsFX Error: Could not add attribute %i on client i%"attrib_index[1], client); 
does not trigger

My testing versions are:

Code:
] version
Build Label:           2177902   # Uniquely identifies each build
Network PatchVersion:  2177902   # Determines client and server compatibility
Protocol version:           24   # High level network protocol version
] meta list
Listing 5 plugins:
  [01] SourceMod (1.5.3-dev+4006) by AlliedModders LLC
  [02] TF2Items (1.5.3) by Asherkin & AzuiSleet & Damizean
  [03] TF2 Tools (1.5.3-dev+4006) by AlliedModders LLC
  [04] SDK Hooks (1.5.3-dev+4006) by AlliedModders LLC
  [05] SDK Tools (1.5.3-dev+4006) by AlliedModders LLC
] meta version
Metamod:Source version 1.10.1-dev
Build ID: 882:5605b95026b8-dev
Loaded As: Valve Server Plugin
Compiled on: Mar  3 2014
Plugin interface version: 15:14
SourceHook version: 5:5
http://www.metamodsource.net/
] sm version
 SourceMod Version Information:
    SourceMod Version: 1.5.3-dev+4006
    SourcePawn Engine: SourcePawn 1.1, jit-x86 (build 1.5.3-dev+4006)
    SourcePawn API: v1 = 4, v2 = 4
    Compiled on: Mar  5 2014 09:51:03
    Build ID: 4006:7928ab66ecd5
    http://www.sourcemod.net/
] sm plugins list
[SM] Listing 26 plugins:
  01 "Admin File Reader" (1.5.3-dev+4006) by AlliedModders LLC
  02 "Admin Help" (1.5.3-dev+4006) by AlliedModders LLC
  03 "Admin Menu" (1.5.3-dev+4006) by AlliedModders LLC
  04 <Error> "Advertisements" (0.6) by Tsunami
  05 "Anti-Flood" (1.5.3-dev+4006) by AlliedModders LLC
  06 "Basic Ban Commands" (1.5.3-dev+4006) by AlliedModders LLC
  07 "Basic Chat" (1.5.3-dev+4006) by AlliedModders LLC
  08 "Basic Comm Control" (1.5.3-dev+4006) by AlliedModders LLC
  09 "Basic Commands" (1.5.3-dev+4006) by AlliedModders LLC
  10 "Basic Info Triggers" (1.5.3-dev+4006) by AlliedModders LLC
  11 "Basic Votes" (1.5.3-dev+4006) by AlliedModders LLC
  12 "Client Preferences" (1.5.3-dev+4006) by AlliedModders LLC
  13 "Fun Commands" (1.5.3-dev+4006) by AlliedModders LLC
  14 "Fun Votes" (1.5.3-dev+4006) by AlliedModders LLC
  15 "MapChooser" (1.5.2-dev+3930) by AlliedModders LLC
  16 "Nextmap" (1.5.3-dev+4006) by AlliedModders LLC
  17 "Map Nominations" (1.5.2-dev+3930) by AlliedModders LLC
  18 "Player Commands" (1.5.3-dev+4006) by AlliedModders LLC
  19 "Reserved Slots" (1.5.3-dev+4006) by AlliedModders LLC
  20 "Sound Commands" (1.5.3-dev+4006) by AlliedModders LLC
  21 "TF2 Set Class" (1.2.2) by Tylerst
  22 "[TF2] TF2Attributes" (1.1.1) by FlaminSarge
  23 "[DEV] TF2ItemsInfo" (1.8.17.7-20131121) by Leonardo
  24 "[TF2Items] Give Weapon" (3.14159) by FlaminSarge (orig by asherkin)
  25 "[TF2Items] Manager" (1.4.1) by Damizean & Asherkin
  26 "WeaponsFX Plus" (1.2.2) by CoolJosh3k
Load Errors:
Advertisements: File Not Found: addons\sourcemod\configs\advertisements.txt
] sm exts list
[SM] Displaying 10 extensions:
[01] Automatic Updater (1.5.3-dev+4006): Updates SourceMod gamedata files
[02] Webternet (1.5.3-dev+4006): Extension for interacting with URLs
[03] TF2Items (1.5.3): TF2 Item Modifier
[04] TF2 Tools (1.5.3-dev+4006): TF2 extended functionality
[05] BinTools (1.5.3-dev+4006): Low-level C/C++ Calling API
[06] SDK Hooks (1.5.3-dev+4006): Source SDK Hooks
[07] Top Menus (1.5.3-dev+4006): Creates sorted nested menus
[08] SDK Tools (1.5.3-dev+4006): Source SDK Tools
[09] Client Preferences (1.5.3-dev+4006): Saves client preference settings
[10] SQLite (1.5.3-dev+4006): SQLite Driver

Last edited by CoolJosh3k; 04-06-2014 at 12:08.
CoolJosh3k is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-06-2014 , 12:26   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #194

Quote:
Originally Posted by CoolJosh3k View Post
Cannot get/set attributes on weapons for some reason.

My relevant code looks like this:

PHP Code:

new Handle:hDebug;
…SNIP
new weaponid[6];        //would normally declare this as needed, but this way saves proccessing time later
new attrib_index[3] = {3471502027};        //Freeze victim, Golden victim, Is Australium

public OnPluginStart()
{
…SNIP
    hDebug 
CreateConVar("enable_weaponfx_debug""0""Enables printing of debuging information to the server.");
…SNIP
    HookEvent
("post_inventory_application"Event_PlayerEquipItem);
…SNIP
}

public 
Action:Event_PlayerEquipItem(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (
GetConVarInt(hDebug))
    {
        
PrintToServer("D0013:%i"client);
    }
    for (new 
i<6i++)
    {
        
weaponid[i] = GetPlayerWeaponSlot(clienti);        //Check all possible slots a weapon could be in
…SNIP
                
if (GetConVarInt(hDebug))
                {
                    
PrintToServer("D0012:%i,%i"iGetEntProp(weaponid[i], Prop_Send"m_iItemDefinitionIndex"));
                    
PrintToServer("D0011:%i,%i"iTF2Attrib_GetByDefIndex(weaponid[i], attrib_index[2]));
                }
                if (
TF2Attrib_GetByDefIndex(weaponid[i], attrib_index[2]) != Address_Null)        //Check if australium
                
{
                    if (!(
TF2Attrib_SetByDefIndex(weaponid[i], attrib_index[1], 1.0)))        //Set the attribute if it doesn't already exist
                    
{
                        
PrintToServer("WeaponsFX Error: Could not add attribute %i on client i%"attrib_index[1], client);
                    }
                }
…SNIP

I just cannot seem to figure out what is going on. Everything else is working for me, just not the tf2attributes stuff.
I should also mention that the line
PHP Code:
PrintToServer("WeaponsFX Error: Could not add attribute %i on client i%"attrib_index[1], client); 
does not trigger

My testing versions are:

Code:
] version
Build Label:           2177902   # Uniquely identifies each build
Network PatchVersion:  2177902   # Determines client and server compatibility
Protocol version:           24   # High level network protocol version
] meta list
Listing 5 plugins:
  [01] SourceMod (1.5.3-dev+4006) by AlliedModders LLC
  [02] TF2Items (1.5.3) by Asherkin & AzuiSleet & Damizean
  [03] TF2 Tools (1.5.3-dev+4006) by AlliedModders LLC
  [04] SDK Hooks (1.5.3-dev+4006) by AlliedModders LLC
  [05] SDK Tools (1.5.3-dev+4006) by AlliedModders LLC
] meta version
Metamod:Source version 1.10.1-dev
Build ID: 882:5605b95026b8-dev
Loaded As: Valve Server Plugin
Compiled on: Mar  3 2014
Plugin interface version: 15:14
SourceHook version: 5:5
http://www.metamodsource.net/
] sm version
 SourceMod Version Information:
    SourceMod Version: 1.5.3-dev+4006
    SourcePawn Engine: SourcePawn 1.1, jit-x86 (build 1.5.3-dev+4006)
    SourcePawn API: v1 = 4, v2 = 4
    Compiled on: Mar  5 2014 09:51:03
    Build ID: 4006:7928ab66ecd5
    http://www.sourcemod.net/
] sm plugins list
[SM] Listing 26 plugins:
  01 "Admin File Reader" (1.5.3-dev+4006) by AlliedModders LLC
  02 "Admin Help" (1.5.3-dev+4006) by AlliedModders LLC
  03 "Admin Menu" (1.5.3-dev+4006) by AlliedModders LLC
  04 <Error> "Advertisements" (0.6) by Tsunami
  05 "Anti-Flood" (1.5.3-dev+4006) by AlliedModders LLC
  06 "Basic Ban Commands" (1.5.3-dev+4006) by AlliedModders LLC
  07 "Basic Chat" (1.5.3-dev+4006) by AlliedModders LLC
  08 "Basic Comm Control" (1.5.3-dev+4006) by AlliedModders LLC
  09 "Basic Commands" (1.5.3-dev+4006) by AlliedModders LLC
  10 "Basic Info Triggers" (1.5.3-dev+4006) by AlliedModders LLC
  11 "Basic Votes" (1.5.3-dev+4006) by AlliedModders LLC
  12 "Client Preferences" (1.5.3-dev+4006) by AlliedModders LLC
  13 "Fun Commands" (1.5.3-dev+4006) by AlliedModders LLC
  14 "Fun Votes" (1.5.3-dev+4006) by AlliedModders LLC
  15 "MapChooser" (1.5.2-dev+3930) by AlliedModders LLC
  16 "Nextmap" (1.5.3-dev+4006) by AlliedModders LLC
  17 "Map Nominations" (1.5.2-dev+3930) by AlliedModders LLC
  18 "Player Commands" (1.5.3-dev+4006) by AlliedModders LLC
  19 "Reserved Slots" (1.5.3-dev+4006) by AlliedModders LLC
  20 "Sound Commands" (1.5.3-dev+4006) by AlliedModders LLC
  21 "TF2 Set Class" (1.2.2) by Tylerst
  22 "[TF2] TF2Attributes" (1.1.1) by FlaminSarge
  23 "[DEV] TF2ItemsInfo" (1.8.17.7-20131121) by Leonardo
  24 "[TF2Items] Give Weapon" (3.14159) by FlaminSarge (orig by asherkin)
  25 "[TF2Items] Manager" (1.4.1) by Damizean & Asherkin
  26 "WeaponsFX Plus" (1.2.2) by CoolJosh3k
Load Errors:
Advertisements: File Not Found: addons\sourcemod\configs\advertisements.txt
] sm exts list
[SM] Displaying 10 extensions:
[01] Automatic Updater (1.5.3-dev+4006): Updates SourceMod gamedata files
[02] Webternet (1.5.3-dev+4006): Extension for interacting with URLs
[03] TF2Items (1.5.3): TF2 Item Modifier
[04] TF2 Tools (1.5.3-dev+4006): TF2 extended functionality
[05] BinTools (1.5.3-dev+4006): Low-level C/C++ Calling API
[06] SDK Hooks (1.5.3-dev+4006): Source SDK Hooks
[07] Top Menus (1.5.3-dev+4006): Creates sorted nested menus
[08] SDK Tools (1.5.3-dev+4006): Source SDK Tools
[09] Client Preferences (1.5.3-dev+4006): Saves client preference settings
[10] SQLite (1.5.3-dev+4006): SQLite Driver
Is there anything in your SourceMod error log?

In fact, given then code, there should be errors as soon as i is 3 for most classes. This is because GetPlayerWeaponSlot will return -1 if the client has no weapon in that slot.

In addition to happening for slots where the player doesn't have any item (5+ for Spy, 3+ for all other classes except Engineer), it also happens for any passive "weapons:" Soldier backpacks, Soldier shoes, Demoman shoes, Demoman shields, and Sniper shields.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 04-06-2014 , 12:44   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #195

There is some of the code snipped out, that is an if statement. It checks that i != -1.

It is on the 2 lines right before
PHP Code:
                if (GetConVarInt(hDebug)) 
                { 
                    
PrintToServer("D0012:%i,%i"iGetEntProp(weaponid[i], Prop_Send"m_iItemDefinitionIndex")); 
it has
PHP Code:
            if (weaponid[i] != -1)
            { 
I probably should have included that part above. My bad.
CoolJosh3k is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 04-06-2014 , 13:04   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #196

Just loaded the server back up and spawned in with festive weapon. Changed to my Australium Scatter and respawned. It appears in my hands just fine, so I disconnected and closed the server.

No sourcemod error log. Not even a normal log.
CoolJosh3k is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 04-13-2014 , 07:50   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #197

Apologies for the bump, but has anyone looked into this more? It has been a while now and I know I am not the only one with this issue.
CoolJosh3k is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 04-14-2014 , 18:29   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #198

Loadout/itemserver/stock attributes are no longer sent to the server on the weapons. I've got an update in the works that'll let you grab them anyways, but you won't be able to change them, though you can override them by adding the same attribute with a different value.
So basically, you can't see 2027 yet and that's why it won't work. You will be able to see 2027 at some point, but I need to push that update.

I've been talking about this update for a while, but haven't had time to complete it.
__________________
Bread EOTL GunMettle Invasion Jungle Inferno 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.

Last edited by FlaminSarge; 04-14-2014 at 18:34.
FlaminSarge is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 04-15-2014 , 06:18   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #199

Ah, Okay. Thanks for posting about that.

So I am guessing that once you are able to make it see weapon attribs, we can then emulate new attribs in some way? I imaging checking for when a player is holding the weapon and editing player attributes as a workaround.

BTW, any Paypal address I can use to donate to you? I would like to drop one of my standard $20 donations into your hands.
CoolJosh3k is offline
bovril
Member
Join Date: Jan 2011
Old 04-20-2014 , 04:44   Re: [TF2] TF2Attributes (v1.1.1, 08/27/2013)
Reply With Quote #200

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
bovril 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 08:31.


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