10.03.2014, 22:19
I'm trying to make a aimbot detector.
this is my current code. The problem of the code is that the position of the camera will never match the positions of the targeted player. Any idea?
this is my current code. The problem of the code is that the position of the camera will never match the positions of the targeted player. Any idea?
Quote:
#define MAX_POS 20 new CheckAim; new PosActual[MAX_PLAYERS] ; new Float:xpos[MAX_POS][MAX_PLAYERS],Float:ypos[MAX_POS][MAX_PLAYERS],Float:zpos[MAX_POS][MAX_PLAYERS]; public OnFilterScriptInit() { CheckAim = SetTimer("ChecarAim",100,1); return 1; stock Float:Distance2D(Float:x1, Float:y1, Float:x2, Float:y2, bool:sqrt = true) { x1 -= x2; x1 *= x1; y1 -= y2; y1 *= y1; x1 += y1; return sqrt ? floatsqroot(x1) : x1; } forward ChecarAim(); public ChecarAim() { for (new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && !IsPlayerInAnyVehicle(i)) { if(GetPlayerCameraMode(i) == 53) { new aimid; aimid = GetPlayerTargetPlayer(i); if(aimid != INVALID_PLAYER_ID) { new Float:xvec,Float:yvec,Float:zvec; GetPlayerCameraFrontVector(i,xvec,yvec,zvec); new Float: fDistance = GetPlayerDistanceFromPoint(aimid, xpos[PosActual[aimid]][aimid], ypos[PosActual[aimid]][aimid], zpos[PosActual[aimid]][aimid]); PosActual[aimid]++; if(PosActual[aimid] == MAX_POS)PosActual[aimid] = 0; if(fDistance > 0.1 ) { Apuntando[i]++; if(Apuntando[i] == 20) { Apuntando[i] = 0; new str[120]; for (new b = 0; b < MAX_POS; b++) { new Float:distance = Distance2D(xpos[b][aimid], ypos[b][aimid], xvec, yvec); if(distance <= 1) { format(str,sizeof str,"%s sospechado de Aimbot %.2f %.2f %.2f %.2f",PlayerName2(i),xvec,yvec,xpos[b][aimid], ypos[b][aimid]); for (new y = 0; y < MAX_PLAYERS; y++) { if(IsPlayerConnected(y) && IsPlayerAdmin(y)) { SendClientMessage(y,-1,str); } } } } } } else { Apuntando[i] = 0; } GetPlayerPos(aimid,xpos[PosActual[aimid]][aimid], ypos[PosActual[aimid]][aimid], zpos[PosActual[aimid]][aimid]); } else { Apuntando[i] = 0; } } } } return 1; } |