Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Player visible on screen.
#1
Code:
playerIsVisible(player)
{
    cpi = 3.141592654 * 2 / 360;
    angle = self.angles[1] * cpi;
    sy = sin(angle);
    cy = cos(angle);
    angle = self.angles[0] * cpi;
    sp = sin(angle);
    cp = cos(angle);
    forward = (cp*cy, cp*sy, sp*-1);
    return BulletTracePassed(self getTagOrigin("j_head"), player getTagOrigin("j_head"), false, self) && vectordot(player.origin-self.origin, forward) >= 0.01;
}

Combine this with some aimbot code and profit? (it's not 360 degrees so it looks more realistic but you probably got to figure out the smooth aiming yourself) Note that this is an actual snippet of code you might see in a real aimbot hack.

Pseudo-code:
Code:
if(self playerIsVisible(somePlayer))
{
    //Do something
}
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Reply

#2
Good job on the function, but it seems way to complicated.

This is a function treyarch made:
Code:
//Example: qBool = within_fov( level.player.origin, level.player.angles, target1.origin, cos( 45 ) );
within_fov( start_origin, start_angles, end_origin, fov )
{
    normal = VectorNormalize( end_origin - start_origin );
    forward = AnglesToForward( start_angles );
    dot = VectorDot( forward, normal );

    return dot >= fov;
}
[Image: MaEIQ.png]
Reply

#3
Would this also work in mw2 ?
[Image: lQDUjba.jpg]
Reply

#4
(10-03-2011, 06:13)OrangePL Wrote: Would this also work in mw2 ?

probably
[Image: MaEIQ.png]
Reply

#5
(10-03-2011, 06:13)OrangePL Wrote: Would this also work in mw2 ?

Code:
PointinFov(position)
{
    dot = vectordot(anglestoforward(self.angles),vectornormalize(position-self.origin));
    return dot >= 0.766;
}

I used the value that I found in a gsc file for the fov = 80(0.766).
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Sentry Gun kill = Player kill Snake 8 5,860 11-07-2013, 13:41
Last Post: Nekochan
  Player can write Fl0w_.JACKDAN 2 3,349 09-19-2013, 16:36
Last Post: Fl0w_.JACKDAN
  [CoD 4] Trying to set a player -- DidUknowiPwn 7 5,844 07-03-2013, 21:58
Last Post: Pozzuh
  [Release] Black Ops Single Player/Zombie Trainer V3.6 Craig87 52 88,536 07-01-2013, 15:12
Last Post: explosivebanana55
Video Preview AIZombies eXtreme 2.0 / Zombie Player (Music Player) DidUknowiPwn 4 5,867 06-24-2013, 16:37
Last Post: DidUknowiPwn
  "VEH_LinkCommonChecks: Player already has an owner" - After long games akillj 4 3,592 06-07-2013, 11:38
Last Post: akillj
  Question on how to "Spawn" a flying rocket as a player? akillj 8 5,541 06-04-2013, 01:54
Last Post: rotceh_dnih
  Using Cheat Engine with Zombies Single Player kikkawa 3 10,906 06-03-2013, 01:18
Last Post: kikkawa
Sad Help Minecraft-Mojang Loading Screen, Than Black Screen mans123 6 6,806 06-01-2013, 19:40
Last Post: Shreddie
  [Request] Random player model hillbilly 1 2,745 05-12-2013, 08:30
Last Post: archit

Forum Jump:


Users browsing this thread:
3 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.