How can i check if the player is in the air or not?
#1

Well title says all..

How can i check if the player is in the air, Or on the ground?
Reply
#2

You can chech his Z position.
Reply
#3

Quote:
Originally Posted by » RyDeR «
You can chech his Z position.
So like

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z > 20) return whatever here;
Reply
#4

Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by » RyDeR «
You can chech his Z position.
So like

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z > 20) return whatever here;
I think that is correct, try it
Reply
#5

Quote:
Originally Posted by Steven82
Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by » RyDeR «
You can chech his Z position.
So like

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z > 20) return whatever here;
I think that is correct, try it
It can't be,the height of Mount Chilliad for example is much more than 20,so if the player will be on the ground
on a higher place the function will still work,so it can't be(or atleast thats what i think)
Reply
#6

Quote:
Originally Posted by O_x
Quote:
Originally Posted by Steven82
Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by » RyDeR «
You can chech his Z position.
So like

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z > 20) return whatever here;
I think that is correct, try it
It can't be,the height of Mount Chilliad for example is much more than 20,so if the player will be on the ground
on a higher place the function will still work,so it can't be(or atleast thats what i think)
Its only for certain places and there all below 20
Reply
#7

You can use the MapAndreas plugin.
Reply
#8

Quote:
Originally Posted by O_x
Quote:
Originally Posted by Steven82
Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by » RyDeR «
You can chech his Z position.
So like

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z > 20) return whatever here;
I think that is correct, try it
It can't be,the height of Mount Chilliad for example is much more than 20,so if the player will be on the ground
on a higher place the function will still work,so it can't be(or atleast thats what i think)
this is right
there is 1way
use if(IsPlayerInArea(...
use the area of mount chilliad...
Reply
#9

Use MapAndreas for absolute accuracy.
Reply
#10

only and only map andreas, if u want to do it with area's good luck with speed and amount of code, just use this:
just an example
pawn Код:
IsPlayerInAir(playerid){
  new Float:varx,Float:vary,Float:varz,Float:var1,Float:diff;
  GetPlayerPos(playerid, varx, vary, varz);
  MapAndreas_FindZ_For2DCoord(varx, vary, var1);
  if(varz < var1){
    diff = varz-var1;
    if(diff > 5){
      return 1;// player is in air
    }else{
      return 0;//player is on the ground
    }
  }else
  if(varz => var1){
    diff = var1-varz;
    if(diff > 5){
      return -1;// player is under ground
    }else{
      return 0;//player is on the ground
    }
  }
  return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)