Get player's Position, More like direction
#3

PHP код:
Direction(Floatangledest[], size sizeof dest) {
    while(
angle >= 348.75angle -= 360.0;
    while(
angle < -11.25angle += 360.0;
    static const 
direction[][] = {
        
"North",
        
"North North West",
        
"North West",
        
"West North West",
        
"West",
        
"West South West",
        
"South West",
        
"South South West",
        
"South",
        
"South South East",
        
"South East",
        
"East South East",
        
"East",
        
"East North East",
        
"North East",
        
"North North East"
    
};
    return 
strcat((dest[0] = EOSdest), direction[floatround((angle 11.25) / 22.5floatround_floor)], size);
}
FloatGetZAngle(FloatX1FloatY1FloatX2FloatY2) {
    return -
atan2(X2 X1Y2 Y1); // From Point 1 to Point 2
}
DirectionPlayerToPlayer(playeridtargetdest[], size sizeof dest) {
    new
        
FloatpX,
        
FloatpY,
        
FloattX,
        
FloattY,
        
FloatZ;
    if(
GetPlayerPos(playeridpXpYZ) && GetPlayerPos(targettXtYZ)) {
        return 
Direction(GetZAngle(pXpYtXtY), destsize);
    }
    return 
0;

You could use GetZAngle by itself if the angle is enough, just added the other two functions for you convenience
Reply


Messages In This Thread
Get player's Position, More like direction - by Ebisu - 03.07.2017, 15:24
Re: Get player's Position, More like direction - by Lynn - 03.07.2017, 19:47
Re: Get player's Position, More like direction - by Nero_3D - 03.07.2017, 20:35
Re: Get player's Position, More like direction - by Pottus - 03.07.2017, 20:59

Forum Jump:


Users browsing this thread: 2 Guest(s)