View Single Post
Author Message
MatoBoost
Junior Member
Join Date: Apr 2016
Old 03-31-2019 , 16:14   Check if player has grenade/equip on spawn
Reply With Quote #1

Hello, I have a plugin (I modified HexVips a little bit) where I give all players grenades + healthshot and defuse kit on spawn, but the problem is that if someone survives with grenades and respawns, grenades stay on the ground. I wanted to prevent this, so I started digging a bit on the internet, and after some time came up with this:

Code:
public Action tDelayLife(Handle timer, any iUserId)
{
	int client = GetClientOfUserId(iUserId);
	
	if (!IsValidClient(client, false, false))
		return Plugin_Continue;
	
	SetEntProp(client, Prop_Send, "m_ArmorValue", cv_fVipSpawnArmour.IntValue);
	SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
	
	if(GetEntProp(!client, Prop_Data, "m_iAmmo", _, 11))
	GivePlayerItem(client, "weapon_hegrenade");
	
	if(GetEntProp(!client, Prop_Data, "m_iAmmo", _, 12))
	GivePlayerItem(client, "weapon_flashbang");
	
	if(GetEntProp(!client, Prop_Data, "m_iAmmo", _, 13))
	GivePlayerItem(client, "weapon_smokegrenade");
	
	if(GetEntProp(!client, Prop_Data, "m_iAmmo", _, 14))
	GivePlayerItem(client, "weapon_molotov");
	
	GivePlayerItem(client, "weapon_tagrenade");
	
	GivePlayerItem(client, "weapon_healthshot");
	
	int iSpawnHealth = GetClientHealth(client);
	SetEntityHealth(client, iSpawnHealth + cv_iVipSpawnHP.IntValue);
	return Plugin_Continue;
}
Now the problem is, I do not know how to do this for tactical grenade and healthshot. I found the values for grenades here on forums.

I also did this for defuse kit
Code:
	if (cv_bVipDefuser.BoolValue && GetClientTeam(client) == CS_TEAM_CT && !GetEntProp(client, Prop_Send, "m_bHasDefuser"))
	{
		GivePlayerItem(client, "item_defuser");
	}
I added !GetEntProp(client, Prop_Send, "m_bHasDefuser") into original if, will this work ?
MatoBoost is offline