Jump to content
• Advertisement

#### Archived

This topic is now archived and is closed to further replies.

# If u like problems try this ..

This topic is 6904 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

The below funtion checks if the player is in a box or not and returns accordingly.
I call the funtion like this ..
NK_PlayerIn(PlayerLocation,125085,72589,123418,70769);
returns 0.. even when player enters the box
//This works ..
NK_PlayerInT(PlayerLocation,125085,72589,123418,70769);
returns 1 when player enters the box ..

PR_DWORD NK_PlayerIn(PR_POINT plpos,PR_REAL x1,PR_REAL z1,PR_REAL x2,PR_REAL z2)
{

if ( (x1 < x2) && (z1 < z2))
{
if ((plpos.x > x1 && plpos.x < x2)&&(plpos.z > z1 && plpos.z < z2))
return 1;
else
return 0;

}
if ( (x1 > x2) && (z1 < z2))
{
if ((plpos.x < x1 && plpos.x > x2)&&(plpos.z > z1 && plpos.z < z2))
return 1;
else
return 0;
}
if ( (x1 < x2) && (z1 > z2))
{
if ((plpos.x > x1 && plpos.x < x2)&&(plpos.z < z1 && plpos.z > z2))
return 1;
else
return 0;
}
// not working ..?????????????????
if( (x1 > x2) && (z1 > z2 ))
{

if ((plpos.x < x1 && plpos.x > x2)&&(plpos.z < z1 && plpos.z > z2))
return 1;
else
return 0;

}
}
This works ..

PR_DWORD NK_PlayerInT(PR_POINT plpos,PR_REAL x1,PR_REAL z1,PR_REAL x2,PR_REAL z2)
{

if( (x1 > x2) && (z1 > z2 ))
{
if ((plpos.x < x1 && plpos.x > x2)&&(plpos.z < z1 && plpos.z > z2))
return 1;
else
return 0;
}

}

Any ideas why this is happening .. ????

Cheers,
Nat

#### Share this post

##### Share on other sites
Advertisement

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
48
2. 2
3. 3
4. 4
5. 5
JoeJ
19
• Advertisement

• 11
• 16
• 9
• 10
• 13
• ### Forum Statistics

• Total Topics
633003
• Total Posts
3009846
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!