Hi all. I have problem with creating a stock weapon, for example: I want to restrict The Beggar's Bazooka on my jm server (cos this is bugged weapon for jump mod, you can fly with it).
So this is my three functions:
-------------------------------------------------------------------------------
SetupWeapons()
{
g_hWeaponRocketLauncher = CreateStockWeapon("tf_weapon_rocketlauncher", 1
;
}
Handle:CreateStockWeapon(String:classname[], index)
{
new Handle:hWeapon = TF2Items_CreateItem(OVERRIDE_ALL);
TF2Items_SetClassname(hWeapon, classname);
TF2Items_SetItemIndex(hWeapon, index);
TF2Items_SetFlags(hWeapon, 0);
TF2Items_SetLevel(hWeapon, 0);
TF2Items_SetQuality(hWeapon, 0);
TF2Items_SetNumAttributes(hWeapon, 0);
return hWeapon;
}
GiveWeaponToClient(client, Handle:hWeapon)
{
if (hWeapon == INVALID_HANDLE) return -1;
if ((client <= 0) || (client > MaxClients) || !IsClientInGame(client)) return -1;
if (!IsPlayerAlive(client)) return -1;
new iWeapon = TF2Items_GiveNamedItem(client, hWeapon);
EquipPlayerWeapon(client, iWeapon);
return iWeapon;
}
-------------------------------------------------------------------------------
In console I see: [SM] Native "TF2Items_GiveNamedItem" reported: item is NULL.
So, how I can create simple weapon, default rocketlauncher, minigun or any weapon and after it set it to player? I just want to make simple weapon restrictor for our servers.
__________________