01.12.2012, 08:50
i need a function that return true if player is in sky :P
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?
|
stock IsPlayerInSky(playerid)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x,y,z);
if(z == 50) return true;
else return false;
}
stock IsPlayerInSky(playerid)
{
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if(Pos[2] == 100)
{
return 1;
}
else
{
return 0;
}
}
you mean 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!");
}
}
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;
}
stock IsPlayerInSky(playerid)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x,y,z);
if(z == 100) return true;
else return false;
}
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 Код:
|