SA-MP Forums Archive
Weapon Knockback - 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: Weapon Knockback (/showthread.php?tid=663621)



Weapon Knockback - DarkMythHunter - 07.02.2019

Example, I've shot player1 using a shotgun, I would like to have a knockback added when I do.

I've read this:

Код:
Consider player1 and player2. 
player1 - On ground
player2 - In vehicle to ram player1

First check if the player1 is having a M4/Deagle when he fire s(OnPlayerKeyStateChange?), and then GetPlayerCameraFrontVector and GetPlayerCameraPos to get the player1's aim position.

Check if the aim position is matching with the GetPlayerPos of the player2 who is trying to ram the player1. If it matches, SetPlayerPos of the player2 some distance back.
I just don't get it without to see an example, that would help a lot I'll surely appreciate it. Anyways, thanks.


Re: Weapon Knockback - TheToretto - 07.02.2019

You only need one callback: OnPlayerWeaponShot

And then check where the bullet went, if the target is hit get his position, and subtract like 1/2 from his Y position. (maybe less... maybe X.. just try)