Raised This Month: $32 Target: $400
 8% 

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
Siniii
Junior Member
Join Date: Apr 2020
Old 04-12-2022 , 08:16   Re: Heavy Armor Trouble
Reply With Quote #4

Quote:
Originally Posted by Zeisen View Post
Just you can simply done with:

Code:
SetEntProp(client, Prop_Send, "m_bHasHeavyArmor", 0);


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);
	}
}
thx this work perfectly, but your kevlar stay on 200, is way how to fix this too pls?
__________________
Siniii is offline
Siniii
Junior Member
Join Date: Apr 2020
Old 04-12-2022 , 09:36   Re: Heavy Armor Trouble
Reply With Quote #5

ok nevermind I got it with combination both yours post

Code:
	for (int i=1; i<=MaxClients; i++) {
		if (!IsClientInGame(i))
			continue;
		int hasHeavy = GetEntProp(i, Prop_Send, "m_bHasHeavyArmor");
		
		if (hasHeavy)
		SetEntProp(i, Prop_Send, "m_bHasHeavyArmor", 0);
		SetEntProp(i, Prop_Send, "m_ArmorValue", 100);
__________________

Last edited by Siniii; 04-12-2022 at 10:01.
Siniii 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 01:00.


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