Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock Float: GetDistanceCameraToLocation(Float: cam_X, Float: cam_Y, Float: cam_Z, Float: vect_X, Float: vect_Y, Float: vect_Z, Float: dest_X, Float: dest_Y, Float: dest_Z, Float: targetDist = 0.0) {
- cam_X -= dest_X;
- cam_Y -= dest_Y;
- cam_Z -= dest_Z;
- targetDist = floatsqroot(cam_X * cam_X + cam_Y * cam_Y + cam_Z * cam_Z);
- cam_X += vect_X * targetDist;
- cam_Y += vect_Y * targetDist;
- cam_Z += vect_Z * targetDist;
- return floatsqroot(cam_X * cam_X + cam_Y * cam_Y + cam_Z * cam_Z);
- }
- stock IsPlayerAimingAtPoint(playerid, Float: pos_X, Float: pos_Y, Float: pos_Z, Float: aimRadius) {
- new
- Float: cam_Pos[3],
- Float: cam_Vect[3]
- ;
- GetPlayerCameraPos(playerid, cam_Pos[0], cam_Pos[1], cam_Pos[2]);
- GetPlayerCameraFrontVector(playerid, cam_Vect[0], cam_Vect[1], cam_Vect[2]);
- new
- Float: aimOffset
- ;
- switch(GetPlayerWeapon(playerid)) {
- case 22, 23, 24, 25, 26, 27, 28, 29, 32, 38: aimOffset = -2.1;
- case 30, 31: aimOffset = -1.3;
- case 33: aimOffset = -0.9;
- case 34: return GetDistanceCameraToLocation(cam_Pos[0], cam_Pos[1], cam_Pos[2], cam_Vect[0], cam_Vect[1], cam_Vect[2], pos_X, pos_Y, pos_Z) < aimRadius;
- case 43: aimOffset = -0.9;
- default: return 0;
- }
- new
- Float: aimAngle = atan2(cam_Vect[2], floatsqroot(cam_Vect[0] * cam_Vect[0] + cam_Vect[1] * cam_Vect[1])),
- Float: tmpVar
- ;
- cam_Vect[2] = floatcos(aimAngle + (aimOffset * -2), degrees) * floatsin(-(atan2(cam_Vect[1], cam_Vect[0]) + aimOffset + 270.0), degrees);
- tmpVar = floatcos(aimAngle + (aimOffset * -2), degrees) * floatcos(-(atan2(cam_Vect[1], cam_Vect[0]) + aimOffset + 270.0), degrees);
- return GetDistanceCameraToLocation(cam_Pos[0], cam_Pos[1], cam_Pos[2], cam_Vect[2], tmpVar, floatsin(aimAngle + (aimOffset * -2), degrees), pos_X, pos_Y, pos_Z) < aimRadius;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement