Raised This Month: $18 Target: $400
 4% 

Heavy Armor Trouble


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
imburnt916
Junior Member
Join Date: Apr 2015
Location: California
Old 07-21-2020 , 20:17   Heavy Armor Trouble
Reply With Quote #1

Hello, I am trying to remove Heavy Armor on round end, since some of the things brought along with heavy armor stay with it the next round if a player doesnt die. I am looping through alive players, and:

int userID = GetClientUserId(i);
int defIndex = CS_WeaponIDToItemDefIndex(CSWeapon_HEAVYASSAU LTSUIT);

int weaponID = CS_ItemDefIndexToID(defIndex);

RemovePlayerItem(userID, weaponID); (Not sure which to use as neither of them seem to work)
RemovePlayerItem(userID, defInxed);

Any help or assistance is welcome as I cannot figure out how to remove the heavy armor from the client. Thank you in advance.
__________________
Sourcemod developer and server manager.
imburnt916 is offline
Zeisen
Member
Join Date: Nov 2016
Location: Republic of Korea
Old 07-25-2020 , 00:38   Re: Heavy Armor Trouble
Reply With Quote #2

Just you can simply done with:

Code:
SetEntProp(client, Prop_Send, "m_bHasHeavyArmor", 0);
Quote:
Originally Posted by imburnt916 View Post
I am trying to remove Heavy Armor on round end, since some of the things brought along with heavy armor stay with it the next round if a player doesnt die.
Code:
public void OnPluginStart()
{
	HookEvent("round_end", OnRoundEndPost, EventHookMode_Post);
}

public void OnRoundEndPost(Event event, const char[] name, bool dontBroadcast)
{
	for (int i=1; i<=MaxClients; i++) {
		if (!IsClientInGame(i))
			continue;
		
		SetEntProp(i, Prop_Send, "m_bHasHeavyArmor", 0);
	}
}

Last edited by Zeisen; 07-25-2020 at 00:42.
Zeisen is offline
imburnt916
Junior Member
Join Date: Apr 2015
Location: California
Old 07-26-2020 , 01:36   Re: Heavy Armor Trouble
Reply With Quote #3

Found this solution but forgot to post, thank you!


loop through alive players on round end and:
int hasHeavy = GetEntProp(i, Prop_Send, "m_bHasHeavyArmor");
if (hasHeavy)
SetEntProp(i, Prop_Send, "m_bHasHeavyArmor", 0);
__________________
Sourcemod developer and server manager.
imburnt916 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 01:54.


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