#include <sourcemod>
#include <tf2_stocks>
#include <tf2items>
#pragma newdecls required
#pragma semicolon 1
public void OnPluginStart()
{
RegAdminCmd("sm_giveitem", Command_GiveItem, ADMFLAG_CHEATS, "TF2Items give item test command.");
}
Action Command_GiveItem(int client, int args)
{
if (!client)
{
return Plugin_Handled;
}
Handle item = TF2Items_CreateItem(OVERRIDE_ALL);
if (!item)
{
return Plugin_Handled;
}
TF2_RemoveWeaponSlot(client, view_as<int>(TFWeaponSlot_Primary));
TF2Items_SetClassname(item, "tf_weapon_rocketlauncher");
TF2Items_SetItemIndex(item, 18);
TF2Items_SetLevel(item, 1);
TF2Items_SetQuality(item, 6);
int weapon = TF2Items_GiveNamedItem(client, item);
EquipPlayerWeapon(client, weapon);
delete item;
return Plugin_Handled;
}
Description
Plugins using the
TF2Items_CreateItemnative throws this error.Error log from Sourcemod.
Steps to Reproduce
scripting/includefolder.sm_giveitemcommand.Test Server Details
'soup' dump
Test Plugin Code
Code
Workarounds
I have found two workarounds for this issue.
builds.limetech.io).tf2items.autoloadfromaddons/sourcemod/extensions/