25.01.2018, 17:46
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.
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?
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; }