Raised This Month: $51 Target: $400
 12% 

"unknown entity type tf_weapon_shotgun!"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 05-29-2013 , 16:26   "unknown entity type tf_weapon_shotgun!"
Reply With Quote #1

While testing a plugin, I noticed the following error.

Code:
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.

PHP Code:
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(client1);
        if (
slotid[1] == -&& (GetConVarInt(disable_flags_solly) & 2) == 0)
        {
            new 
Handle:item TF2Items_CreateItem(OVERRIDE_ALL FORCE_GENERATION);
            
TF2Items_SetClassname(item"tf_weapon_shotgun");
            
TF2Items_SetItemIndex(itemdef_sol_sec_itemid);
            
TF2Items_SetQuality(item6);
            
TF2Items_SetLevel(item1);
            
TF2Items_SetNumAttributes(item0);
            
slotid[1] = TF2Items_GiveNamedItem(clientitem);
            
EquipPlayerWeapon(clientslotid[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

Code:
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
Code:
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
Code:
Title: [TF2Items] Manager ([TF2Items] Manager)
Author: Damizean & Asherkin
Version: 1.4.1

Last edited by CoolJosh3k; 05-29-2013 at 16:33. Reason: forgot to post version
CoolJosh3k is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-29-2013 , 16:43   Re: "unknown entity type tf_weapon_shotgun!"
Reply With Quote #2

tf_weapon_shotgun isn't a real entity, it's needs mapping to the real item by the game, remove the FORCE_GENERATION flag.
__________________
asherkin is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 05-29-2013 , 16:46   Re: "unknown entity type tf_weapon_shotgun!"
Reply With Quote #3

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 is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 05-30-2013 , 00:39   Re: "unknown entity type tf_weapon_shotgun!"
Reply With Quote #4

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.

Last edited by CoolJosh3k; 05-30-2013 at 00:58.
CoolJosh3k is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-30-2013 , 01:22   Re: "unknown entity type tf_weapon_shotgun!"
Reply With Quote #5

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
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 03:41.


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