Hew to detect if a player is shooting - 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: Hew to detect if a player is shooting (
/showthread.php?tid=625644)
Hew to detect if a player is shooting -
AndreiWow - 04.01.2017
Hey guys, I am still working on my mech system and I want to give the player a spray and if he is spraying with it a object will be created on his hand, I know how to do this but I do not know how to detect if he is spraying
Re: Hew to detect if a player is shooting -
lackmail - 04.01.2017
OnPlayerWeaponShot check if weapon id equals spray id then create the object
Re: Hew to detect if a player is shooting -
SickAttack - 04.01.2017
Quote:
Originally Posted by lackmail
OnPlayerWeaponShot check if weapon id equals spray id then create the object
|
That's only called for weapons with bullets
Use OnPlayerKeyStateChange and check if player presses KEY_FIRE, to make it a bit more accurate you could also detect if ammo goes down.
Re: Hew to detect if a player is shooting -
lackmail - 04.01.2017
Quote:
Originally Posted by SickAttack
That's only called for weapons with bullets
Use OnPlayerKeyStateChange and check if player presses KEY_FIRE, to make it a bit more accurate you could also detect if ammo goes down.
|
my bad i thought it will work as its given as a weapon i apologies andrei
Re: Hew to detect if a player is shooting -
Lordzy - 04.01.2017
OnPlayerWeaponShot will not be called for spray can. You need to check if player's current weapon ID is equal to spray can and then check for animation indexes. Spray can animations Ids : {640, 1160, 1161, 1162, 1163, 1167} to be used with GetPlayerAnimationIndex.
Re: Hew to detect if a player is shooting -
AndreiWow - 04.01.2017
Thanks everyone, no problem lackmail