30.09.2017, 15:11
It's probably caused by FCNPC internal behaviour, let's discard an option:
If there is a difference between debug 1 and debug 2 then a function is internally changing the Z variable. Otherwise, FCNPC internal movement process automatically sets the NPC to the highest Z (like mapandreas).
Код:
new Float:x,Float:y,Float:z; FCNPC_GetPosition(npcid,x,y,z); printf("Debug 1 > %f", z); new Float:px, Float:py; new Float:p,Float:p1,Float:p2; GetPlayerPos(playerid,p,p1,p2); GetPointInFront2D(x,y,FCNPC_GetAngle(npcid),1.0,px,py); // Check collision if(IsBetweenElementToPointIsWall(px,py,z,npcid,item_fcnpc) || IsPointInWaterOrientOfElement(npcid,item_fcnpc,3.0,o_front)) { FCNPC_SetAngle(npcid, RandomFloat(0.0,360.0)); } else // No collision, move. { new rand = random(3); switch(rand) { case 0: FCNPC_GoTo(npcid, px, py, z, MOVE_TYPE_WALK, 0.1); case 1: FCNPC_GoTo(npcid, px, py, z, MOVE_TYPE_WALK, 0.2); case 2: FCNPC_GoTo(npcid, px, py, z, MOVE_TYPE_WALK, 0.3); case 3: FCNPC_GoTo(npcid, px, py, z, MOVE_TYPE_WALK, 0.4); } printf("Debug 2 > %f", z);