stock FCNPC_GoToFixZ ( n, Float:x, Float:y, Float:z, type = MOVE_TYPE_AUTO, Float: speed, bool: mapAndreas = true, Float:radius = 0.0, bool:getangle = true, Float: pitch = 0.1) { mapAndreas = true; static Float:a[3], Float:b[3]; FCNPC_GetPosition(n, a[0], a[1], a[2]); b[0] = x, b[1] = y, b[2] = z; static Float:c[3]; static Float:d[3]; static Float:angle; angle = (atan2(a[0]-b[0], a[1]-b[1]))+180.0; if(angle > 360.0) angle -= 360.0; static Float: i; i = pitch; static Float: j; j = VectorSize(a[0]-b[0], a[1]-b[1], 0.0); while( i <= (j) ) { c[0]=a[0]+(i*floatsin(angle,degrees)); c[1]=a[1]+(i*floatcos(angle,degrees)); d[0]=a[0]+((i-pitch)*floatsin(angle,degrees)); d[1]=a[1]+((i-pitch)*floatcos(angle,degrees)); c[2] = a[2]+(i*( (a[2]-b[2]==0.0?0.0000001:a[2]-b[2])/j)); CA_FindZ_For2DCoord(d[0],d[1],d[2]); i += pitch; if ( d[2] - c[2] > 1.0 ) { mapAndreas = false; break; } } return FCNPC_GoTo( n, x, y, z, type, speed, mapAndreas, radius, getangle); }
Путь ищу так:
Code:
stock FCNPC_GoToFixZ ( n, Float:x, Float:y, Float:z, type = MOVE_TYPE_AUTO, Float: speed, bool: mapAndreas = true, Float:radius = 0.0, bool:getangle = true, Float: pitch = 0.1) { mapAndreas = true; static Float:a[3], Float:b[3]; FCNPC_GetPosition(n, a[0], a[1], a[2]); b[0] = x, b[1] = y, b[2] = z; static Float:c[3]; static Float:d[3]; static Float:angle; angle = (atan2(a[0]-b[0], a[1]-b[1]))+180.0; if(angle > 360.0) angle -= 360.0; static Float: i; i = pitch; static Float: j; j = VectorSize(a[0]-b[0], a[1]-b[1], 0.0); while( i <= (j) ) { c[0]=a[0]+(i*floatsin(angle,degrees)); c[1]=a[1]+(i*floatcos(angle,degrees)); d[0]=a[0]+((i-pitch)*floatsin(angle,degrees)); d[1]=a[1]+((i-pitch)*floatcos(angle,degrees)); c[2] = a[2]+(i*( (a[2]-b[2]==0.0?0.0000001:a[2]-b[2])/j)); CA_FindZ_For2DCoord(d[0],d[1],d[2]); i += pitch; if ( d[2] - c[2] > 1.0 ) { mapAndreas = false; break; } } return FCNPC_GoTo( n, x, y, z, type, speed, mapAndreas, radius, getangle); } |