29.09.2017, 15:49
Zombies are climbing over the poles, dunno why.
Here is the code
Here is the code
PHP код:
new Float:x,Float:y,Float:z;
FCNPC_GetPosition(npcid,x,y,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);
}
}