Raised This Month: $7 Target: $400
 1% 

What am I doing wrong? (Crash, code snippet included)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
StrikerMan780
AlliedModders Donor
Join Date: Jul 2009
Location: Canada
Old 05-22-2018 , 00:18   What am I doing wrong? (Crash, code snippet included)
Reply With Quote #1

For some reason, at some point, this code started crashing TF2 (on the TF2Items_GiveNamedItem calls), but not always. Any ideas?

These functions are called at player spawn.
PHP Code:
public CreateQuakeRailgun(client)
{
    
TF2_RemoveWeaponSlot(client1);
                
    new 
Handle:hWeapon TF2Items_CreateItem(OVERRIDE_ALL);
    
    
TF2Items_SetClassname(hWeapon"tf_weapon_shotgun_soldier");
    
TF2Items_SetItemIndex(hWeapon10);
    
TF2Items_SetLevel(hWeapon99);
    
TF2Items_SetQuality(hWeapon9);
                
    
TF2Items_SetNumAttributes(hWeapon11);
    
TF2Items_SetAttribute(hWeapon0ATTRIB_CRIT_DISABLE0.0);
    
TF2Items_SetAttribute(hWeapon1ATTRIB_CANCEL_FALL1.0);
    
TF2Items_SetAttribute(hWeapon2ATTRIB_SPREAD_BONUS0.0);
    
TF2Items_SetAttribute(hWeapon3ATTRIB_SNIPER_PENETRATE_CHARGE1.0);
    
TF2Items_SetAttribute(hWeapon4ATTRIB_MULT_BULLETS_PER_SHOT0.1);
    
TF2Items_SetAttribute(hWeapon5ATTRIB_FIRERATE_PENALTY1.75);
    
TF2Items_SetAttribute(hWeapon6ATTRIB_CRIT_KILL_GIB1.0);
    
TF2Items_SetAttribute(hWeapon7ATTRIB_SHOT_PENETRATE_ALL1.0);
    
TF2Items_SetAttribute(hWeapon8ATTRIB_PROJECTILE_PENETRATION1.0);
    
TF2Items_SetAttribute(hWeapon9ATTRIB_SNIPER_FIRES_TRACER1.0);
    
TF2Items_SetAttribute(hWeapon10ATTRIB_DECREASE_DEPLOYTIME0.32);
    
    new 
SecondaryWeapon TF2Items_GiveNamedItem(clienthWeapon);
    
EquipPlayerWeapon(clientSecondaryWeapon);
    
CloseHandle(hWeapon);

This didn't cause a crash in 2013 or so. Now it does. I'm using the latest linux build of TF2Items. Server's running on Ubuntu.

Last edited by StrikerMan780; 05-22-2018 at 01:32.
StrikerMan780 is offline
StrikerMan780
AlliedModders Donor
Join Date: Jul 2009
Location: Canada
Old 05-22-2018 , 01:31   Re: What am I doing wrong? (Crash, code snippet included)
Reply With Quote #2

Ok, I've narrowed it down to the railgun code specifically. Removed the block that's fine from the first post.

I've tried to make tweaks to the railgun code, but this is what I end up with:

PHP Code:
L 05/22/2018 01:39:01: [SMCall stack trace:
L 05/22/2018 01:39:01: [SM]   [0TF2Items_GiveNamedItem
L 05
/22/2018 01:39:01: [SM]   [1Line 3275C:\Users\Striker\OneDrive\SourcePawn\Code\StrikerMod.sp::CreateQuakeRailgun
L 05
/22/2018 01:39:01: [SM]   [2Line 1654C:\Users\Striker\OneDrive\SourcePawn\Code\StrikerMod.sp::Event_PostInventoryApplication
L 05
/22/2018 01:39:01: [SM]   [4TF2_RespawnPlayer
L 05
/22/2018 01:39:01: [SM]   [5Line 2472C:\Users\Striker\OneDrive\SourcePawn\Code\StrikerMod.sp::RespawnPlayer
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> szClassname tf_weapon_shotgun
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> iItemDefinitionIndex 415
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> iEntityQuality 9
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> iEntityLevel 99
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 15
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 0.000000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 275
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 1.000000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 106
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 0.000000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 308
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 1.000000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 45
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 0.100000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 5
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 1.750000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 309
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 1.000000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 389
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 1.000000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 266
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 1.000000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 305
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 1.000000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [TF2ITEMS] >>> iAttributeDefinitionIndex 178
L 05
/22/2018 01:39:01: [TF2ITEMS] >>> flValue 0.320000
L 05
/22/2018 01:39:01: [TF2ITEMS] ---------------------------------------
L 05/22/2018 01:39:01: [SMException reportedItem is NULLFile a bug report if you are sure you set all the data correctly. (Try the FORCE_GENERATION flag.) 

Last edited by StrikerMan780; 05-22-2018 at 01:44.
StrikerMan780 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-22-2018 , 04:40   Re: What am I doing wrong? (Crash, code snippet included)
Reply With Quote #3

Did you try the FORCE_GENERATION flag? It exists for the cases where the classname is class-specific (like "tf_weapon_shotgun_soldier").

Code:
TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION);
__________________

Last edited by asherkin; 05-22-2018 at 04:40.
asherkin is offline
StrikerMan780
AlliedModders Donor
Join Date: Jul 2009
Location: Canada
Old 05-22-2018 , 05:29   Re: What am I doing wrong? (Crash, code snippet included)
Reply With Quote #4

I've got it figured out a short while ago, but thanks. That was it.
StrikerMan780 is offline
Reply


Thread Tools
Display Modes

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 07:27.


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