Raised This Month: $51 Target: $400
 12% 

TF2_GiveNamedItem failed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DronElektron
Junior Member
Join Date: Jun 2011
Location: Russia, Moscow
Old 06-30-2012 , 14:23   TF2_GiveNamedItem failed
Reply With Quote #1

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.
__________________

Last edited by DronElektron; 06-30-2012 at 14:24.
DronElektron is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 07-01-2012 , 10:30   Re: TF2_GiveNamedItem failed
Reply With Quote #2

use tf2items_manager and clear attributes
Code:
"custom_weapons_v3"
{
	"*"
	{
		"730"
		{
			"preserve-attributes"		"0"
		}
	}
}
Leonardo is offline
DronElektron
Junior Member
Join Date: Jun 2011
Location: Russia, Moscow
Old 07-01-2012 , 13:05   Re: TF2_GiveNamedItem failed
Reply With Quote #3

Quote:
Originally Posted by Leonardo View Post
use tf2items_manager and clear attributes
Code:
"custom_weapons_v3"
{
    "*"
    {
        "730"
        {
            "preserve-attributes"        "0"
        }
    }
}
This doesn't work
And with 18 index too...
__________________
DronElektron is offline
Reply



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 23:25.


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