30.04.2014, 09:09
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..?
thanks for read.
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;
}