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

Check if player has grenade/equip on spawn


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 18:05.


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