SA-MP Forums Archive
How to detect fire truck spraying water at a point??? - 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 detect fire truck spraying water at a point??? (/showthread.php?tid=576838)



How to detect fire truck spraying water at a point??? - JawsPlus - 07.06.2015

I need to create a fire man system but i can't detect that a player is spraying water at the fire.
i tried to use fire extinguisher but the fire extinguisher was not spraying anything out.

Anyone can help me


Re: How to detect fire truck spraying water at a point??? - JaydenJason - 07.06.2015

https://sampforum.blast.hk/showthread.php?tid=105568


Re: How to detect fire truck spraying water at a point??? - Yashas - 07.06.2015

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
Irrelevant post

You can detect if a player is spraying by checking the keys he is pressing.
You can use these callbacks/functions to find out what keys are being pressed:
OnPlayerKeyStateChange
GetPlayerKeys

The player has to press KEY_FIRE to spray water.

You can then find out in which direction he is facing using GetPlayerFacingAngle.You can then create a virtual sphere around your point and find out if the line drawn along the direction of facing angle of the player intersects the point or passes close to the point by doing some simple math.

https://sampforum.blast.hk/showthread.php?tid=573385
You can get an idea how to do the math from here.


Re: How to detect fire truck spraying water at a point??? - JawsPlus - 07.06.2015

Ya i know but how to detect if is the player spray to the position


Re: How to detect fire truck spraying water at a point??? - JaydenJason - 07.06.2015

Check players angle, get players vehicle/weapon, check if player is holding down KEY_FIRE and check if player is in range of the fire