Detect player throwing grenades
#1

Hi,

the title says it all: How do I reliably check for when a player throws a grenade? I've browsed the forums already and found this function here.

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new weaponid = GetPlayerWeapon(playerid);
	if(newkeys & KEY_FIRE && weaponid == 16)//16 for grenade
	{
	   // your codes
	}
	return 1;
}
This is not 100% reliable though. Grenades are thrown with a small delay after pressing the fire key which allows players to switch weapons mid-animation and have the animation play out without actually throwing a grenade. A possible solution would be to run a short but frequently repeating timer for the duration of the animation and check if the currently armed weapon is a grenade. Thoughts?
Reply


Messages In This Thread
Detect player throwing grenades - by Manyula - 25.01.2018, 17:46
Re: Detect player throwing grenades - by pollo97 - 25.01.2018, 17:52
Re: Detect player throwing grenades - by Manyula - 25.01.2018, 17:58
Re: Detect player throwing grenades - by Hrb - 25.01.2018, 18:02
Re: Detect player throwing grenades - by Manyula - 25.01.2018, 18:08

Forum Jump:


Users browsing this thread: 1 Guest(s)