MapAndreas_FindAverageZ
#1

Hello Everyone,

Can any one please explain me the usage of these natives of ManAndreas, with the used code?
pawn Код:
native MapAndreas_FindZ_For2DCoord(Float:X, Float:Y, &Float:Z); // return highest Z point (ground level) for the provided X,Y co-ordinate.
// new
native MapAndreas_FindAverageZ(Float: x, Float:y, &Float:z); // returns a linear approximation of the ground level at the x,y coordinate

I want to use this function to find the ground level according to X,Y,Z. And later on check that Object AGNIV has reached the lowest Ground level(Z). If it has reached , then it will explode.

Can anyone give me a basic design or structure? How to check that object moving object has reached the Lowest Ground level? Please help me.

Thanks
Ballu Miaa
Reply
#2

You can use this with GetObjectPos

Ex:
pawn Код:
new Z, vX, vY, vZ;
MapAndreas_FindAverageZ(1500.0, 200.0, Z);
GetObjectPos(objectid, vX, vY, vZ);

if(Z <= vZ)
    CreateExplosion
Reply
#3

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
You can use this with GetObjectPos
Thanks for the quick reply Vini! In which callback shall i add the check that Object has reached Lowest Z coordinate?
Reply
#4

Try this idea :

1є step - Get the initial Pos (X, Y, Z)

2є step - Use X and Y in MapAndreas_FindAverageZ to find Z_2

3є step - Move the object from X, Y, Z to X, Y, Z_2

4є step - Use CreateExplosion in OnObjectMoved
Reply
#5

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
3є step - Move the object from X, Y, Z to X, Y, Z_2
4є step - Use CreateExplosion in OnObjectMoved
Can you give me a reference code for the third and fourth step? Please
Reply
#6

3є step -
pawn Код:
MoveObject(MyObject, X, Y, Z_2, 5.00);
4є step -

pawn Код:
public OnObjectMoved(objectid)
{
    if(objectid == MyObject)
        CreateExplosion(X, Y, Z_2, 12, 10.0);

    return 1;
}
Reply
#7

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
3є step -
pawn Код:
MoveObject(MyObject, X, Y, Z_2, 5.00);
4є step -

pawn Код:
public OnObjectMoved(objectid)
{
    if(objectid == MyObject)
        CreateExplosion(X, Y, Z_2, 12, 10.0);

    return 1;
}
Awesome!! Thanks a lot Brother. Cheers to Viniborn. Rep+6 Added!

Btw what is the difference between MapAndreas_FindZ_For2DCoord and MapAndreas_FindAverageZ
Reply
#8

To be honest, I don't know. I never used these functions.
Reply
#9

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
To be honest, I don't know. I never used these functions.
Lol bro! :P Same here man. I never used MapAndreas. Anways Thanks again!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)