SA-MP Forums Archive
Is player in air - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is player in air (/showthread.php?tid=509558)



Is player in air - Dusan01 - 27.04.2014

hi guys, i have this code:

pawn Код:
IsPlayerInAir(playerid)
{
print("dbgg1");
  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)
  {
  print("dbgg2");
    diff = varz-var1;
    if(diff > 5)
    {
    print("dbgg3");
    SCM(playerid,GRAD2,"Moras stajati na zemlji da bi posadio marihuanu.");
      return 1;// player is in air
    }
    else
    {
      return 0;//player is on the ground
    }
  }
  print("dbgg4");
  if(varz >= var1)
  {
    diff = var1-varz;
    if(diff > 5)
    {
    SCM(playerid,GRAD2,"Moras stajati na zemlji da bi posadio marihuanu.");
      return -1;// player is under ground
    }
    else
    {
      return 0;//player is on the ground
    }
  }
  return 0;
}
and i have mapandreas plugin... but still code dont work what is problem?


Re: Is player in air - RajatPawar - 27.04.2014

1) Please indent your code!

2) Use [pawn] tags.

3) I am pretty sure (pretty being the confusion arising due to irregularity in naming variables) this line
pawn Код:
if(varz < var1)
needs to be changed to
pawn Код:
if(varz > var1)
to report the player as being in air.


Re: Is player in air - Dusan01 - 28.04.2014

Now is in [pawn] tag and i changed code to this: if(varz > var1) and ow allways says to im in air and im not in air?