PDA

View Full Version : "unknown entity type tf_weapon_shotgun!"


CoolJosh3k
05-29-2013, 16:26
While testing a plugin, I noticed the following error.


Attempted to create unknown entity type tf_weapon_shotgun!
Failed to generate base item: tf_weapon_shotgun
L 05/30/2013 - 06:06:10: [TF2ITEMS] ---------------------------------------
L 05/30/2013 - 06:06:10: [TF2ITEMS] >>> szClassname = tf_weapon_shotgun
L 05/30/2013 - 06:06:10: [TF2ITEMS] >>> iItemDefinitionIndex = 10
L 05/30/2013 - 06:06:10: [TF2ITEMS] >>> iEntityQuality = 6
L 05/30/2013 - 06:06:10: [TF2ITEMS] >>> iEntityLevel = 1
L 05/30/2013 - 06:06:10: [TF2ITEMS] ---------------------------------------
L 05/30/2013 - 06:06:10: [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.)


Resulted in both server crashes and tf2items to partially stop working.


new def_sol_sec_itemid = 10;

public ItemApply(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new TFClassType:class = TFClassType:TF2_GetPlayerClass(client);
decl slotid[11];
if (class == TFClass_Soldier)
{
slotid[1] = GetPlayerWeaponSlot(client, 1);
if (slotid[1] == -1 && (GetConVarInt(disable_flags_solly) & 2) == 0)
{
new Handle:item = TF2Items_CreateItem(OVERRIDE_ALL | FORCE_GENERATION);
TF2Items_SetClassname(item, "tf_weapon_shotgun");
TF2Items_SetItemIndex(item, def_sol_sec_itemid);
TF2Items_SetQuality(item, 6);
TF2Items_SetLevel(item, 1);
TF2Items_SetNumAttributes(item, 0);
slotid[1] = TF2Items_GiveNamedItem(client, item);
EquipPlayerWeapon(client, slotid[1]);
CloseHandle(item);
}
}
}


I have code just like this that works for the Scout, perfectly. The issue only seems to happen with the shotgun. I also tried using id 199.

edit: forgot to post the versions


Metamod:Source version 1.9.3-dev
Build ID: 819:7c5b4fa4ccdc-dev
Loaded As: Valve Server Plugin
Compiled on: May 13 2013
Plugin interface version: 15:14
SourceHook version: 5:5



SourceMod Version: 1.5.0-dev+3841
SourcePawn Engine: SourcePawn 1.1, jit-x86 (build 1.5.0-dev+3841)
SourcePawn API: v1 = 4, v2 = 4
Compiled on: May 16 2013 08:01:53
Build ID: 3841:5f829335d94a



Title: [TF2Items] Manager ([TF2Items] Manager)
Author: Damizean & Asherkin
Version: 1.4.1

asherkin
05-29-2013, 16:43
tf_weapon_shotgun isn't a real entity, it's needs mapping to the real item by the game, remove the FORCE_GENERATION flag.

CoolJosh3k
05-29-2013, 16:46
I thought the FORCE_GENERATION flag was optional so I just included it on everything.

Could you explain a little about when to, and not to, use that flag? I have 30+ different things with it.

CoolJosh3k
05-30-2013, 00:39
Ah, I see that not everything in the items_game.txt is reliable (or I fail to read it right). When I checked the datamaps.txt I was able to locate the correct item class names.

I did hit a snag with Ali Baba's Wee Booties though. The "tf_wearable" class causes a crash, with no log file to be found.

edit: "tf_weapon_sapper" doesn't crash or anything, but it won't apply the item either. It just results in having no sapper at all.

Powerlord
05-30-2013, 01:22
tf_weapon_shotgun automatically maps to one of these depending on the class:

Engineer - tf_weapon_shotgun_primary
Soldier - tf_weapon_shotgun_soldier
Pyro - tf_weapon_shotgun_pyro
Heavy - tf_weapon_shotgun_hwg