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
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