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] = {347, 150, 2027}; //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; i <6; i++)
{
weaponid[i] = GetPlayerWeaponSlot(client, i); //Check all possible slots a weapon could be in
…SNIP
if (GetConVarInt(hDebug))
{
PrintToServer("D0012:%i,%i", i, GetEntProp(weaponid[i], Prop_Send, "m_iItemDefinitionIndex"));
PrintToServer("D0011:%i,%i", i, TF2Attrib_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