SA-MP Forums Archive
How calculate the spread bullet? - 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 calculate the spread bullet? (/showthread.php?tid=496392)



How calculate the spread bullet? - Kyra - 21.02.2014

Hi, i try to calculate the spread bullet accuracy but i don't understand why it don't works

I try to take the vector camera X Y Z and compare with the Pos end bullet on onplayershot but apparently not works, how i can calculate this accuracy please?


Re: How calculate the spread bullet? - Mauzen - 21.02.2014

I did this the forward way, by adding spread to serversided bullets.
Getting the actual spread from the gta guns would work the same way, just backwards. Comparing the player pos and bullet target already is the right way. Take the vector between them and compare it to the aim vector of the player (the aim vector is NOT the same as the camera vector, there are some functions to calculate it here that are precise enough, search the forum for that. I had problems with extreme height angles close to +/-90°, did some really crazy math stuff to minimize the error). Then calculate the angles between those two vectors and you got the spread.


Re: How calculate the spread bullet? - Kyra - 22.02.2014

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
I know of a solution to differentiate between the bullet vector and the aim vector however, I need to know what sort of output you want.

Do you want the distance from the bullet landing spot to the aim point or the elevation/rotation angle offset from the aim vector?
Yes i need the elevation/rotation offset from the aim

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
I did this the forward way, by adding spread to serversided bullets.
Getting the actual spread from the gta guns would work the same way, just backwards. Comparing the player pos and bullet target already is the right way. Take the vector between them and compare it to the aim vector of the player (the aim vector is NOT the same as the camera vector, there are some functions to calculate it here that are precise enough, search the forum for that. I had problems with extreme height angles close to +/-90°, did some really crazy math stuff to minimize the error). Then calculate the angles between those two vectors and you got the spread.
I try tomorrow, but it's difficult i don't understand the calcul with X Y Z


AW: How calculate the spread bullet? - Nero_3D - 23.02.2014

Just a note, this AdjustVector function just adjust the vector but will never return the correct one
It just corrects the camera vector each 45 degrees to something similar to the aim vector
Doesn't matter what coordinates you use to calculate it


Re: How calculate the spread bullet? - Kyra - 04.03.2014

Wow good job but you think i can use your code for create an anti cheat without bug?


Re: How calculate the spread bullet? - Kyra - 05.03.2014

Ok thanks for your help i test this week, i think you can create an include if you want very important for the community. I pm you the cheat


Re: How calculate the spread bullet? - Kyra - 07.04.2014

I try it last Week, but when i move the values it's strange sometimes. Apparently when the cheat is ON the value don't change much but i don't know if we can use it for anti cheat

if you want i make a video for compare with cheat and without cheat?