Move FCNPC
#1

I created the FCNPC and NPCs dont moving i dont know where is problem, but printing me in console that Zombie is moving and cordinates...( just testing with print ). Zombie Dont move, anybody know problem?

#define MAX_ZOMBIES 2

Creating zombie(OGMI)
pawn Код:
CreateZombies() {

    FCNPC_SetUpdateRate( 80 );
    for( new i = 0; i < MAX_NODES; i++ )
    {
        if( !FCNPC_IsNodeOpen( i ) && !FCNPC_OpenNode( i ) )
        {
            printf( "Gamemode: Nije uspjelo otvoriti node %d iz (scriptfiles/FCNPC/Nodes/NODES%d.DAT)", i, i );
            return 0;
        }
    }

    for( new i = 0; i < MAX_ZOMBIES; i++ )
    {
        new
            name[ 24 ];
        format( name, 24, "ZOMBIE%d", i );
        new npcid = FCNPC_Create( name );
        FCNPC_Spawn( npcid, Skins[ random( 7 ) ], 0, 0, 0 );
        FCNPC_SetWeapon( npcid, 4 );
        FCNPC_SetHealth( npcid, 95 );
       
        SetPlayerAttachedObject( i, 1, 2908, 2, 0.064999,0.045000,0.000999, 176.500000, 5.699998, 95.000007, 0.941999, 1.082999, 1.075000 );
        SetPlayerAttachedObject( i, 2, 2907, 1, 0.038000,0.051000,0.027000,-94.999984, -0.299995, 89.399932, 1.0, 0.739000, 1.211000 );
        SetPlayerAttachedObject( i, 3, 2906, 5, -0.146000,0.000000,-0.007000,10.299988,1.500002, -89.800010, 1.0, 1.0, 1.0 );
        SetPlayerAttachedObject( i, 4, 2905, 10, -0.176999,0.082000,0.005000, 0.000000, 0.000000, -92.700004,1.067999, 0.662999, 0.998000 );
        SetPlayerAttachedObject( i, 5, 2804, 8, 0.240999,0.034000,0.000000, 0.000000, 0.000000,91.499977, 0.757999, 1.000000, 1.214999 );
        SetPlayerAttachedObject( i, 5, 2803, 1,0.132999,-0.161000,0.000000, 0.000000,91.599998,102.699989, 0.259000,0.369999, 0.719000 );

        new node = random( MAX_NODES );

        new vehnodes,
            pednodes,
            navinodes;
        FCNPC_GetNodeInfo( node, vehnodes, pednodes, navinodes );

        new
            point;
        if( random( 2 ) == 1 && pednodes != 0 )
            point = random( pednodes ) + pednodes;
        else
            point = random( pednodes );

        FCNPC_SetNodePoint( node, point );

        if( point < vehnodes )
        {
            new Float:x,
                Float:y,
                Float:z;
            FCNPC_GetNodePointPosition( node, x, y, z );
            FCNPC_SetPosition( npcid, x, y, z+1 );
        }
        FCNPC_PlayNode( npcid, node, point < pednodes ? NODE_TYPE_PED : NODE_TYPE_PED );
        SetPlayerColor( npcid, 0xAA333300 );
        FCNPC_SetPosition( npcid, 2232.1501,-1734.9570,13.3828 );

    }
    return true;
}
Command for moving zombie
pawn Код:
for( new j = 0; j != MAX_ZOMBIES; j++ )
    {
            new
                Float:X,
                Float:Y,
                Float:Z;
            GetPlayerPos( playerid, X, Y, Z );
            FCNPC_GoTo( j, X, Y, Z, MOVE_TYPE_RUN, 5.6, 1 );
            printf("Zombie is moving... %f %f %f", X, Y, Y);
    }
Zombie si not moving...
Reply
#2

Maybe need to put en player streaming?
Reply
#3

I don't understand.
Reply
#4

Search on this line

PHP код:
public OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}
public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;

And put then for the moving in this like :

If players Stream (range of view) of the npc zombie they gonna run into then
Reply
#5

Can you make me that, i tried but dont work... I still dont understand...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)