16.09.2017, 13:37
Alright, so, how do we actually set the flying NPCS to the ground using ColAndreas?
I'd suggest to use FCNPC, and then use the native;
And the rest is relatively easy to solve. PHP код:
|
new Float:x, Float:y, Float:znew, Float:z;
GetPlayerPos(npcid, x, y, z);
CA_FindZ_For2DCoord(x, y, znew);
FCNPC_SetVelocity(npcid,x,y,znew);
new Float:x, Float:y, Float:z, Float:unused;
FCNPC_GetPosition(npcid, x, y, z);
new Float:zx,Float:zy;
GetXYInFrontOfPlayer(npcid, zx, zy, 5.0);
new Float:angle;
GetPlayerFacingAngle(npcid,angle);
new Float:newx = 0.0, Float:newy = 0.0, Float:znew;
CA_FindZ_For2DCoord(newx, newy, znew);
FCNPC_SetVelocity(npcid,x,y,znew);
if(CA_RayCastLineAngle(x, y, z, zx, zy, z, unused, unused, unused, unused, unused, unused))
{
FCNPC_Stop(npcid);
printf("Wall"); //debug
SetPVarInt(npcid,"Ignore",1);
}