[FCNPC] Help with FCNPC_AimAt.
#1

Hi i have make this script in a filterscript, and the npc spawn perfectly but when i want that him shot me with a function FCNPC_AimAt, it doesn't works, you know why..?

pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <FCNPC>

#define MAX_NPCS 10

#if defined FILTERSCRIPT

new npcid;
public OnFilterScriptInit()
{
    npcid = FCNPC_Create("TEST");
       
    FCNPC_Spawn(npcid, 77, 2530.7561,-1678.0607,19.9302);
    FCNPC_SetInterior(npcid, 0);

    FCNPC_SetWeapon(npcid, random(11) + 22);
    FCNPC_SetAmmo(npcid, 500);

    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

forward testnpc();
public testnpc()
{
    new Float:x, Float:y, Float:z;
    FCNPC_GetPosition(npcid,x,y,z);
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i,2.5,x,y,z))
        {
            new Float:rx, Float:ry, Float:rz;
            GetPlayerPos(i,rx,ry,rz);
            FCNPC_AimAt(npcid,rx,ry,rz,1);
        }
    }
    return 1;
}

public FCNPC_OnSpawn()
{
    new Float:x, Float:y, Float:z;
    FCNPC_GetPosition(npcid,x,y,z);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i,10,x,y,z))
        {
            SetTimer("testnpc",3000,false);

        }
    }
    return 1;
}
thanks for read.
Reply
#2

Bump, someone that know help me..?!
Reply
#3

Bump* з_з
Reply
#4

You spawn the NPC already in OnGameModeInit and then the script checks if there is any player in range of the bot but that can't be because it's in OnGameModeInit
I would set the timer in OnGameModeInit
Reply
#5

Quote:
Originally Posted by Macronix
Посмотреть сообщение
You spawn the NPC already in OnGameModeInit and then the script checks if there is any player in range of the bot but that can't be because it's in OnGameModeInit
I would set the timer in OnGameModeInit
still not working, the npc aim at no defined point, and i want that aim to me.
Reply
#6

pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <FCNPC>

#if defined FILTERSCRIPT

new npcid;
public OnFilterScriptInit()
{
    npcid = FCNPC_Create("TEST");
       
    FCNPC_Spawn(npcid, 77, 2530.7561,-1678.0607,19.9302);
    FCNPC_SetInterior(npcid, 0);

    FCNPC_SetWeapon(npcid, random(11) + 22);
    FCNPC_SetAmmo(npcid, 500);
   
    FCNPC_SetHealth(npcid,100.0);
   
   
    new Float:x, Float:y, Float:z;
    FCNPC_GetPosition(npcid,x,y,z);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i,1.5,x,y,z))
        {
            new Float:rx, Float:ry, Float:rz;
            GetPlayerPos(i,rx,ry,rz);
            FCNPC_AimAt(npcid,rx,ry,rz,1);
        }
    }

    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif
I have edited the code above whit this but still don't works, when i go near the npc, he stay already aming and shot at nobody. Someone know why?!
Reply
#7

Bump**
Reply
#8

Bump***
Reply
#9

Nobody knows help me?!
If someone knows an other include for controlable npcs, can reply please.
Reply
#10

Uhm, i mean u just have to put the SetTimer in OnGameModeInit, not the whole thing .^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)