I need a Imposible Function!!
#1

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

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?
Reply
#3

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;
}
Reply
#4

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;
    }
}
Reply
#5

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 ^ ?
Reply
#6

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;
}
Reply
#7

MapAndreas!
Reply
#8

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 :/
Reply
#9

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
Reply
#10

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!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)