SA-MP Forums Archive
I need a Imposible Function!! - 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: I need a Imposible Function!! (/showthread.php?tid=396526)



I need a Imposible Function!! - dr.lozer - 01.12.2012

i need a function that return true if player is in sky :P


Re: I need a Imposible Function!! - RajatPawar - 01.12.2012

I don't know if this will work, but maybe you can try doing this, GetPlayerPos and subtract 1-50m from it and check if the result is negative/positive and it should work, Am I right?


Re: I need a Imposible Function!! - dr.lozer - 01.12.2012

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
I don't know if this will work, but maybe you can try doing this, GetPlayerPos and subtract 1-50m from it and check if the result is negative/positive and it should work, Am I right?
you mean like this ??

pawn Код:
stock IsPlayerInSky(playerid)
{
   new Float:x,Float:y,Float:z;
   GetPlayerPos(playerid, x,y,z);
   if(z == 50) return true;
   else return false;
}



Re: I need a Imposible Function!! - gtakillerIV - 01.12.2012

You can use an array too, like:

pawn Код:
stock IsPlayerInSky(playerid)
{
    new Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    if(Pos[2] == 100)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}



Re: I need a Imposible Function!! - RajatPawar - 01.12.2012

Quote:
Originally Posted by dr.lozer
Посмотреть сообщение
you mean like this ??

pawn Код:
stock IsPlayerInSky(playerid)
{
   new Float:x,Float:y,Float:z;
   GetPlayerPos(playerid, x,y,z);
   if(z == 50) return true;
   else return false;
}
No, something like this?
pawn Код:
stock IsPlayerInSky(playerid)
{
   new Float:x,Float:y,Float:z;
   GetPlayerPos(playerid, x,y,z);
   for(new i;i<100;i++)
   {
        if(z-i>0)
       SendClientMessage(playerid,-1,"You are falling from the sky!");
    }

}
Will this work ^ ?


Re: I need a Imposible Function!! - Konstantinos - 01.12.2012

Why a for loop?
Just check if the player's is over x meters. And it may fail if you do sky diving from the highest tower on LS.
pawn Код:
stock IsPlayerInSky(playerid)
{
   new Float:x,Float:y,Float:z;
   GetPlayerPos(playerid, x,y,z);
   if(z >= 100) return true; // Change the value.
   else return false;
}



Re: I need a Imposible Function!! - tyler12 - 01.12.2012

MapAndreas!


Re: I need a Imposible Function!! - Face9000 - 01.12.2012

pawn Код:
stock IsPlayerInSky(playerid)
{
   new Float:x,Float:y,Float:z;
   GetPlayerPos(playerid, x,y,z);
   if(z == 100) return true;
   else return false;
}
Ops, too late :/


Re: I need a Imposible Function!! - dr.lozer - 01.12.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Why a for loop?
Just check if the player's is over x meters. And it may fail if you do sky diving from the highest tower on LS.
pawn Код:
stock IsPlayerInSky(playerid)
{
   new Float:x,Float:y,Float:z;
   GetPlayerPos(playerid, x,y,z);
   if(z >= 100) return true; // Change the value.
   else return false;
}
Hi Dwane

ah i use this for entering in hydra or hunter from sky only like BF3 ! so thats why i need this


Re: I need a Imposible Function!! - Konstantinos - 01.12.2012

Sorry, I haven't played/seen BF3 and I don't know how you want it.
However, you can check if he is in vehicle or not, it depends on what do you want to do.

@to others:
Don't use '==' on the if statement, if player's Z is 100, he's in sky. What about if player's Z is 101, he is not in sky?
Of course he is!