Here's to hoping someone can shed some light on an issue I have having lately with this plugin. I am running this plugin on my mixed mod server and lately I have been receiving the following errors in console as well as bugs within the given weapon.
Code:
L 05/10/2014 - 07:07:40: SourceMod error session started
L 05/10/2014 - 07:07:40: Info (map "tfdb_facility_a1") (file "errors_20140510.log")
L 05/10/2014 - 07:07:40: [TF2ITEMS] ---------------------------------------
L 05/10/2014 - 07:07:40: [TF2ITEMS] >>> szClassname = tf_weapon_flamethrower
L 05/10/2014 - 07:07:40: [TF2ITEMS] >>> iItemDefinitionIndex = 21
L 05/10/2014 - 07:07:40: [TF2ITEMS] >>> iEntityQuality = 6
L 05/10/2014 - 07:07:40: [TF2ITEMS] >>> iEntityLevel = 1
L 05/10/2014 - 07:07:40: [TF2ITEMS] ---------------------------------------
L 05/10/2014 - 07:07:40: [TF2ITEMS] >>> iAttributeDefinitionIndex = 254
L 05/10/2014 - 07:07:40: [TF2ITEMS] >>> flValue = 4.000000
L 05/10/2014 - 07:07:40: [TF2ITEMS] ---------------------------------------
L 05/10/2014 - 07:07:40: [TF2ITEMS] >>> iAttributeDefinitionIndex = 256
L 05/10/2014 - 07:07:40: [TF2ITEMS] >>> flValue = 0.500000
L 05/10/2014 - 07:07:40: [TF2ITEMS] ---------------------------------------
L 05/10/2014 - 07:07:40: [SM] Native "TF2Items_GiveNamedItem" reported: Item is NULL. File a bug report if you are sure you set all the data correctly. (Try the FORCE_GENERATION flag.)
L 05/10/2014 - 07:07:40: [SM] Displaying call stack trace for plugin "optional\tNoUnlocksPls.tf2items.smx":
L 05/10/2014 - 07:07:40: [SM] [0] Line 119, I:\TCAFiles\Users\startstop\29_27015\tf\addons\sourcemod\scripting\tNoUnlocksPls.tf2items_dodgeball.sp::GiveReplacementItem()
L 05/10/2014 - 07:07:40: [SM] [1] Line 99, I:\TCAFiles\Users\startstop\29_27015\tf\addons\sourcemod\scripting\tNoUnlocksPls.tf2items_dodgeball.sp::Timer_ReplaceWeapon()
L 05/10/2014 - 07:09:31: Error log file session closed.
The issue it presents (which might confuse you) is that even though is does indeed replace the stock weapon with the desired item, the attributes don't seem to always apply correctly. There are times where the plugin functions perfectly fine for the Blue team but the Red team does not have the attribute 254 applied. This does not happen all the time but every so often it bugs out then it doesn't fix itself for quite some time.
Here is my code this was compiled off of for reference:
Spoiler
PHP Code:
#pragma semicolon 1 #include <sourcemod> #include <tf2_stocks> #include <smlib> #include <tf2items> #undef REQUIRE_PLUGIN #include <tNoUnlocksPls> #include <updater> #define VERSION "0.4.0" #define UPDATE_URL "http://updates.thrawn.de/tNoUnlocksPls/package.tNoUnlocksPls.tf2items.cfg" #define WEIGHT 50 new bool:g_bCoreAvailable = false; public Plugin:myinfo = { name = "tNoUnlocksPls - TF2Items", author = "Thrawn", description = "Block unlocks using the TF2Items extension.", version = VERSION, url = "http://forums.alliedmods.net/showthread.php?t=140045" }; public OnPluginStart() { CreateConVar("sm_tnounlockspls_tf2items_version", VERSION, "[TF2] tNoUnlocksPls - TF2Items", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD); if (LibraryExists("updater")) { Updater_AddPlugin(UPDATE_URL); } if (LibraryExists("tNoUnlocksPls")) { tNUP_ReportWeight(WEIGHT); g_bCoreAvailable = true; } } public OnLibraryAdded(const String:name[]) { if (StrEqual(name, "tNoUnlocksPls")) { tNUP_ReportWeight(WEIGHT); g_bCoreAvailable = true; } if (StrEqual(name, "updater"))Updater_AddPlugin(UPDATE_URL); } public OnLibraryRemoved(const String:name[]) { if (StrEqual(name, "tNoUnlocksPls")) { g_bCoreAvailable = false; } } public TF2Items_OnGiveNamedItem_Post(client, String:classname[], iItemDefinitionIndex, itemLevel, itemQuality, entityIndex) { if(!g_bCoreAvailable || !tNUP_IsEnabled() || !tNUP_UseThisModule() || iItemDefinitionIndex < 35) return; if(tNUP_BlockSetHats() && tNUP_IsSetHatAndShouldBeBlocked(iItemDefinitionIndex)) { tNUP_AnnounceBlock(client, iItemDefinitionIndex); new Handle:hTrie = CreateTrie(); SetTrieValue(hTrie, "client", client); SetTrieValue(hTrie, "entityIndex", entityIndex); CreateTimer(0.1, Timer_ReplaceWeapon, hTrie); return; } if(tNUP_IsItemBlocked(iItemDefinitionIndex) || (tNUP_BlockStrangeWeapons() && itemQuality != QUALITY_STRANGE)) { tNUP_AnnounceBlock(client, iItemDefinitionIndex); new Handle:hTrie = CreateTrie(); SetTrieValue(hTrie, "client", client); SetTrieValue(hTrie, "itemDefinitionIndex", iItemDefinitionIndex); SetTrieValue(hTrie, "entityIndex", entityIndex); CreateTimer(0.01, Timer_ReplaceWeapon, hTrie); return; } } public Action:Timer_ReplaceWeapon(Handle:timer, any:hTrie) { new entityIndex = -1; GetTrieValue(hTrie, "entityIndex", entityIndex); new client = -1; GetTrieValue(hTrie, "client", client); new iItemDefinitionIndex = -1; GetTrieValue(hTrie, "itemDefinitionIndex", iItemDefinitionIndex); CloseHandle(hTrie); if(IsValidEntity(entityIndex)) { RemovePlayerItem(client, entityIndex); Entity_Kill(entityIndex); if(iItemDefinitionIndex != -1) { GiveReplacementItem(client, iItemDefinitionIndex); } } } public GiveReplacementItem(client, iItemDefinitionIndex) { new iSlot = tNUP_GetWeaponSlotByIDI(iItemDefinitionIndex); new String:sWeaponClassName[128]; if(tNUP_GetDefaultWeaponForClass(TF2_GetPlayerClass(client), iSlot, sWeaponClassName, sizeof(sWeaponClassName))) { new iOverrideIDI = tNUP_GetDefaultIDIForClass(TF2_GetPlayerClass(client), iSlot); new Handle:hItem = TF2Items_CreateItem(OVERRIDE_CLASSNAME | OVERRIDE_ITEM_DEF | OVERRIDE_ITEM_LEVEL | OVERRIDE_ITEM_QUALITY | OVERRIDE_ATTRIBUTES); TF2Items_SetClassname(hItem, sWeaponClassName); TF2Items_SetItemIndex(hItem, iOverrideIDI); TF2Items_SetLevel(hItem, 1); TF2Items_SetQuality(hItem, 6); TF2Items_SetAttribute(hItem, 0, 254, 4.0); TF2Items_SetAttribute(hItem, 1, 256, 0.5); TF2Items_SetNumAttributes(hItem, 2); new iWeapon = TF2Items_GiveNamedItem(client, hItem); CloseHandle(hItem); EquipPlayerWeapon(client, iWeapon); } }
Anyone have any ideas as to the cause of the errors and possibly the issue I am having? Please note that I do understand that using an attribute that Valve does not use always leaves the door open for bugs. If ALL players lost the attribute when the bug occured it would be annoying but fair, but for only one team to lose the attribute makes me think it's the plugin and not just the attribute itself.
Thank you in advance to ANYONE who can provide ANY thoughts or ideas on this.
I have a problem in a similar vein as the above post. A special mixed-mod setup I'm trying to get working requires me to revert all unlocked weapons to default, and then furthermore apply different stats to the vanilla weapons. TF2Items' include allows for manual adjustment on an item-to-item basis (like above, giving everyone the same flamethrower), but I would prefer to not have to set up manual adjustment of every class's weapons within the source code. Is there a way to make attributes be read through tf2items.weapons.txt? I have a suspicion that it would also solve the flamethrower problem above...
Anyone have any ideas as to the cause of the errors and possibly the issue I am having? Please note that I do understand that using an attribute that Valve does not use always leaves the door open for bugs. If ALL players lost the attribute when the bug occured it would be annoying but fair, but for only one team to lose the attribute makes me think it's the plugin and not just the attribute itself.
Thank you in advance to ANYONE who can provide ANY thoughts or ideas on this.
I think that if you use a default flame thrower that code doesn't do anything, but you are saying that the problem is just one team so that is not it.
I'm not relly sure why or how did I do this (I edited this long ago), but here is my part of that code to apply the attribute:
Spoiler
PHP Code:
public GiveReplacementItem(client, iItemDefinitionIndex) {
new iSlot = tNUP_GetWeaponSlotByIDI(iItemDefinitionIndex);
new String:sWeaponClassName[128];
if(tNUP_GetDefaultWeaponForClass(TF2_GetPlayerClass(client), iSlot, sWeaponClassName, sizeof(sWeaponClassName))) {
new iOverrideIDI = tNUP_GetDefaultIDIForClass(TF2_GetPlayerClass(client), iSlot);
I have a problem in a similar vein as the above post. A special mixed-mod setup I'm trying to get working requires me to revert all unlocked weapons to default, and then furthermore apply different stats to the vanilla weapons. TF2Items' include allows for manual adjustment on an item-to-item basis (like above, giving everyone the same flamethrower), but I would prefer to not have to set up manual adjustment of every class's weapons within the source code. Is there a way to make attributes be read through tf2items.weapons.txt? I have a suspicion that it would also solve the flamethrower problem above...
I'm interested in the same idea. Having the plugin replace blocked weapons with modified stock ones via tf2items.weapons.txt. Anyone?
My tnounlocksplz.cfg seems to reset to default after server reboots. I ban the gunslinger but everyday it becomes usable again. Anyone have a solution?
UPDATE: I was able to resolve my issue above. The plugin autocreates the .cfg files but on linux the filename is case sensitive. It must be named tNoUnlocksPls.cfg. Hope it helps anyone in the future having the same issue.
i can't ban weapons that have a weapon index of 4 digits so i manually enter the index in into tnounlockspls.cfg and save, it works but at random the config files removes the 4 digit weapon index and unbans them. any ideas?
i can't ban weapons that have a weapon index of 4 digits so i manually enter the index in into tnounlockspls.cfg and save, it works but at random the config files removes the 4 digit weapon index and unbans them. any ideas?
with the help of a few guys in the sourcemod IRC channel, this can easily be fixed by adjusting the sIDx from 4 to 8 and modifying the 'char' to something else in the main plugin, and recompiling.