[Include] GetDistanceBetweenPlayerAndCamera - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] GetDistanceBetweenPlayerAndCamera (
/showthread.php?tid=455806)
GetDistanceBetweenPlayerAndCamera -
Regziol - 03.08.2013
Код:
stock Float:GetDistanceBetweenPlayerAndCamera(playerid){if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING){ new Float:pP[3],Float:tP[3]; if(!GetPlayerPos(playerid,pP[0],pP[1],pP[2]) || !GetPlayerCameraPos(playerid,tP[0],tP[1],tP[2])) return Float_NaN; pP[0] -= tP[0], pP[1] -= tP[1], pP[2] -= tP[2]; return floatsqroot(floatpower(pP[0],2.0) + floatpower(pP[1],2.0) + floatpower(pP[2],2.0));}else{ return floatsqroot(0);}}
When player is spawned this code can be used to detecting camhack / freecam.cs / specplayer.cs

I created this function couse there is many camhackers on A/D, TDM, BG gamemodes
Re: GetDistanceBetweenPlayerAndCamera -
RedFusion - 03.08.2013
https://sampforum.blast.hk/showthread.php?tid=38965