Get player's Position, More like direction
#1

Greetings,
I want to know if it's possible to make a system like you type a cmd, and it tells you if that specific player is standing in your left side or right side like here.
PHP код:
CMD:getpos(playeridparams[])
{
  new 
Float:xFloat:yFloat:z;
  
GetPlayerPos(playeridxyz);
  for(new 
0MAX_PLAYERSi++)
  {
  if(
IsPlayerInRangeOfPoint(i6.0x,z) && != playerid)
  {
  
//what to do here
  //and make a string like where the player is standing
  //ex: ID 9 is standing at the right side
  
}
  }
  return 
1;

Reply
#2

You can't tell if someone is standing on your right or left side with accuracy.
You can detect if their next to you, but not what side of you they are on.
For instance, if you're standing and someone is on your right, if you hit W and turn around their now on your left.
The script can't detect that your player turned around(accurately).

Is it possible? Yes,
However it will be completely buggy and not worth the effort.
Reply
#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
#4

Код:
return strcat((dest[0] = EOS, dest), direction[floatround((angle + 11.25) / 22.5, floatround_floor)], size);
That is rather clever.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)