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(client, 1);
new Handle:hWeapon = TF2Items_CreateItem(OVERRIDE_ALL);
TF2Items_SetClassname(hWeapon, "tf_weapon_shotgun_soldier");
TF2Items_SetItemIndex(hWeapon, 10);
TF2Items_SetLevel(hWeapon, 99);
TF2Items_SetQuality(hWeapon, 9);
TF2Items_SetNumAttributes(hWeapon, 11);
TF2Items_SetAttribute(hWeapon, 0, ATTRIB_CRIT_DISABLE, 0.0);
TF2Items_SetAttribute(hWeapon, 1, ATTRIB_CANCEL_FALL, 1.0);
TF2Items_SetAttribute(hWeapon, 2, ATTRIB_SPREAD_BONUS, 0.0);
TF2Items_SetAttribute(hWeapon, 3, ATTRIB_SNIPER_PENETRATE_CHARGE, 1.0);
TF2Items_SetAttribute(hWeapon, 4, ATTRIB_MULT_BULLETS_PER_SHOT, 0.1);
TF2Items_SetAttribute(hWeapon, 5, ATTRIB_FIRERATE_PENALTY, 1.75);
TF2Items_SetAttribute(hWeapon, 6, ATTRIB_CRIT_KILL_GIB, 1.0);
TF2Items_SetAttribute(hWeapon, 7, ATTRIB_SHOT_PENETRATE_ALL, 1.0);
TF2Items_SetAttribute(hWeapon, 8, ATTRIB_PROJECTILE_PENETRATION, 1.0);
TF2Items_SetAttribute(hWeapon, 9, ATTRIB_SNIPER_FIRES_TRACER, 1.0);
TF2Items_SetAttribute(hWeapon, 10, ATTRIB_DECREASE_DEPLOYTIME, 0.32);
new SecondaryWeapon = TF2Items_GiveNamedItem(client, hWeapon);
EquipPlayerWeapon(client, SecondaryWeapon);
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.