03.05.2010, 14:28
Well title says all..
How can i check if the player is in the air, Or on the ground?
How can i check if the player is in the air, Or on the ground?
Originally Posted by » RyDeR «
You can chech his Z position.
|
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(z > 20) return whatever here;
Originally Posted by Joe Torran C
Quote:
pawn Код:
|
Originally Posted by Steven82
Quote:
![]() |
Originally Posted by O_x
Quote:
on a higher place the function will still work,so it can't be(or atleast thats what i think) |
Originally Posted by O_x
Quote:
on a higher place the function will still work,so it can't be(or atleast thats what i think) |
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;
}