PDA

View Full Version : MapAndreas_FindAverageZ


Ballu Miaa
18/07/2012, 03:00 AM
Hello Everyone,

Can any one please explain me the usage of these natives of ManAndreas, with the used code?
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

ViniBorn
18/07/2012, 03:02 AM
You can use this with GetObjectPos

Ex:

new Z, vX, vY, vZ;
MapAndreas_FindAverageZ(1500.0, 200.0, Z);
GetObjectPos(objectid, vX, vY, vZ);

if(Z <= vZ)
CreateExplosion

Ballu Miaa
18/07/2012, 03:06 AM
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?

ViniBorn
18/07/2012, 03:16 AM
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

Ballu Miaa
18/07/2012, 03:19 AM
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

ViniBorn
18/07/2012, 03:29 AM
3 step -
MoveObject(MyObject, X, Y, Z_2, 5.00);

4 step -

public OnObjectMoved(objectid)
{
if(objectid == MyObject)
CreateExplosion(X, Y, Z_2, 12, 10.0);

return 1;
}

Ballu Miaa
18/07/2012, 03:36 AM
3 step -
MoveObject(MyObject, X, Y, Z_2, 5.00);

4 step -

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

ViniBorn
18/07/2012, 03:39 AM
To be honest, I don't know. I never used these functions.

Ballu Miaa
18/07/2012, 03:50 AM
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!