SA-MP Forums Archive
how to check if player is throwing grenade - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how to check if player is throwing grenade (/showthread.php?tid=571972)



how to check if player is throwing grenade - PSYCHOBABYKILLA - 24.04.2015

i guess onplayerweaponshot doesnt support any type of weapons besides bullets so how can i detect if a player is shooting a rocket launcher throwing a grenade or shooting minigun stuff like that

im working on an anticheat its pretty much done i just cant seem to find out how to prevent grenade/ minigun/ flamethrower spray can ammo cuz its doesnt work onplayerweaponshot

please and thank you


Re: how to check if player is throwing grenade - Shaktimaan - 24.04.2015

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new weaponid = GetPlayerWeapon(playerid);
    if(newkeys & KEY_FIRE && weaponid == 16)//16 for grenade
    {
       // your codes
    }
    return 1;
}
Try it!


Re: how to check if player is throwing grenade - davve95 - 24.04.2015

I don't know but this maybe would work too GetPlayerWeapon and a way to see if the throwing animation is used.


Re: how to check if player is throwing grenade - JaydenJason - 24.04.2015

Quote:
Originally Posted by davve95
Посмотреть сообщение
I don't know but this maybe would work too GetPlayerWeapon and a way to see if the throwing animation is used.
what if he has a throwing animation?

that what shaktimaan said should do the job


Re: how to check if player is throwing grenade - davve95 - 24.04.2015

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
what if he has a throwing animation?

that what shaktimaan said should do the job
It won't fail because it will check the weapon first.

Yeah!


Re: how to check if player is throwing grenade - JaydenJason - 24.04.2015

Quote:
Originally Posted by davve95
Посмотреть сообщение
It won't fail because it will check the weapon first.

Yeah!
right, appears that i didnt read your post and only say "throwing animation"
apologies,


Re: how to check if player is throwing grenade - davve95 - 24.04.2015

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
right, appears that i didnt read your post and only say "throwing animation"
apologies,
No probs!