Raised This Month: $2 Target: $400
 0% 

tf_wearable problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ABCDEFGH23
New Member
Join Date: Jun 2020
Location: HEEELP!!!
Old 06-14-2020 , 00:07   tf_wearable problems
Reply With Quote #1

Code:
void GiveHat(int client, int index, int level, int quality, bool Preserve, int attributesCount, int[] attributes, float[] attributesVal)
{
	Handle hItem = TF2Items_CreateItem(OVERRIDE_ALL);
	int flags = OVERRIDE_ATTRIBUTES | OVERRIDE_ITEM_LEVEL | OVERRIDE_ITEM_QUALITY;
	if(Preserve){
       flags |= PRESERVE_ATTRIBUTES;
	}
	TF2Items_SetClassname(hItem, "tf_wearable");
	TF2Items_SetFlags(hItem, flags);
	TF2Items_SetItemIndex(hItem, index);
	TF2Items_SetFlags(hItem, flags);
	TF2Items_SetLevel(hItem, level);
	TF2Items_SetQuality(hItem, quality);
	for (int i = 0; i < attributesCount; i ++)TF2Items_SetAttribute(hItem, i, attributes[i], attributesVal[i]);
	if (attributesCount != 0)TF2Items_SetNumAttributes(hItem, attributesCount);
	
	TF2_RemoveAllWearables(client);
	TF2Items_GiveNamedItem(client, hItem);
	
	CloneHandle(hItem);

}

void TF2_RemoveAllWearables(int client)
{
    int ent = -1;
    while ((ent = FindEntityByClassname(ent , "tf_wearable")) != -1)
    {
        if (client != GetEntPropEnt(ent , Prop_Send, "m_hOwnerEntity")) continue;
        AcceptEntityInput(ent , "Kill");
    }
}

---------------------------------------------------------------


Code:
int TF2_SpawnWearable(int client, int iDef=52, int iLevel=100, int iQuality=0)
{
    int iTeam = GetClientTeam(client);
    int iItem = CreateEntityByName("tf_wearable");
    
	SetEntPropEnt(iItem, Prop_Send, "m_hOwnerEntity", client);
	SetEntProp(iItem, Prop_Send, "m_fEffects",             EF_BONEMERGE|EF_BONEMERGE_FASTCULL|EF_NOSHADOW|EF_PARENT_ANIMATES);
	SetEntProp(iItem, Prop_Send, "m_iTeamNum",             iTeam);
	SetEntProp(iItem, Prop_Send, "m_nSkin",                (iTeam-2));
	SetEntProp(iItem, Prop_Send, "m_CollisionGroup",       11);
	SetEntProp(iItem, Prop_Send, "m_iItemDefinitionIndex", iDef);
	SetEntProp(iItem, Prop_Send, "m_iEntityLevel",         iLevel);
	SetEntProp(iItem, Prop_Send, "m_iEntityQuality",       iQuality);
	DispatchSpawn(iItem);
	
    return iItem;
}
it's not work... (

Last edited by ABCDEFGH23; 06-14-2020 at 00:14. Reason: more info
ABCDEFGH23 is offline
PC Gamer
Senior Member
Join Date: Mar 2014
Old 06-14-2020 , 13:31   Re: tf_wearable problems
Reply With Quote #2

Quote:
Originally Posted by ABCDEFGH23 View Post
it's not work...
Really? That's it? Three words to describe your problem? And... You didn't post all of your code? Why are you using one method to spawn any cosmetic, and a different method to spawn a Batter's Helmet?
PC Gamer is offline
Reply


Thread Tools
Display Modes

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 07:24.


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