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

[Equip Hat, No Weapon]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randons Gamers
Junior Member
Join Date: Feb 2014
Old 07-25-2014 , 16:06   [Equip Hat, No Weapon]
Reply With Quote #1

hello, sorry if I'm in the wrong area, is that I'm not American, I need help with the following command:

Code:
hWeapon[1] = TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION);
		if (hWeapon[1] != INVALID_HANDLE)
		{
			TF2Items_SetClassname(hWeapon[1], "tf_weapon_sapper");
			TF2Items_SetItemIndex(hWeapon[1], 810);
			TF2Items_SetLevel(hWeapon[1], GetRandomInt(1,100));
			TF2Items_SetQuality(hWeapon[1], 5);
			Format(weaponAttribs, sizeof(weaponAttribs), "433 ; 1.0");
			new attribCount = ExplodeString(weaponAttribs, " ; ", weaponAttribsArray, 32, 32);
			if (attribCount > 0)
			{
				TF2Items_SetNumAttributes(hWeapon[1], attribCount/2);
				new i2 = 0;
				for (new i = 0; i < attribCount; i+=2) 
				{
					TF2Items_SetAttribute(hWeapon[1], i2, StringToInt(weaponAttribsArray[i]), StringToFloat(weaponAttribsArray[i+1]));
					i2++;
				}

			}else{

				TF2Items_SetNumAttributes(hWeapon[1], 0);
			}
			//TF2_RemoveWeaponSlot(client, 1);
		}
		weapon[1] = TF2Items_GiveNamedItem(client, hWeapon[1]);
		EquipPlayerWeapon(client, weapon[1]);
this command will equip a "sapper," I would like to convert it, and usalo to wear a hat, Example:

Code:
hWeapon[1] = TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION);
		if (hWeapon[1] != INVALID_HANDLE)
		{
			TF2Items_SetClassname(hWeapon[1], "hat");
			TF2Items_SetItemIndex(hWeapon[1], 918);//The Master Mind || HAT
			TF2Items_SetLevel(hWeapon[1], GetRandomInt(1,100));
			TF2Items_SetQuality(hWeapon[1], 5);
			Format(weaponAttribs, sizeof(weaponAttribs), "433 ; 1.0");
			new attribCount = ExplodeString(weaponAttribs, " ; ", weaponAttribsArray, 32, 32);
			if (attribCount > 0)
			{
				TF2Items_SetNumAttributes(hWeapon[1], attribCount/2);
				new i2 = 0;
				for (new i = 0; i < attribCount; i+=2) 
				{
					TF2Items_SetAttribute(hWeapon[1], i2, StringToInt(weaponAttribsArray[i]), StringToFloat(weaponAttribsArray[i+1]));
					i2++;
				}

			}else{

				TF2Items_SetNumAttributes(hWeapon[1], 0);
			}
			//TF2_RemoveWeaponSlot(client, 1);
		}
		weapon[1] = TF2Items_GiveNamedItem(client, hWeapon[1]);
		EquipPlayerWeapon(client, weapon[1]);
help me please
I'm using
HTML Code:
translate.google.com.br
Randons Gamers is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 07-25-2014 , 16:27   Re: [Equip Hat, No Weapon]
Reply With Quote #2

Are you trying to change that code to equip wearables instead of weapons?

You'll have to use different code for that, as well as the "EquipWearable" function. See Randomizer (I think) or Be With Robots for examples; it's a little complicated.

Also, remember: just like weapons, wearables that you give won't be viewable by other players. That is how Valve wants it.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
Randons Gamers
Junior Member
Join Date: Feb 2014
Old 07-25-2014 , 16:37   Re: [Equip Hat, No Weapon]
Reply With Quote #3

Quote:
Originally Posted by MasterOfTheXP View Post
Are you trying to change that code to equip wearables instead of weapons?

You'll have to use different code for that, as well as the "EquipWearable" function. See Randomizer (I think) or Be With Robots for examples; it's a little complicated.

Also, remember: just like weapons, wearables that you give won't be viewable by other players. That is how Valve wants it.
Thanks!
Randons Gamers is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-25-2014 , 17:53   Re: [Equip Hat, No Weapon]
Reply With Quote #4

Of course, this only works on bots...
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 08:59.


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