View Single Post
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