SA-MP Forums Archive
reduce speed - 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: reduce speed (/showthread.php?tid=633679)



reduce speed - GoldenLion - 05.05.2017

Hi, I want to make it like that when a player gets shot it reduces his speed a little, but I don't know how to do that because it needs some maths I haven't learned yet. How do I do that?


Re: reduce speed - Dayrion - 05.05.2017

Hey. It's very simple.
When a player shoot, check if the player shot a vehicle.
Take the velocity of the vehicle (https://sampwiki.blast.hk/wiki/GetVehicleVelocity) and reduce x & y velocity by the wanted slow. 20% of the vitesse will be 1-0.2 = 0.8 of the vehicle's velocity : SetPlayerVelocity(x * 0.8, y * 0.8, z);


Re: reduce speed - DRIFT_HUNTER - 05.05.2017

You can also just get his position and set it. That way it would be like he was stunned. Keep in mind that while these might seem like a good idea its also bad one since some weapons fire very quickly and player might not be able to move at all.


Re: reduce speed - GoldenLion - 05.05.2017

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Hey. It's very simple.
When a player shoot, check if the player shot a vehicle.
Take the velocity of the vehicle (https://sampwiki.blast.hk/wiki/GetVehicleVelocity) and reduce x & y velocity by the wanted slow. 20% of the vitesse will be 1-0.2 = 0.8 of the vehicle's velocity : SetPlayerVelocity(x * 0.8, y * 0.8, z);
Thanks!