Help FCNPC Zombies
#1

Hey, im using FCNPC plugin, and i want to create zombies. How can i make when player is in range of the npc to attack him with the FCNPC plugin? I made a this function to create zombies in 'OnGameModeInit'.

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 );
        if( IsPlayerNPC( i ) )
        {
            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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)