21.09.2018, 14:29
Quote:
You have to use MapAndreas plugin for that, velocity is not for that type of purpose.
Код:
new Float:ox, Float:oy, Float:oz, Float:mz; GetPlayerPos(playerid, ox, oy, oz); MapAndreas_FindZ_For2DCoord(ox, oy, mz); //this here is to find the ground coordinates you have to use mapandreas plugin if(mz != nz) return SCM(playerid, COLOR_LIGHTRED, "* You can't plant seeds in air."); //If ground value doesn't match with the players Z coordinates returns error |
For example
Код:
if(floatabs(z - 1.0 - mz) < 0.3) // Player position must be between 0.7 and 1.3 meters above ground position (considering MapAndreas isn't precise) - a tolerance of 0.3m - subtract 1.0 from player position for the offset { // Not midair }
MapAndreas will detect anything obstructed as underground. You could work with a combination of velocity, animation and player state to get a better result.