Archived

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

Nat

If u like problems try this ..

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


Link to post
Share on other sites