View Single Post
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-30-2018 , 07:01   Re: Unlimited Grenades!!!
Reply With Quote #27

Here's a better method in my opinion, someone should turn that into a plugin:

Code:
public OnEntityCreated(entity, const String:Classname[])
{
	if(StrEqual(Classname, "hegrenade_projectile") || StrEqual(Classname, "smokegrenade_projectile"))
    {
		SDKHook(entity, SDKHook_SpawnPost, SpawnPost_Grenade)
    }
}


public SpawnPost_Grenade(entity)
{
	SDKUnhook(entity, SDKHook_SpawnPost, SpawnPost_Grenade);
	
	new thrower = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
	
	if(thrower == -1 || !IsValidEdict(entity))
		return;
		
	else if(!LRStarted)
		return;
		
	else if(!LRPart(thrower))
		return;
		
	new String:WeaponName[50], String:Weapon[50];
	GetEdictClassname(entity, WeaponName, sizeof(WeaponName));
	
	ReplaceString(WeaponName, sizeof(WeaponName), "_projectile", "");
	Format(Weapon, sizeof(Weapon), "weapon_%s", WeaponName);
	
	StripPlayerWeapons(thrower);
	GivePlayerItem(thrower, Weapon);
}
__________________
Accepting private work. Contact me if you're interested.
If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

Total Donated: 10$
eyal282 is offline